Clang: Fix removing gcc internal include paths

Amends 5165c037eb.

Gentoo has the standard library headers installed in e.g.
<installdir>/include/g++-v8 and we excluded those. MinGW with the
standard library headers in <installdir>/include/c++ was whitelisted.

Instead of whitelistening more dirs that could contain standard library
headers, regard

  <installdir>/include
  <installdir>/include-fixed

as gcc internal include paths to remove. These seem to be stable across
distributions.

Task-number: QTCREATORBUG-23330
Change-Id: I44965d2030b4ea5a9dd269400faf19c3df89f5a6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Nikolai Kosjar
2019-12-19 10:56:20 +01:00
parent 32018623a4
commit 4fdd944617
2 changed files with 8 additions and 11 deletions

View File

@@ -71,15 +71,10 @@ void HeaderPathFilter::removeGccInternalIncludePaths()
return;
const Utils::FilePath gccInstallDir = projectPart.toolChainInstallDir;
auto isGccInternalInclude = [gccInstallDir](const HeaderPath &headerPath){
const auto includePath = Utils::FilePath::fromString(headerPath.path);
if (includePath.isChildOf(gccInstallDir)) {
const QString remainingPath = headerPath.path.mid(gccInstallDir.toString().size());
// MinGW ships the standard library headers in "<installdir>/include/c++".
// Ensure that we do not remove include paths pointing there.
return !remainingPath.startsWith("/include/c++");
}
return false;
auto isGccInternalInclude = [gccInstallDir](const HeaderPath &headerPath) {
const auto filePath = Utils::FilePath::fromString(headerPath.path);
return filePath == gccInstallDir.pathAppended("include")
|| filePath == gccInstallDir.pathAppended("include-fixed");
};
Utils::erase(builtInHeaderPaths, isGccInternalInclude);