From 3abaf647d0c632a4dfcb00d9ad2d1ffe66e014d9 Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Mon, 3 Sep 2018 16:10:43 +0200 Subject: 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 --- src/plugins/cpptools/cppsourceprocessor.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/plugins/cpptools/cppsourceprocessor.cpp') 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: // /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('/')); -- cgit v1.2.1