summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2012-10-21 20:16:58 +0200
committerErik Verbruggen <erik.verbruggen@digia.com>2012-10-24 12:17:12 +0200
commit0b9ce52904139bb8cb2229e602d8b232671af41b (patch)
tree334c3e093cfeee3d21f3a2cbaed2b50a98f21e20 /src
parent97925eaf544417aae1c5b6f79388c834d433071f (diff)
downloadqt-creator-0b9ce52904139bb8cb2229e602d8b232671af41b.tar.gz
C++ Macro Usages: Refactoring
Change-Id: I959e0aeeec3164fdd997c08b6d4ed4e95a39009f Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/cpptools/cppfindreferences.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/plugins/cpptools/cppfindreferences.cpp b/src/plugins/cpptools/cppfindreferences.cpp
index 63e3edabdb..faafde01da 100644
--- a/src/plugins/cpptools/cppfindreferences.cpp
+++ b/src/plugins/cpptools/cppfindreferences.cpp
@@ -573,22 +573,21 @@ _Lrestart:
const Macro &useMacro = use.macro();
if (useMacro.fileName() == macro.fileName()) { // Check if this is a match, but possibly against an outdated document.
+ if (source.isEmpty())
+ source = getSource(fileName, workingCopy);
+
if (macro.fileRevision() > useMacro.fileRevision()) {
// yes, it is outdated, so re-preprocess and start from scratch for this file.
- source = getSource(fileName, workingCopy).toLatin1();
doc = snapshot.preprocessedDocument(source, fileName);
goto _Lrestart;
}
- }
- if (useMacro.fileName() == macro.fileName() && macro.name() == useMacro.name()) {
- if (source.isEmpty())
- source = getSource(fileName, workingCopy);
-
- unsigned lineStart;
- const QString &lineSource = matchingLine(use.begin(), source, &lineStart);
- usages.append(Usage(fileName, lineSource, use.beginLine(),
- use.begin() - lineStart, useMacro.name().length()));
+ if (macro.name() == useMacro.name()) {
+ unsigned lineStart;
+ const QString &lineSource = matchingLine(use.begin(), source, &lineStart);
+ usages.append(Usage(fileName, lineSource, use.beginLine(),
+ use.begin() - lineStart, useMacro.name().length()));
+ }
}
}