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

Module PreprocBlock

This library offers a view of preprocessor branches (#if, #ifdef, #ifndef, #elif, #elifdef, #elifndef, and #else) as blocks of code between the opening and closing directives, with navigable parent-child relationships to other blocks. The main class is PreprocessorBlock.

Import path

import semmle.code.cpp.headers.PreprocBlock

Imports

cpp

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

Classes

PreprocessorBlock

A chunk of code from one preprocessor branch (#if, #ifdef, #ifndef, #elif, #elifdef, #elifndef, or #else) to the directive that closes it (#elif, #elifdef, #elifndef, #else, or #endif). The getParent() method allows these blocks to be navigated as a tree, with the root being the entire file.