CodeQL library for C/C++
Search

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)