diff --git a/src/plugins/cppeditor/compileroptionsbuilder.cpp b/src/plugins/cppeditor/compileroptionsbuilder.cpp index d2c5e16325f..5f092121214 100644 --- a/src/plugins/cppeditor/compileroptionsbuilder.cpp +++ b/src/plugins/cppeditor/compileroptionsbuilder.cpp @@ -130,6 +130,7 @@ QStringList CompilerOptionsBuilder::build(ProjectFile::Kind fileKind, undefineCppLanguageFeatureMacrosForMsvc2015(); addDefineFunctionMacrosMsvc(); addDefineFunctionMacrosQnx(); + addQtMacros(); addHeaderPathOptions(); @@ -786,6 +787,12 @@ void CompilerOptionsBuilder::addDefineFunctionMacrosQnx() addMacros({{"_LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE"}}); } +void CompilerOptionsBuilder::addQtMacros() +{ + if (m_projectPart.qtVersion != QtMajorVersion::None) + addMacros({{"QT_ANNOTATE_FUNCTION(x)", "__attribute__((annotate(#x)))"}}); +} + void CompilerOptionsBuilder::reset() { m_options.clear(); diff --git a/src/plugins/cppeditor/compileroptionsbuilder.h b/src/plugins/cppeditor/compileroptionsbuilder.h index 0e8c1a5fad0..d47a7e87e3d 100644 --- a/src/plugins/cppeditor/compileroptionsbuilder.h +++ b/src/plugins/cppeditor/compileroptionsbuilder.h @@ -62,6 +62,7 @@ public: void undefineClangVersionMacrosForMsvc(); void addDefineFunctionMacrosQnx(); + void addQtMacros(); // Add custom options void add(const QString &arg, bool gccOnlyOption = false);