Commit 0b9ce529 authored by Andre Hartmann's avatar Andre Hartmann Committed by Erik Verbruggen
Browse files

C++ Macro Usages: Refactoring



Change-Id: I959e0aeeec3164fdd997c08b6d4ed4e95a39009f
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 97925eaf
...@@ -573,24 +573,23 @@ _Lrestart: ...@@ -573,24 +573,23 @@ _Lrestart:
const Macro &useMacro = use.macro(); const Macro &useMacro = use.macro();
if (useMacro.fileName() == macro.fileName()) { // Check if this is a match, but possibly against an outdated document. 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()) { if (macro.fileRevision() > useMacro.fileRevision()) {
// yes, it is outdated, so re-preprocess and start from scratch for this file. // yes, it is outdated, so re-preprocess and start from scratch for this file.
source = getSource(fileName, workingCopy).toLatin1();
doc = snapshot.preprocessedDocument(source, fileName); doc = snapshot.preprocessedDocument(source, fileName);
goto _Lrestart; goto _Lrestart;
} }
}
if (useMacro.fileName() == macro.fileName() && macro.name() == useMacro.name()) {
if (source.isEmpty())
source = getSource(fileName, workingCopy);
if (macro.name() == useMacro.name()) {
unsigned lineStart; unsigned lineStart;
const QString &lineSource = matchingLine(use.begin(), source, &lineStart); const QString &lineSource = matchingLine(use.begin(), source, &lineStart);
usages.append(Usage(fileName, lineSource, use.beginLine(), usages.append(Usage(fileName, lineSource, use.beginLine(),
use.begin() - lineStart, useMacro.name().length())); use.begin() - lineStart, useMacro.name().length()));
} }
} }
}
if (future->isPaused()) if (future->isPaused())
future->waitForResume(); future->waitForResume();
......
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