diff options
author | Roberto Raggi <qtc-committer@nokia.com> | 2008-12-12 10:07:58 +0100 |
---|---|---|
committer | Roberto Raggi <qtc-committer@nokia.com> | 2008-12-12 10:07:58 +0100 |
commit | bab60d14b341edc4fd1f81ec12cc460441948c3b (patch) | |
tree | 6724341a39bba0f19aa97af9c8c52f2f883ef152 /src/plugins/cpptools/cppcodecompletion.cpp | |
parent | ce66bc3c1e64a8a4eb7f40824a75ec52420340cf (diff) | |
download | qt-creator-bab60d14b341edc4fd1f81ec12cc460441948c3b.tar.gz |
Introduced CPlusPlus::Snapshot, it contains a snap shot of the indexer's current state.
This change removes a number of wrong usages of the CppModelManager::documents()/document().
Diffstat (limited to 'src/plugins/cpptools/cppcodecompletion.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcodecompletion.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/cpptools/cppcodecompletion.cpp b/src/plugins/cpptools/cppcodecompletion.cpp index 4606bd948f..a0fbe82a54 100644 --- a/src/plugins/cpptools/cppcodecompletion.cpp +++ b/src/plugins/cpptools/cppcodecompletion.cpp @@ -434,10 +434,12 @@ int CppCodeCompletion::startCompletion(TextEditor::ITextEditable *editor) //if (! expression.isEmpty()) //qDebug() << "***** expression:" << expression; - if (Document::Ptr thisDocument = m_manager->document(fileName)) { + const Snapshot snapshot = m_manager->snapshot(); + + if (Document::Ptr thisDocument = snapshot.value(fileName)) { Symbol *symbol = thisDocument->findSymbolAt(line, column); - typeOfExpression.setDocuments(m_manager->documents()); + typeOfExpression.setSnapshot(m_manager->snapshot()); QList<TypeOfExpression::Result> resolvedTypes = typeOfExpression(expression, thisDocument, symbol, TypeOfExpression::Preprocess); @@ -1034,7 +1036,7 @@ void CppCodeCompletion::cleanup() // Set empty map in order to avoid referencing old versions of the documents // until the next completion - typeOfExpression.setDocuments(QMap<QString, Document::Ptr>()); + typeOfExpression.setSnapshot(Snapshot()); } int CppCodeCompletion::findStartOfName(const TextEditor::ITextEditor *editor) |