summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/compileroptionsbuilder.cpp
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2018-10-09 14:26:47 +0200
committerMarco Bubke <marco.bubke@qt.io>2018-10-10 12:25:30 +0000
commit77b5907c572a81d8b1e9128d44fd00148f28369b (patch)
tree1a9c7eb8969bba35b45041e019f6290b11346df9 /src/plugins/cpptools/compileroptionsbuilder.cpp
parent5249d0c3767977a0013bf5ba99fd0973ebe79fec (diff)
downloadqt-creator-77b5907c572a81d8b1e9128d44fd00148f28369b.tar.gz
Don't remove __cplusplus
For the indexing we need all tool chain macros. Originally it was a fix because the C++ version of the project part and __cplusplus could be different but now they should be the same. They will be now removed in the compiler options builder. Change-Id: I7ae8721a29632473e76ecedb411a6c9001e5e199 Task-number: QTCREATORBUG-21265 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/plugins/cpptools/compileroptionsbuilder.cpp')
-rw-r--r--src/plugins/cpptools/compileroptionsbuilder.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/plugins/cpptools/compileroptionsbuilder.cpp b/src/plugins/cpptools/compileroptionsbuilder.cpp
index 9113d69747..1dbcff2e03 100644
--- a/src/plugins/cpptools/compileroptionsbuilder.cpp
+++ b/src/plugins/cpptools/compileroptionsbuilder.cpp
@@ -44,13 +44,15 @@ namespace CppTools {
CompilerOptionsBuilder::CompilerOptionsBuilder(const ProjectPart &projectPart,
UseSystemHeader useSystemHeader,
SkipBuiltIn skipBuiltInHeaderPathsAndDefines,
+ SkipLanguageDefines skipLanguageDefines,
QString clangVersion,
QString clangResourceDirectory)
: m_projectPart(projectPart)
- , m_useSystemHeader(useSystemHeader)
, m_clangVersion(clangVersion)
, m_clangResourceDirectory(clangResourceDirectory)
+ , m_useSystemHeader(useSystemHeader)
, m_skipBuiltInHeaderPathsAndDefines(skipBuiltInHeaderPathsAndDefines)
+ , m_skipLanguageDefines(skipLanguageDefines)
{
}
@@ -601,8 +603,18 @@ bool CompilerOptionsBuilder::excludeDefineDirective(const ProjectExplorer::Macro
{
// Avoid setting __cplusplus & co as this might conflict with other command line flags.
// Clang should set __cplusplus based on -std= and -fms-compatibility-version version.
- QTC_ASSERT(macro.key != "__cplusplus", return true);
- QTC_ASSERT(macro.key != "__STDC_VERSION__", return true);
+ static const auto languageDefines = {"__cplusplus",
+ "__STDC_VERSION__",
+ "_MSC_BUILD",
+ "_MSVC_LANG",
+ "_MSC_FULL_VER",
+ "_MSC_VER"};
+ if (m_skipLanguageDefines == SkipLanguageDefines::Yes
+ && std::find(languageDefines.begin(),
+ languageDefines.end(),
+ macro.key) != languageDefines.end()) {
+ return true;
+ }
// Ignore for all compiler toolchains since LLVM has it's own implementation for
// __has_include(STR) and __has_include_next(STR)