CodeQL library for C/C++

Member predicate WhileStmt::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()