CodeQL library for C/C++
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, variable, or enum constant.

ArrayExpr

A C/C++ array access expression. For example, the access to as in myFunction in the following code: ``` int as[10];

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: ``` enum MyEnum { MYENUMCONST1, MYENUMCONST2 };

FieldAccess

A C/C++ field access expression. For example the accesses to x and y in myMethod in the following code: ``` class MyClass { public: void myMethod(MyClass &other) { x = other.y; }

FunctionAccess

A C/C++ function access expression. For example the access to myFunctionTarget in myFunction in the following code: ``` int myFunctionTarget(int);

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: ``` class A { public: ~A() { // … } };

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: ``` class MyClass { public: void myMethod(MyClass a, MyClass &b) { a.x = b.y; }

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: ``` class MyClass { … };

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: ``` class MyClass { public: void myMethod(MyClass a, MyClass &b) { a.x = b.y; }

VariableAccess

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