CppTools: Do not ignore "built-in" compiler macros for custom toolchains

Built-in compiler macros are normally not passed to the code model,
because of potential conflicts with clang. However, in the case of custom
toolchains, these macros are provided by the user for the explicit
purpose of making them known to the code model.
Another exception are the bare metal toolchains, for which we now make
sure we won't get out of sync when new ones are added.

Fixes: QTCREATORBUG-24367
Change-Id: I2a0458d9132fdff15eb9adfcb2c06d7ef72508bc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2020-08-24 11:21:24 +02:00
parent 493000e211
commit a40d2ea705

View File

@@ -28,8 +28,6 @@
#include "cppmodelmanager.h"
#include "headerpathfilter.h"
#include <baremetal/baremetalconstants.h>
#include <coreplugin/icore.h>
#include <projectexplorer/headerpath.h>
@@ -385,8 +383,11 @@ void CompilerOptionsBuilder::addProjectMacros()
{
static const int useMacros = qEnvironmentVariableIntValue("QTC_CLANG_USE_TOOLCHAIN_MACROS");
if (m_projectPart.toolchainType == BareMetal::Constants::IAREW_TOOLCHAIN_TYPEID || useMacros)
if (m_projectPart.toolchainType == ProjectExplorer::Constants::CUSTOM_TOOLCHAIN_TYPEID
|| m_projectPart.toolchainType.name().contains("BareMetal")
|| useMacros) {
addMacros(m_projectPart.toolChainMacros);
}
addMacros(m_projectPart.projectMacros);
}