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

Module Access

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

Import path

import semmle.code.cpp.exprs.Access

Imports

Enum

Provides classes representing C/C++ enums and enum constants.

Expr

Provides classes modeling C/C++ expressions.

Variable

Provides classes for modeling variables and their declarations.

Classes

Access

A C/C++ access expression. This refers to a function (excluding function references in function call expressions), variable, or enum constant.

ArrayExpr

A C/C++ array access expression. For example, the access to as in myFunction in the following code:

DotFieldAccess

A field access of the form obj.field. The type of obj is either a class/struct/union or a reference to one. DotFieldAccess has two sub-classes, ValueFieldAccess and ReferenceFieldAccess, to distinguish whether or not the type of obj is a reference type.

EnumConstantAccess

A C/C++ enum constant access expression. For example the access to MYENUMCONST1 in myFunction in the following code:

FieldAccess

A C/C++ field access expression. For example the accesses to x and y in myMethod in the following code:

FunctionAccess

A C/C++ function access expression. For example the access to myFunctionTarget in myFunction in the following code:

ImplicitThisFieldAccess

A field access of a field of this which has no qualifier because the use of this is implicit. For example, in the following code the implicit call to the destructor of A has no qualifier because the use of this is implicit:

ParamAccessForType

An access to a parameter of a function signature for the purposes of a decltype.

PointerFieldAccess

A field access whose qualifier is a pointer to a class, struct or union. These typically take the form obj->field. Another case is a field access with an implicit this-> qualifier, which is often a PointerFieldAccess (but see also ImplicitThisFieldAccess).

PointerToFieldLiteral

A C++ pointer to non-static data member literal. For example, &C::x is an expression that refers to field x of class C. If the type of that field is int, then &C::x ought to have type int C::*. It is currently modeled in QL as having type int.

ReferenceFieldAccess

A field access of the form obj.field, where the type of obj is a reference to a class/struct/union. For example the accesses to y in myMethod in the following code:

TypeName

An access to a type. This occurs in certain contexts where a built-in works on types directly rather than variables, expressions etc. For example the reference to MyClass in __is_pod in the following code:

ValueFieldAccess

A field access of the form obj.field, where the type of obj is a class/struct/union (and not a reference). For example the accesses to x in myMethod in the following code:

VariableAccess

A C/C++ variable access expression. For example the accesses to x and y in myFunction in the following code: