CppEditor: Fix removal of "foreign" clang include directories

The version number does not necessarily contain all version parts
anymore.
See also 628babb5cb.

Fixes: QTCREATORBUG-29571
Change-Id: I71fec628c54b430cf2fe0fe54f4f309a2f811043
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2023-09-07 13:21:06 +02:00
parent e892a6224f
commit 9b25ab5329
2 changed files with 3 additions and 1 deletions

View File

@@ -281,6 +281,8 @@ void CompilerOptionsBuilderTest::testClangHeadersAndCppIncludePathsOrderLinux()
t.builtIn("/usr/local/include"),
t.builtIn("/usr/lib/gcc/x86_64-linux-gnu/4.8/include"),
t.builtIn("/usr/include/x86_64-linux-gnu"),
t.builtIn("/usr/lib64/clang/16/include"),
t.builtIn("/usr/lib/clang/15.0.7/include"),
t.builtIn("/usr/include")};
CompilerOptionsBuilder compilerOptionsBuilder(t.finalize(), UseSystemHeader::No,
UseTweakedHeaderPaths::Yes, UseLanguageDefines::No, UseBuildSystemWarnings::No,

View File

@@ -104,7 +104,7 @@ bool isClangSystemHeaderPath(const HeaderPath &headerPath)
// For example GCC on macOS uses system clang include path which makes clang code model
// include incorrect system headers.
static const QRegularExpression clangIncludeDir(
R"(\A.*/lib\d*/clang/\d+\.\d+(\.\d+)?/include\z)");
R"(\A.*/lib\d*/clang/\d+(\.\d+){0,2}/include\z)");
return clangIncludeDir.match(headerPath.path).hasMatch();
}