summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppsourceprocessor.cpp
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2018-09-03 16:10:43 +0200
committerMarco Bubke <marco.bubke@qt.io>2018-09-10 09:31:32 +0000
commit3abaf647d0c632a4dfcb00d9ad2d1ffe66e014d9 (patch)
tree5efed90dedcb7b960cfa4d6ceb9b1aeb3e1a662b /src/plugins/cpptools/cppsourceprocessor.cpp
parent59e734d9dae00ce2f9a00e8d197f81e7ee450b03 (diff)
downloadqt-creator-3abaf647d0c632a4dfcb00d9ad2d1ffe66e014d9.tar.gz
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/cpptools/cppsourceprocessor.cpp')
-rw-r--r--src/plugins/cpptools/cppsourceprocessor.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/plugins/cpptools/cppsourceprocessor.cpp b/src/plugins/cpptools/cppsourceprocessor.cpp
index 5cff8d8fb2..4ca4ee5721 100644
--- a/src/plugins/cpptools/cppsourceprocessor.cpp
+++ b/src/plugins/cpptools/cppsourceprocessor.cpp
@@ -130,15 +130,16 @@ void CppSourceProcessor::setCancelChecker(const CppSourceProcessor::CancelChecke
void CppSourceProcessor::setWorkingCopy(const WorkingCopy &workingCopy)
{ m_workingCopy = workingCopy; }
-void CppSourceProcessor::setHeaderPaths(const ProjectPartHeaderPaths &headerPaths)
+void CppSourceProcessor::setHeaderPaths(const ProjectExplorer::HeaderPaths &headerPaths)
{
+ using ProjectExplorer::IncludePathType;
m_headerPaths.clear();
for (int i = 0, ei = headerPaths.size(); i < ei; ++i) {
- const ProjectPartHeaderPath &path = headerPaths.at(i);
+ const ProjectExplorer::HeaderPath &path = headerPaths.at(i);
- if (path.type == ProjectPartHeaderPath::IncludePath)
- m_headerPaths.append(ProjectPartHeaderPath(cleanPath(path.path), path.type));
+ if (path.type == IncludePathType::User || path.type == IncludePathType::System)
+ m_headerPaths.append({cleanPath(path.path), path.type});
else
addFrameworkPath(path);
}
@@ -156,15 +157,15 @@ void CppSourceProcessor::setLanguageFeatures(const LanguageFeatures languageFeat
// has private frameworks in:
// <framework-path>/ApplicationServices.framework/Frameworks
// if the "Frameworks" folder exists inside the top level framework.
-void CppSourceProcessor::addFrameworkPath(const ProjectPartHeaderPath &frameworkPath)
+void CppSourceProcessor::addFrameworkPath(const ProjectExplorer::HeaderPath &frameworkPath)
{
QTC_ASSERT(frameworkPath.isFrameworkPath(), return);
// The algorithm below is a bit too eager, but that's because we're not getting
// in the frameworks we're linking against. If we would have that, then we could
// add only those private frameworks.
- const ProjectPartHeaderPath cleanFrameworkPath(cleanPath(frameworkPath.path),
- frameworkPath.type);
+ const ProjectExplorer::HeaderPath cleanFrameworkPath(cleanPath(frameworkPath.path),
+ ProjectExplorer::IncludePathType::Framework);
if (!m_headerPaths.contains(cleanFrameworkPath))
m_headerPaths.append(cleanFrameworkPath);
@@ -176,8 +177,8 @@ void CppSourceProcessor::addFrameworkPath(const ProjectPartHeaderPath &framework
const QFileInfo privateFrameworks(framework.absoluteFilePath(),
QLatin1String("Frameworks"));
if (privateFrameworks.exists() && privateFrameworks.isDir())
- addFrameworkPath(ProjectPartHeaderPath(privateFrameworks.absoluteFilePath(),
- frameworkPath.type));
+ addFrameworkPath({privateFrameworks.absoluteFilePath(),
+ ProjectExplorer::IncludePathType::Framework});
}
}
@@ -295,7 +296,7 @@ QString CppSourceProcessor::resolveFile(const QString &fileName, IncludeType typ
}
QString CppSourceProcessor::resolveFile_helper(const QString &fileName,
- ProjectPartHeaderPaths::Iterator headerPathsIt)
+ ProjectExplorer::HeaderPaths::Iterator headerPathsIt)
{
auto headerPathsEnd = m_headerPaths.end();
const int index = fileName.indexOf(QLatin1Char('/'));