C++: Fix outdated macro usage info in documents.

Record revisions of documents in macro definitions and usages. Then,
when searching for usages, check the revision of the documents against
the revision of the macros. If they are out-of-sync, repreprocess the
documents to get up-to-date info.

Task-number: QTCREATORBUG-7872
Change-Id: I846bb52ec660024728ab117a9fb7e43382a50e63
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
Erik Verbruggen
2012-10-11 16:16:01 +02:00
parent 199b243bca
commit f3faef5a1e
13 changed files with 132 additions and 46 deletions

View File

@@ -79,7 +79,8 @@ public:
void appendMacro(const Macro &macro);
void addMacroUse(const Macro &macro, unsigned offset, unsigned length,
unsigned beginLine, const QVector<MacroArgumentReference> &range);
unsigned beginLine,
const QVector<MacroArgumentReference> &range);
void addUndefinedMacroUse(const QByteArray &name, unsigned offset);
Control *control() const;
@@ -254,8 +255,7 @@ public:
unsigned _beginLine;
public:
inline MacroUse(const Macro &macro,
unsigned begin, unsigned end, unsigned beginLine)
inline MacroUse(const Macro &macro, unsigned begin, unsigned end, unsigned beginLine)
: Block(begin, end),
_macro(macro),
_beginLine(beginLine)
@@ -371,10 +371,10 @@ public:
Snapshot simplified(Document::Ptr doc) const;
QByteArray preprocessedCode(const QString &source,
const QString &fileName) const;
Document::Ptr preprocessedDocument(const QString &source,
const QString &fileName) const;
Document::Ptr documentFromSource(const QByteArray &preprocessedCode,
Document::Ptr documentFromSource(const QByteArray &preprocessedDocument,
const QString &fileName) const;
private: