aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cpptools
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2014-04-08 09:53:01 -0400
committerErik Verbruggen <erik.verbruggen@digia.com>2014-04-14 10:28:37 +0200
commit291b80cb330f6f7a802ad9039c6e4294caee61b1 (patch)
tree60b00bf737b97eb1655aebd3c457a4d5304c1595 /src/plugins/cpptools
parente7904caf0b1c3fe4fe88e275286c0da326e1e2cf (diff)
CppTools: Remove invalid optimization for highlighting
The optimization in question could lead to an empty source and thus to no highlighting. Checking for 'force' and the revisions is at this point not enough since later the semantic info calculcation can be aborted, so that a subsequent recalculation would get an empty document. contents() itself is already optimized (uses caching). Task-number: QTCREATORBUG-11367 Change-Id: If31a8ab0c848e4babd38104961fb9812f077a2be Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r--src/plugins/cpptools/cpptoolseditorsupport.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp
index 4f1adb8a259..130b24a9a3a 100644
--- a/src/plugins/cpptools/cpptoolseditorsupport.cpp
+++ b/src/plugins/cpptools/cpptoolseditorsupport.cpp
@@ -518,13 +518,8 @@ SemanticInfo::Source CppEditorSupport::currentSource(bool force)
int line = 0, column = 0;
m_textEditor->convertPosition(m_textEditor->editorWidget()->position(), &line, &column);
- QByteArray code;
- if (force || m_lastSemanticInfo.revision != editorRevision())
- code = contents(); // get the source code only when needed.
-
- const unsigned revision = editorRevision();
- SemanticInfo::Source source(Snapshot(), fileName(), code, line, column, revision, force);
- return source;
+ return SemanticInfo::Source(Snapshot(), fileName(), contents(), line, column, editorRevision(),
+ force);
}
void CppEditorSupport::recalculateSemanticInfoNow(const SemanticInfo::Source &source,