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

Module Variable

Provides classes for modeling variables and their declarations.

Import path

import semmle.code.cpp.Variable

Imports

Access

Provides classes for modeling accesses including variable accesses, enum constant accesses and function accesses.

Element

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

Initializer

Provides the Initializer class, representing C/C++ declaration initializers.

Classes

GlobalOrNamespaceVariable

A C/C++ variable which has global scope or namespace scope. For example the variables a and b in the following code:

GlobalVariable

A C/C++ variable which has global scope. For example the variable a in the following code:

LocalScopeVariable

A C/C++ variable with block scope [N4140 3.3.3]. In other words, a local variable or a function parameter. For example, the variables a, b and c in the following code: void myFunction(int a) { int b; static int c; }

LocalVariable

A C/C++ local variable. In other words, any variable that has block scope [N4140 3.3.3], but is not a parameter of a Function or CatchBlock. For example the variables b and c in the following code: void myFunction(int a) { int b; static int c; }

MemberVariable

A C structure member or C++ member variable. For example the member variables m and s in the following code: class MyClass { public: int m; static int s; };

NamespaceVariable

A C/C++ variable which has namespace scope. For example the variable b in the following code:

ParameterDeclarationEntry

A parameter as described within a particular declaration or definition of a C/C++ function. For example the declaration of a in the following code: void myFunction(int a) { int b; }

SemanticStackVariable

A non-static local variable or parameter that is not part of an uninstantiated template. Uninstantiated templates are purely syntax, and only on instantiation will they be complete with information about types, conversions, call targets, etc. For example in the following code, the variables a in myFunction and b in the instantiation myTemplateFunction<int>, but not b in the template myTemplateFunction<T>:

StackVariable

A C/C++ variable with automatic storage duration. In other words, a function parameter or a local variable that is not static or thread-local. For example, the variables a and b in the following code. void myFunction(int a) { int b; static int c; }

StaticLocalVariable

A C++ local variable declared as static.

StaticStorageDurationVariable

A variable whose contents always have static storage duration. This can be a global variable, a namespace variable, a static local variable, or a static member variable.

TemplateVariable

A C++14 variable template. For example, in the following code the variable template v defines a family of variables: template<class T> T v;

Variable

A C/C++ variable. For example, in the following code there are four variables, a, b, c and d:

VariableDeclarationEntry

A particular declaration or definition of a C/C++ variable. For example, in the following code there are six variable declaration entries - two each for a and d, and one each for b and c:

VariableTemplateInstantiation

A variable that is an instantiation of a template. For example the instantiation myTemplateVariable<int> in the following code: