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

Module Assignment

Import path

import semmle.code.cpp.exprs.Assignment

Imports

ArithmeticOperation

Provides classes for modeling arithmetic operations such as +, -, * and ++.

BitwiseOperation

Provides classes for modeling bitwise operations such as ~, <<, & and |.

Expr

Provides classes modeling C/C++ expressions.

Classes

AssignAddExpr

A non-overloaded += assignment expression on a non-pointer lvalue. a += b;

AssignAndExpr

A non-overloaded AND (&=) assignment expression. a &= b;

AssignArithmeticOperation

A non-overloaded arithmetic assignment operation on a non-pointer lvalue: +=, -=, *=, /= and %=.

AssignBitwiseOperation

A non-overloaded bitwise assignment operation: &=, |=, ^=, <<=, and >>=.

AssignDivExpr

A non-overloaded /= assignment expression. a /= b;

AssignExpr

A non-overloaded assignment operation with the operator =. a = b; Note that int a = b; is not an AssignExpr. It is a Variable, and b can be obtained using Variable.getInitializer().

AssignLShiftExpr

A non-overloaded <<= assignment expression. a <<= b;

AssignMulExpr

A non-overloaded *= assignment expression. a *= b;

AssignOperation

A non-overloaded binary assignment operation other than =.

AssignOrExpr

A non-overloaded OR (|=) assignment expression. a |= b;

AssignPointerAddExpr

A non-overloaded += pointer assignment expression. ptr += index;

AssignPointerSubExpr

A non-overloaded -= pointer assignment expression. ptr -= index;

AssignRShiftExpr

A non-overloaded >>= assignment expression. a >>= b;

AssignRemExpr

A non-overloaded %= assignment expression. a %= b;

AssignSubExpr

A non-overloaded -= assignment expression on a non-pointer lvalue. a -= b;

AssignXorExpr

A non-overloaded XOR (^=) assignment expression. a ^= b;

Assignment

A non-overloaded binary assignment operation, including =, +=, &=, etc. A C++ overloaded assignment operation looks syntactically identical but is instead a FunctionCall. This class does not include variable initializers. To get a variable initializer, use Initializer instead.

BlockAssignExpr

A compiler generated assignment operation that may occur in a compiler generated copy/move constructor or assignment operator, and which functions like memcpy where the size argument is based on the type of the rvalue of the assignment.

ConditionDeclExpr

A C++ variable declaration inside the conditional expression of a while, if or for compound statement. Declaring a variable this way narrows its lifetime and scope to be strictly the compound statement itself. For example: extern int x, y; if (bool c = x < y) { do_something_with(c); } // c is no longer in scope while (int d = x - y) { do_something_else_with(d); } // d is no longer is scope