forked from qt-creator/qt-creator
Clang: Avoid using -isystem include paths
...as this leads to file locking issues on Windows and pointless diagnostics we currently ignore when opening files from -isystem include paths. The usage of -isystem suppressed warnings from system headers and resulted in a performance boost. Nowadays we can preserve this performance optimization by making use of the new CXTranslationUnit_IgnoreWarningsFromIncludedFiles. This flag helps us also to suppress diagnostics from clang tidy checks, which reported diagnostics even for -isystem headers. Change-Id: I33e1f7169e2ff9f17c811565a5324b9da4740701 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
committed by
Ivan Donchevskii
parent
7d076e9e26
commit
32614e9983
@@ -129,28 +129,10 @@ void CompilerOptionsBuilder::enableExceptions()
|
||||
add(QLatin1String("-fexceptions"));
|
||||
}
|
||||
|
||||
static Utils::FileName absoluteDirectory(const QString &filePath)
|
||||
{
|
||||
return Utils::FileName::fromString(QFileInfo(filePath + '/').absolutePath());
|
||||
}
|
||||
|
||||
static Utils::FileName projectTopLevelDirectory(const ProjectPart &projectPart)
|
||||
{
|
||||
if (!projectPart.project)
|
||||
return Utils::FileName();
|
||||
const Utils::FileName result = projectPart.project->projectDirectory();
|
||||
const Utils::FileName vcsTopLevel = Utils::FileName::fromString(
|
||||
Core::VcsManager::findTopLevelForDirectory(result.toString()));
|
||||
if (result.isChildOf(vcsTopLevel))
|
||||
return vcsTopLevel;
|
||||
return result;
|
||||
}
|
||||
|
||||
void CompilerOptionsBuilder::addHeaderPathOptions()
|
||||
{
|
||||
typedef ProjectPartHeaderPath HeaderPath;
|
||||
const QString defaultPrefix = includeDirOption();
|
||||
const Utils::FileName projectDirectory = projectTopLevelDirectory(m_projectPart);
|
||||
|
||||
QStringList result;
|
||||
|
||||
@@ -170,14 +152,7 @@ void CompilerOptionsBuilder::addHeaderPathOptions()
|
||||
default: // This shouldn't happen, but let's be nice..:
|
||||
// intentional fall-through:
|
||||
case HeaderPath::IncludePath:
|
||||
path = absoluteDirectory(headerPath.path);
|
||||
if (projectDirectory.isEmpty()
|
||||
|| path == projectDirectory
|
||||
|| path.isChildOf(projectDirectory)) {
|
||||
prefix = defaultPrefix;
|
||||
} else {
|
||||
prefix = SYSTEM_INCLUDE_PREFIX;
|
||||
}
|
||||
prefix = defaultPrefix;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user