CodeQL library for C/C++
Search

Module Macro

Import path

import semmle.code.cpp.Macro

Imports

cpp

Provides classes and predicates for working with C/C++ code.

Predicates

affectedByMacro

Holds if element is affected by a macro.

inMacroExpansion

Holds if element is in the expansion of a macro.

inSystemMacroExpansion

Holds if element is in the expansion of a macro from a system header.

macroLine

Holds if there is a macro invocation on line line of file f.

macroLocation

Holds if l is the location of a macro.

possibleMacroLocation

Holds if there might be a macro invocation at location l.

Classes

Macro

A macro. For example, the macro MYMACRO in the following code: #define MYMACRO 1

MacroAccess

A macro access. For example: #ifdef MACRO1 // this line contains a MacroAccess int x = MACRO2; // this line contains a MacroAccess #endif

MacroInvocation

A macro invocation (macro access that is expanded). For example: #ifdef MACRO1 int x = MACRO2; // this line contains a MacroInvocation #endif

MacroInvocationExpr

A top-level expression generated by a macro invocation.

MacroInvocationStmt

A top-level statement generated by a macro invocation.