forked from qt-creator/qt-creator
C++: Only parse with appropriate defines for open editors.
If two files from different (sub-)projects include the same header file, and the defined macros differ for both files, the header file will be parsed with only the appropriate macros for the including file. Task-number: QTCREATORBUG-9802 Task-number: QTCREATORBUG-1249 Change-Id: I560490afa287b3bb1e863bce1bb4f57af36ad56e Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "cppcompletionassist.h"
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cpptoolsconstants.h"
|
||||
#include "cpptoolseditorsupport.h"
|
||||
#include "cppdoxygen.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -416,24 +417,28 @@ IAssistProcessor *InternalCompletionAssistProvider::createProcessor() const
|
||||
}
|
||||
|
||||
TextEditor::IAssistInterface *InternalCompletionAssistProvider::createAssistInterface(
|
||||
ProjectExplorer::Project *project, const QString &filePath, QTextDocument *document,
|
||||
ProjectExplorer::Project *project, BaseTextEditor *editor, QTextDocument *document,
|
||||
int position, TextEditor::AssistReason reason) const
|
||||
{
|
||||
Q_UNUSED(project);
|
||||
|
||||
CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
|
||||
QStringList includePaths;
|
||||
QStringList frameworkPaths;
|
||||
if (project) {
|
||||
includePaths = modelManager->projectInfo(project).includePaths();
|
||||
frameworkPaths = modelManager->projectInfo(project).frameworkPaths();
|
||||
|
||||
if (CppEditorSupport *supp = modelManager->cppEditorSupport(editor)) {
|
||||
if (QSharedPointer<SnapshotUpdater> updater = supp->snapshotUpdater()) {
|
||||
updater->update(modelManager->workingCopy());
|
||||
return new CppTools::Internal::CppCompletionAssistInterface(
|
||||
document,
|
||||
position,
|
||||
editor->document()->filePath(),
|
||||
reason,
|
||||
updater->snapshot(),
|
||||
updater->includePaths(),
|
||||
updater->frameworkPaths());
|
||||
}
|
||||
}
|
||||
return new CppTools::Internal::CppCompletionAssistInterface(
|
||||
document,
|
||||
position,
|
||||
filePath,
|
||||
reason,
|
||||
modelManager->snapshot(),
|
||||
includePaths,
|
||||
frameworkPaths);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// -----------------
|
||||
|
||||
Reference in New Issue
Block a user