ClangCodeModel: Make use of QT_ANNOTATE_FUNCTION()

See qtbase/6c54e10144e7af02f4c35e20e5f375a0cf280b8b.

Fixes: QTCREATORBUG-28970
Change-Id: I7500c1e25a63d2a1cda66259c5ebd84976c27335
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-04-12 16:33:59 +02:00
parent f67f02066c
commit 8fb258b85e
2 changed files with 8 additions and 0 deletions

View File

@@ -130,6 +130,7 @@ QStringList CompilerOptionsBuilder::build(ProjectFile::Kind fileKind,
undefineCppLanguageFeatureMacrosForMsvc2015(); undefineCppLanguageFeatureMacrosForMsvc2015();
addDefineFunctionMacrosMsvc(); addDefineFunctionMacrosMsvc();
addDefineFunctionMacrosQnx(); addDefineFunctionMacrosQnx();
addQtMacros();
addHeaderPathOptions(); addHeaderPathOptions();
@@ -786,6 +787,12 @@ void CompilerOptionsBuilder::addDefineFunctionMacrosQnx()
addMacros({{"_LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE"}}); 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() void CompilerOptionsBuilder::reset()
{ {
m_options.clear(); m_options.clear();

View File

@@ -62,6 +62,7 @@ public:
void undefineClangVersionMacrosForMsvc(); void undefineClangVersionMacrosForMsvc();
void addDefineFunctionMacrosQnx(); void addDefineFunctionMacrosQnx();
void addQtMacros();
// Add custom options // Add custom options
void add(const QString &arg, bool gccOnlyOption = false); void add(const QString &arg, bool gccOnlyOption = false);