From 291b80cb330f6f7a802ad9039c6e4294caee61b1 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 8 Apr 2014 09:53:01 -0400 Subject: 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 Reviewed-by: Erik Verbruggen --- src/plugins/cpptools/cpptoolseditorsupport.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/plugins/cpptools/cpptoolseditorsupport.cpp') diff --git a/src/plugins/cpptools/cpptoolseditorsupport.cpp b/src/plugins/cpptools/cpptoolseditorsupport.cpp index 4f1adb8a25..130b24a9a3 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, -- cgit v1.2.1