Class MacroInvocation
A macro invocation (macro access that is expanded). For example:
#ifdef MACRO1
int x = MACRO2; // this line contains a MacroInvocation
#endif
See also MacroAccess
, which also represents macro accesses where the macro
is checked but not expanded (such as in the first line of the example above).
Import path
import cpp
Direct supertypes
Indirect supertypes
Known direct subtypes
Predicates
getAGeneratedElement | Gets an element that is either completely in the macro expansion, or (if it is a statement) ‘almost’ in the macro expansion (for instance up to a trailing semicolon). Useful for common patterns in which macros are almost syntactically complete elements but not quite. |
getAPrimaryQlClass | Gets the name of a primary CodeQL class to which this element belongs. |
getAnAffectedElement | Gets an element that is (partially) affected by a macro invocation. This is a superset of the set of expanded elements and includes elements that are not completely enclosed by the expansion as well. |
getAnExpandedElement | Gets an element that occurs in this macro invocation or a nested macro invocation. |
getEnclosingFunction | Gets a function that includes an expression that is affected by this macro invocation. If the macro expansion includes the end of one function and the beginning of another, this predicate will get both. |
getExpandedArgument | Gets the |
getExpr | Gets a top-level expression associated with this macro invocation, if any. Note that this predicate will fail if the top-level expanded element is not an expression (for example if it is a statement). |
getStmt | Gets the top-level statement associated with this macro invocation, if any. Note that this predicate will fail if the top-level expanded element is not a statement (for example if it is an expression). |
getUnexpandedArgument | Gets the |
Inherited predicates
findRootCause | Gets the source of this element: either itself or a macro that expanded to this element. | from Element |
fromSource | Holds if this element may be from source. This predicate holds for all elements, except for those in the dummy file, whose name is the empty string. The dummy file contains declarations that are built directly into the compiler. | from Element |
getActualLocation | Gets the location of this macro access. For a nested access, where | from MacroAccess |
getEnclosingElement | Gets the closest | from Element |
getFile | Gets the primary file where this element occurs. | from Element |
getLocation | Gets the location of the outermost macro access that triggered this macro access. This is equivalent to calling | from MacroAccess |
getMacro | Gets the macro that is being accessed. | from MacroAccess |
getMacroName | Gets the name of the accessed macro. | from MacroAccess |
getOutermostMacroAccess | Gets the outermost | from MacroAccess |
getParentInvocation | Gets the parent macro invocation, if any. For example: | from MacroAccess |
getParentScope | Gets the parent scope of this | from Element |
getPrimaryQlClasses | Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs. | from ElementBase |
isAffectedByMacro | Holds if this element is affected in any way by a macro. All elements that are totally or partially generated by a macro are included, so this is a super-set of | from Element |
isFromTemplateInstantiation | Holds if this | from Element |
isFromUninstantiatedTemplate | Holds if this | from Element |
isInMacroExpansion | Holds if this element comes from a macro expansion. Only elements that are entirely generated by a macro are included - for elements that partially come from a macro, see | from Element |
toString | Gets a textual representation of this element. | from MacroAccess |