Commit 291b80cb authored by Nikolai Kosjar's avatar Nikolai Kosjar Committed by Erik Verbruggen
Browse files

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's avatarOrgad Shaneh <>
Reviewed-by: default avatarErik Verbruggen <>
parent e7904caf
......@@ -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(),
void CppEditorSupport::recalculateSemanticInfoNow(const SemanticInfo::Source &source,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment