diff options
author | Marco Bubke <marco.bubke@qt.io> | 2018-09-03 16:10:43 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2018-09-10 09:31:32 +0000 |
commit | 3abaf647d0c632a4dfcb00d9ad2d1ffe66e014d9 (patch) | |
tree | 5efed90dedcb7b960cfa4d6ceb9b1aeb3e1a662b /src/plugins/cppeditor/cppquickfixes.cpp | |
parent | 59e734d9dae00ce2f9a00e8d197f81e7ee450b03 (diff) |
Add system include path to HeaderPath and merge ProjectPartHeaderPath
System include paths are appended after other includes by the compiler. So
we should set them as system includes and not as normal includes. Otherwise
we change the include order. Headers in system include paths are not
cluttering the screen with unwanted warning and by the way improve
performance too.
ProjectPartHeaderPath was a dopperganger of HeaderPath, so we merged them.
Change-Id: I7c394b4098b697de79761499ffcd5913cc02d652
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfixes.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppquickfixes.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index 103f2e208e..b4cc33f796 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -1740,7 +1740,7 @@ namespace { QString findShortestInclude(const QString currentDocumentFilePath, const QString candidateFilePath, - const ProjectPartHeaderPaths &headerPaths) + const ProjectExplorer::HeaderPaths &headerPaths) { QString result; @@ -1749,7 +1749,7 @@ QString findShortestInclude(const QString currentDocumentFilePath, if (fileInfo.path() == QFileInfo(currentDocumentFilePath).path()) { result = QLatin1Char('"') + fileInfo.fileName() + QLatin1Char('"'); } else { - foreach (const ProjectPartHeaderPath &headerPath, headerPaths) { + foreach (const ProjectExplorer::HeaderPath &headerPath, headerPaths) { if (!candidateFilePath.startsWith(headerPath.path)) continue; QString relativePath = candidateFilePath.mid(headerPath.path.size()); @@ -1764,12 +1764,12 @@ QString findShortestInclude(const QString currentDocumentFilePath, } QString findQtIncludeWithSameName(const QString &className, - const ProjectPartHeaderPaths &headerPaths) + const ProjectExplorer::HeaderPaths &headerPaths) { QString result; // Check for a header file with the same name in the Qt include paths - foreach (const ProjectPartHeaderPath &headerPath, headerPaths) { + foreach (const ProjectExplorer::HeaderPath &headerPath, headerPaths) { if (!headerPath.path.contains(QLatin1String("/Qt"))) // "QtCore", "QtGui" etc... continue; @@ -1784,9 +1784,9 @@ QString findQtIncludeWithSameName(const QString &className, return result; } -ProjectPartHeaderPaths relevantHeaderPaths(const QString &filePath) +ProjectExplorer::HeaderPaths relevantHeaderPaths(const QString &filePath) { - ProjectPartHeaderPaths headerPaths; + ProjectExplorer::HeaderPaths headerPaths; CppModelManager *modelManager = CppModelManager::instance(); const QList<ProjectPart::Ptr> projectParts = modelManager->projectPart(filePath); @@ -1931,7 +1931,7 @@ void AddIncludeForUndefinedIdentifier::match(const CppQuickFixInterface &interfa QString className; QList<Core::LocatorFilterEntry> matches; const QString currentDocumentFilePath = interface.semanticInfo().doc->fileName(); - const ProjectPartHeaderPaths headerPaths = relevantHeaderPaths(currentDocumentFilePath); + const ProjectExplorer::HeaderPaths headerPaths = relevantHeaderPaths(currentDocumentFilePath); bool qtHeaderFileIncludeOffered = false; // Find an include file through the locator |