[Interest] Qt Creator, Clang Code Model, supplying specific GCC symbols

Bernhard Lindner private at bernhard-lindner.de
Sat Dec 22 11:49:16 CET 2018

Sorry for asking again... I have not found a solution yet.

I tried to define the macros using #ifdef __clang__ / #endif but it seems __clang__ is not
defined during code model parser run. Also all GCC smybols are defined so I can not
disinguish clang from GCC. 
I also tried to add a -D argument to the clang command line in the code model settings but
the "sanity checks" of Qt creator do not allow that.

Any idea anyone?

> I am using the new Clang Code Model in Qt Creator to highlight violations.
> Recently I introduced some experimental C++20 functions in my code. These functions are
> integrated using a GCC header (<experimental/source_location>) that introduces three
> intrinsics that are unknown to clang:
> __builtin_FILE()
> __builtin_FUNCTION()
> __builtin_LINE()
> As a result, the clang code analysis fails (indicated above the editor as a yellow
> warning sign).
> What is the best/designated way to supply relacement macros for those symbols so the
> clang analysis succeeds? Is there some configuration/setting in Qt Creator? Should I
> patch the code? Should I pass this to clang as command line arguments?

Best Regards, 

More information about the Interest mailing list