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

Predicate isFromMacroDefinition

Holds if e is completely or partially from a macro definition, as opposed to being passed in as an argument.

In the following example, the call to f is from a macro definition, while y, +, 1, and ; are not. This assumes that no identifier apart from M refers to a macro.

#define M(x) f(x)
  M(y + 1);

Import path

import semmle.code.cpp.commons.Exclusions
predicate isFromMacroDefinition(Element e)