diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-09-17 11:29:32 +0200 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-09-17 11:24:32 +0000 |
commit | 0bd095aa4550eac51d026c96e5128720bf867a41 (patch) | |
tree | 3c9a36fc38b603884a8eabcb47c4511fceed91ad /src/plugins/cpptools | |
parent | 3170d05087f3e1993bef1f9447a8bbd14a32a891 (diff) | |
download | qt-creator-0bd095aa4550eac51d026c96e5128720bf867a41.tar.gz |
ProjectExplorer: Rename compiler includes from System to BuiltIn
System include are those used with -isystem keyword, built-in
includes on the other hand come from compiler and always
follow in the end of the include list (after system includes).
Change-Id: I95c2fec36d2e5b43f014fe0a88d59c6769edfa1f
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/plugins/cpptools')
-rw-r--r-- | src/plugins/cpptools/compileroptionsbuilder.cpp | 34 | ||||
-rw-r--r-- | src/plugins/cpptools/cppcodemodelinspectordumper.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cpptools/cppprojectinfogenerator.cpp | 4 | ||||
-rw-r--r-- | src/plugins/cpptools/cppsourceprocessor.cpp | 6 | ||||
-rw-r--r-- | src/plugins/cpptools/projectinfo.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cpptools/projectinfo.h | 2 |
6 files changed, 29 insertions, 21 deletions
diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index b0a5b5633e..38fa94e83d 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -200,7 +200,9 @@ void CompilerOptionsBuilder::addHeaderPathOptions() { using ProjectExplorer::HeaderPathType; - QStringList result; + QStringList includes; + QStringList systemIncludes; + QStringList builtInIncludes; for (const ProjectExplorer::HeaderPath &headerPath : qAsConst(m_projectPart.headerPaths)) { if (headerPath.path.isEmpty()) @@ -209,29 +211,33 @@ void CompilerOptionsBuilder::addHeaderPathOptions() if (excludeHeaderPath(headerPath.path)) continue; - QString prefix; - Utils::FileName path; switch (headerPath.type) { case HeaderPathType::Framework: - prefix = QLatin1String("-F"); - break; - case HeaderPathType::System: - prefix = m_useSystemHeader == UseSystemHeader::No - ? QLatin1String("-I") - : QLatin1String("-isystem"); + includes.append("-F"); + includes.append(QDir::toNativeSeparators(headerPath.path)); break; default: // This shouldn't happen, but let's be nice..: // intentional fall-through: case HeaderPathType::User: - prefix = includeDirOptionForPath(headerPath.path); + includes.append(includeDirOptionForPath(headerPath.path)); + includes.append(QDir::toNativeSeparators(headerPath.path)); + break; + case HeaderPathType::BuiltIn: + builtInIncludes.append("-isystem"); + builtInIncludes.append(QDir::toNativeSeparators(headerPath.path)); + break; + case HeaderPathType::System: + systemIncludes.append(m_useSystemHeader == UseSystemHeader::No + ? QLatin1String("-I") + : QLatin1String("-isystem")); + systemIncludes.append(QDir::toNativeSeparators(headerPath.path)); break; } - - result.append(prefix); - result.append(QDir::toNativeSeparators(headerPath.path)); } - m_options.append(result); + m_options.append(includes); + m_options.append(systemIncludes); + m_options.append(builtInIncludes); } void CompilerOptionsBuilder::addPrecompiledHeaderOptions(PchUsage pchUsage) diff --git a/src/plugins/cpptools/cppcodemodelinspectordumper.cpp b/src/plugins/cpptools/cppcodemodelinspectordumper.cpp index 86b5c57d45..6a0c1fe124 100644 --- a/src/plugins/cpptools/cppcodemodelinspectordumper.cpp +++ b/src/plugins/cpptools/cppcodemodelinspectordumper.cpp @@ -96,6 +96,7 @@ QString Utils::toString(ProjectExplorer::HeaderPathType type) CASE_LANGUAGEVERSION(User); CASE_LANGUAGEVERSION(System); CASE_LANGUAGEVERSION(Framework); + CASE_LANGUAGEVERSION(BuiltIn); // no default to get a compiler warning if anything is added } #undef CASE_LANGUAGEVERSION @@ -472,6 +473,7 @@ static void printIncludeType(QTextStream &out, ProjectExplorer::HeaderPathType t case HeaderPathType::User: out << "(user include path)"; break; case HeaderPathType::System: out << "(system include path)"; break; case HeaderPathType::Framework: out << "(framework path)"; break; + case HeaderPathType::BuiltIn: out << "(built-in include path)"; break; } } diff --git a/src/plugins/cpptools/cppprojectinfogenerator.cpp b/src/plugins/cpptools/cppprojectinfogenerator.cpp index f7d6ed1dbd..133a5237d2 100644 --- a/src/plugins/cpptools/cppprojectinfogenerator.cpp +++ b/src/plugins/cpptools/cppprojectinfogenerator.cpp @@ -116,12 +116,12 @@ private: if (!m_tcInfo.headerPathsRunner) return; // No compiler set in kit. - const ProjectExplorer::HeaderPaths systemHeaderPaths + const ProjectExplorer::HeaderPaths builtInHeaderPaths = m_tcInfo.headerPathsRunner(m_flags.commandLineFlags, m_tcInfo.sysRootPath); ProjectExplorer::HeaderPaths &headerPaths = m_projectPart.headerPaths; - for (const ProjectExplorer::HeaderPath &header : systemHeaderPaths) { + for (const ProjectExplorer::HeaderPath &header : builtInHeaderPaths) { const ProjectExplorer::HeaderPath headerPath{header.path, header.type}; if (!headerPaths.contains(headerPath)) headerPaths.push_back(headerPath); diff --git a/src/plugins/cpptools/cppsourceprocessor.cpp b/src/plugins/cpptools/cppsourceprocessor.cpp index 54e93ce41a..11f266b6a5 100644 --- a/src/plugins/cpptools/cppsourceprocessor.cpp +++ b/src/plugins/cpptools/cppsourceprocessor.cpp @@ -138,10 +138,10 @@ void CppSourceProcessor::setHeaderPaths(const ProjectExplorer::HeaderPaths &head for (int i = 0, ei = headerPaths.size(); i < ei; ++i) { const ProjectExplorer::HeaderPath &path = headerPaths.at(i); - if (path.type == HeaderPathType::User || path.type == HeaderPathType::System) - m_headerPaths.append({cleanPath(path.path), path.type}); - else + if (path.type == HeaderPathType::Framework ) addFrameworkPath(path); + else + m_headerPaths.append({cleanPath(path.path), path.type}); } } diff --git a/src/plugins/cpptools/projectinfo.cpp b/src/plugins/cpptools/projectinfo.cpp index 44c4fbe35b..adcabc9095 100644 --- a/src/plugins/cpptools/projectinfo.cpp +++ b/src/plugins/cpptools/projectinfo.cpp @@ -47,7 +47,7 @@ ToolChainInfo::ToolChainInfo(const ProjectExplorer::ToolChain *toolChain, // ...and save the potentially expensive operations for later so that // they can be run from a worker thread. sysRootPath = ProjectExplorer::SysRootKitInformation::sysRoot(kit).toString(); - headerPathsRunner = toolChain->createSystemHeaderPathsRunner(); + headerPathsRunner = toolChain->createBuiltInHeaderPathsRunner(); predefinedMacrosRunner = toolChain->createPredefinedMacrosRunner(); } } diff --git a/src/plugins/cpptools/projectinfo.h b/src/plugins/cpptools/projectinfo.h index c36eaa792d..8b30998744 100644 --- a/src/plugins/cpptools/projectinfo.h +++ b/src/plugins/cpptools/projectinfo.h @@ -57,7 +57,7 @@ public: QStringList extraCodeModelFlags; QString sysRootPath; // For headerPathsRunner. - ProjectExplorer::ToolChain::SystemHeaderPathsRunner headerPathsRunner; + ProjectExplorer::ToolChain::BuiltInHeaderPathsRunner headerPathsRunner; ProjectExplorer::ToolChain::PredefinedMacrosRunner predefinedMacrosRunner; }; |