diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2019-10-11 09:29:50 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2019-10-11 13:08:28 +0000 |
commit | 6156c59c626ba9b3ba5a14333e6ca246f514e0a5 (patch) | |
tree | f1bb07d6da40efeb1469193edd2908777687c6e4 | |
parent | ceecd22e5f557956d608efa0f9f08a468d4ce2e6 (diff) | |
download | qt-creator-6156c59c626ba9b3ba5a14333e6ca246f514e0a5.tar.gz |
Clang: Put clang's resource dir after /usr/local/include
...also on Linux.
That's what clang invoked from the command line does.
Change-Id: I59c48d11fab3b944bb42ca7bb4cd9093a735df60
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
-rw-r--r-- | src/plugins/cpptools/headerpathfilter.cpp | 16 | ||||
-rw-r--r-- | tests/unit/unittest/compileroptionsbuilder-test.cpp | 4 | ||||
-rw-r--r-- | tests/unit/unittest/headerpathfilter-test.cpp | 2 |
3 files changed, 8 insertions, 14 deletions
diff --git a/src/plugins/cpptools/headerpathfilter.cpp b/src/plugins/cpptools/headerpathfilter.cpp index da200d0321..2fa71b58b2 100644 --- a/src/plugins/cpptools/headerpathfilter.cpp +++ b/src/plugins/cpptools/headerpathfilter.cpp @@ -120,24 +120,19 @@ QString clangIncludeDirectory(const QString &clangVersion, const QString &clangR #endif } -HeaderPaths::iterator resourceIterator(HeaderPaths &headerPaths, bool isMacOs) +HeaderPaths::iterator resourceIterator(HeaderPaths &headerPaths) { // include/c++, include/g++, libc++\include and libc++abi\include static const QString cppIncludes = R"((.*/include/.*(g\+\+|c\+\+).*))" R"(|(.*libc\+\+/include))" - R"(|(.*libc\+\+abi/include))"; + R"(|(.*libc\+\+abi/include))" + R"(|(/usr/local/include))"; static const QRegularExpression includeRegExp("\\A(" + cppIncludes + ")\\z"); - // The same as includeRegExp but also matches /usr/local/include - static const QRegularExpression includeRegExpMac("\\A(" + cppIncludes - + R"(|(/usr/local/include))" + ")\\z"); - - const QRegularExpression &includePathRegEx = isMacOs ? includeRegExpMac : includeRegExp; - return std::stable_partition(headerPaths.begin(), headerPaths.end(), [&](const HeaderPath &headerPath) { - return includePathRegEx.match(headerPath.path).hasMatch(); + return includeRegExp.match(headerPath.path).hasMatch(); }); } @@ -165,8 +160,7 @@ void HeaderPathFilter::tweakHeaderPaths() removeClangSystemHeaderPaths(builtInHeaderPaths); removeGccInternalIncludePaths(); - auto split = resourceIterator(builtInHeaderPaths, - projectPart.toolChainTargetTriple.contains("darwin")); + auto split = resourceIterator(builtInHeaderPaths); if (!clangVersion.isEmpty()) { const QString clangIncludePath = clangIncludeDirectory(clangVersion, clangResourceDirectory); diff --git a/tests/unit/unittest/compileroptionsbuilder-test.cpp b/tests/unit/unittest/compileroptionsbuilder-test.cpp index 9d026e2500..d5692a9124 100644 --- a/tests/unit/unittest/compileroptionsbuilder-test.cpp +++ b/tests/unit/unittest/compileroptionsbuilder-test.cpp @@ -351,10 +351,10 @@ TEST_F(CompilerOptionsBuilder, ClangHeadersAndCppIncludesPathsOrderLinux) QDir::toNativeSeparators( "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8"), "-isystem", - QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""), - "-isystem", QDir::toNativeSeparators("/usr/local/include"), "-isystem", + QDir::toNativeSeparators(CLANG_RESOURCE_DIR ""), + "-isystem", QDir::toNativeSeparators("/usr/lib/gcc/x86_64-linux-gnu/4.8/include"), "-isystem", QDir::toNativeSeparators("/usr/include/x86_64-linux-gnu"), diff --git a/tests/unit/unittest/headerpathfilter-test.cpp b/tests/unit/unittest/headerpathfilter-test.cpp index dac2974ecf..b5399a65fd 100644 --- a/tests/unit/unittest/headerpathfilter-test.cpp +++ b/tests/unit/unittest/headerpathfilter-test.cpp @@ -241,8 +241,8 @@ TEST_F(HeaderPathFilter, ClangHeadersAndCppIncludesPathsOrderLinux) "c++/4.8/backward"), HasBuiltIn("/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/" "x86_64-linux-gnu/c++/4.8"), - HasBuiltIn(CLANG_RESOURCE_DIR), HasBuiltIn("/usr/local/include"), + HasBuiltIn(CLANG_RESOURCE_DIR), HasBuiltIn("/usr/lib/gcc/x86_64-linux-gnu/4.8/include"), HasBuiltIn("/usr/include/x86_64-linux-gnu"), HasBuiltIn("/usr/include"), |