CodeQL library for C/C++
codeql/cpp-all 1.1.2-dev (changelog, source)

Member predicate ComputedGotoStmt::getGeneratingMacro

Gets a macro invocation that generates this entire statement.

For example, given

#define SOMEFUN a()
#define FOO do { SOMEFUN; b(); } while (0)
void f(void) {

this predicate would have results of SOMEFUN and FOO for the function call a(), and just FOO for the function call b(), the block within the ‘do’ statement, and the entire ‘do’ statement.

Note that, unlike isInMacroExpansion() it is not necessary for the macro to generate the terminating semi-colon.

MacroInvocation getGeneratingMacro()