summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cpphighlightingsupportinternal.cpp
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@digia.com>2013-11-29 11:25:47 +0100
committerNikolai Kosjar <nikolai.kosjar@digia.com>2013-11-29 15:11:27 +0100
commit4c2daa90ce558c3b4287edc97127471486a411d9 (patch)
tree02250176caac60cb01e92cbefbe9166badf957c6 /src/plugins/cpptools/cpphighlightingsupportinternal.cpp
parent4edfe87b58ca8e5f92b6a10dcf98e3d240f38245 (diff)
downloadqt-creator-4c2daa90ce558c3b4287edc97127471486a411d9.tar.gz
C++: Fix highlighting for lines with predefined macros
This adds definitions for the macros __FILE__, __LINE__, __DATE__ and __TIME__ on demand. As a side effect, this also introduces highlighting for the uses of these macros. Task-number: QTCREATORBUG-8036 Change-Id: Ib7546c7d45d2eecbc50c7883fc684e3497154405 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'src/plugins/cpptools/cpphighlightingsupportinternal.cpp')
-rw-r--r--src/plugins/cpptools/cpphighlightingsupportinternal.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cpphighlightingsupportinternal.cpp b/src/plugins/cpptools/cpphighlightingsupportinternal.cpp
index 3009d45c16..d2a14170e4 100644
--- a/src/plugins/cpptools/cpphighlightingsupportinternal.cpp
+++ b/src/plugins/cpptools/cpphighlightingsupportinternal.cpp
@@ -58,6 +58,9 @@ QFuture<TextEditor::HighlightingResult> CppHighlightingSupportInternal::highligh
// Get macro definitions
foreach (const CPlusPlus::Macro& macro, doc->definedMacros()) {
+ if (macro.isPredefined())
+ continue; // No "real" definition location
+
int line, column;
editor()->convertPosition(macro.offset(), &line, &column);
++column; //Highlighting starts at (column-1) --> compensate here