CodeQL library for C/C++
Search

Module Preprocessor

Import path

import semmle.code.cpp.Preprocessor

Imports

Element

Provides the Element class, which is the base class for all classes representing C or C++ program elements.

Location

Provides classes and predicates for locations in the source code.

Classes

PreprocessorBranch

A C/C++ preprocessor branching directive: #if, #ifdef, #ifndef, or #elif.

PreprocessorBranchDirective

A C/C++ preprocessor branch related directive: #if, #ifdef, #ifndef, #elif, #else or #endif.

PreprocessorDirective

A C/C++ preprocessor directive. For example each of the following lines of code contains a PreprocessorDirective: #pragma once #ifdef MYDEFINE #include "myfile.h" #line 1 "source.c"

PreprocessorElif

A C/C++ preprocessor #elif directive. For example there is a PreprocessorElif on the third line of the following code: #ifdef MYDEFINE1 // ... #elif MYDEFINE2 // ... #else // ... #endif

PreprocessorElse

A C/C++ preprocessor #else directive. For example there is a PreprocessorElse on the fifth line of the following code: #ifdef MYDEFINE1 // ... #elif MYDEFINE2 // ... #else // ... #endif

PreprocessorEndif

A C/C++ preprocessor #endif directive. For example there is a PreprocessorEndif on the third line of the following code: #ifdef MYDEFINE // ... #endif

PreprocessorError

A C/C++ preprocessor #error directive. For example: #error "This configuration is not implemented."

PreprocessorIf

A C/C++ preprocessor #if directive. For example there is a PreprocessorIf on the first line of the following code: #if defined(MYDEFINE) // ... #endif For the related notion of a directive which causes branching (which includes #if, plus also #ifdef, #ifndef, and #elif), see PreprocessorBranch.

PreprocessorIfdef

A C/C++ preprocessor #ifdef directive. For example there is a PreprocessorIfdef on the first line of the following code: #ifdef MYDEFINE // ... #endif The syntax #ifdef X is shorthand for #if defined(X).

PreprocessorIfndef

A C/C++ preprocessor #ifndef directive. For example there is a PreprocessorIfndef on the first line of the following code: #ifndef MYDEFINE // ... #endif The syntax #ifndef X is shorthand for #if !defined(X).

PreprocessorLine

A C/C++ preprocessor #line directive. For example: #line 1 "source.c"

PreprocessorPragma

A C/C++ preprocessor #pragma directive. For example: #pragma once

PreprocessorUndef

A C/C++ preprocessor #undef directive. For example there is a PreprocessorUndef on the second line of the following code: #ifdef MYMACRO #undef MYMACRO #endif

PreprocessorWarning

A C/C++ preprocessor #warning directive. For example: #warning "This configuration is not supported."