forked from qt-creator/qt-creator
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:
@@ -676,10 +676,19 @@ void Snapshot::insert(Document::Ptr doc)
|
||||
_documents.insert(doc->fileName(), doc);
|
||||
}
|
||||
|
||||
QByteArray Snapshot::preprocessedCode(const QString &source, const QString &fileName) const
|
||||
Document::Ptr Snapshot::preprocessedDocument(const QString &source, const QString &fileName) const
|
||||
{
|
||||
Document::Ptr newDoc = Document::create(fileName);
|
||||
if (Document::Ptr thisDocument = document(fileName)) {
|
||||
newDoc->_revision = thisDocument->_revision;
|
||||
newDoc->_editorRevision = thisDocument->_editorRevision;
|
||||
newDoc->_lastModified = thisDocument->_lastModified;
|
||||
}
|
||||
|
||||
FastPreprocessor pp(*this);
|
||||
return pp.run(fileName, source);
|
||||
const QByteArray preprocessedCode = pp.run(newDoc, source);
|
||||
newDoc->setUtf8Source(preprocessedCode);
|
||||
return newDoc;
|
||||
}
|
||||
|
||||
Document::Ptr Snapshot::documentFromSource(const QByteArray &preprocessedCode,
|
||||
|
||||
Reference in New Issue
Block a user