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

Module Stmt

Provides a hierarchy of classes for modeling C/C++ statements.

Import path

import semmle.code.cpp.stmts.Stmt

Imports

Element

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

Classes

AsmStmt

A C/C++ ‘asm’ statement.

BreakStmt

A C/C++ ‘break’ statement.

CatchAnyBlock

A C++ ‘catch-any block’, for example the third block in the following code: try { f(); } catch(std::exception &e) { g(); } catch(...) { h(); }

CatchBlock

A ‘catch block’, for example the second and third blocks in the following code: try { f(); } catch(std::exception &e) { g(); } catch(...) { h(); }

CoReturnStmt

A C/C++ co_return statement.

ComputedGotoStmt

A ‘goto’ statement whose target is computed by a non-constant expression (a non-standard extension to C/C++).

ConditionalStmt

A C/C++ conditional statement, that is, either an ‘if’ statement or a ‘switch’ statement.

ConstexprIfStmt

A C/C++ ‘constexpr if’ statement. For example, the if constexpr statement in the following code: if constexpr (x) { ... }

ContinueStmt

A C/C++ ‘continue’ statement.

ControlStructure

A C/C++ control structure, that is, either a conditional statement or a loop.

DeclStmt

A C/C++ ‘declaration’ statement.

DefaultCase

A C/C++ ‘default case’ statement.

DoStmt

A C/C++ ‘do’ statement.

EmptyStmt

A C/C++ ‘empty’ statement.

EnumSwitch

A C/C++ ‘switch’ statement where the controlling expression has an enum type.

ExprStmt

A C/C++ ‘expression’ statement.

ForStmt

A C/C++ ‘for’ statement.

FunctionTryStmt

A C++ ‘function try’ statement.

GotoStmt

A C/C++ ‘goto’ statement which jumps to a label.

Handler

A handler for a ‘try’ statement.

IfStmt

A C/C++ ‘if’ statement. For example, the if statement in the following code: if (x == 1) { ... }

JumpStmt

A C/C++ jump statement.

LabelStmt

A C/C++ ‘label’ statement.

Loop

A C/C++ loop, that is, either a ‘while’ loop, a ‘for’ loop, or a ‘do’ loop.

MicrosoftTryExceptStmt

A structured exception handling ‘try except’ statement, for example the __try statement in the following code: __try { f(); } __except(myExceptionFilter()) { g() } This is a Microsoft C/C++ extension.

MicrosoftTryFinallyStmt

A structured exception handling ‘try finally’ statement, for example the __try statement in the following code: __try { f(); } __finally { g() } This is a Microsoft C/C++ extension.

MicrosoftTryStmt

A structured exception handling ‘try’ statement, that is, a __try __except or __try __finally statement. This is a Microsoft C/C++ extension.

RangeBasedForStmt

A C++11 range-based ‘for’ statement.

ReturnStmt

A C/C++ ‘return’ statement.

Stmt

A C/C++ statement.

StmtParent

An element that is the parent of a statement in the C/C++ AST.

SwitchCase

A C/C++ ‘switch case’ statement.

SwitchStmt

A C/C++ ‘switch’ statement.

TryStmt

A C/C++ ‘try’ statement.

VlaDeclStmt

A C99 statement which declares a variable length array. For example the variable length array declaration in the following code: int myArray[x];

VlaDimensionStmt

A C99 statement which computes the size of a single dimension of a variable length array. For example the variable length array dimension (x) in the following code: int myArray[x];

WhileStmt

A C/C++ ‘while’ statement.