diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-03-06 16:38:24 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-03-09 11:31:42 +0000 |
commit | ce3103194f3f08c0482e47ce599234db04f93a14 (patch) | |
tree | 4a8299ef4dbd1462903e0733d8c380becf653fa3 /src/plugins/cpptools/compileroptionsbuilder.cpp | |
parent | 4f6ef7b698a4a4b57d912262f71119a35c3c4d71 (diff) | |
download | qt-creator-ce3103194f3f08c0482e47ce599234db04f93a14.tar.gz |
CppTools: Fix code model with clang and precompiled headers
Amends a1d22fd2f7.
Fixes: QTCREATORBUG-22897
Change-Id: Iaadf72d78e11279c8dd553860e00be9d29135752
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'src/plugins/cpptools/compileroptionsbuilder.cpp')
-rw-r--r-- | src/plugins/cpptools/compileroptionsbuilder.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp index fcce3d6cc5..e559a8400c 100644 --- a/src/plugins/cpptools/compileroptionsbuilder.cpp +++ b/src/plugins/cpptools/compileroptionsbuilder.cpp @@ -341,19 +341,17 @@ void CompilerOptionsBuilder::addHeaderPathOptions() void CompilerOptionsBuilder::addPrecompiledHeaderOptions(UsePrecompiledHeaders usePrecompiledHeaders) { for (const QString &pchFile : m_projectPart.precompiledHeaders) { - // Bail if build system precomiple header artifacts exists + // Bail if build system precompiled header artifacts exists. // Clang cannot handle foreign PCH files. - if (QFile::exists(pchFile + ".gch") || QFile::exists(pchFile + ".pch")) { + if (QFile::exists(pchFile + ".gch") || QFile::exists(pchFile + ".pch")) usePrecompiledHeaders = UsePrecompiledHeaders::No; - // In case of Clang compilers, remove the pch-inclusion arguments - remove({"-Xclang", "-include-pch", "-Xclang", pchFile + ".gch"}); - remove({"-Xclang", "-include-pch", "-Xclang", pchFile + ".pch"}); - } - if (usePrecompiledHeaders == UsePrecompiledHeaders::No) { // CMake PCH will already have force included the header file in // command line options, remove it if exists. + // In case of Clang compilers, also remove the pch-inclusion arguments. + remove({"-Xclang", "-include-pch", "-Xclang", pchFile + ".gch"}); + remove({"-Xclang", "-include-pch", "-Xclang", pchFile + ".pch"}); remove({isClStyle() ? QLatin1String(includeFileOptionCl) : QLatin1String(includeFileOptionGcc), pchFile}); } else if (QFile::exists(pchFile)) { |