forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
QStringList extraCodeModelFlags;
|
||||
|
||||
QString sysRootPath; // For headerPathsRunner.
|
||||
ProjectExplorer::ToolChain::SystemHeaderPathsRunner headerPathsRunner;
|
||||
ProjectExplorer::ToolChain::BuiltInHeaderPathsRunner headerPathsRunner;
|
||||
ProjectExplorer::ToolChain::PredefinedMacrosRunner predefinedMacrosRunner;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user