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

Module TranslatedExpr

Import path

import semmle.code.cpp.ir.implementation.raw.internal.TranslatedExpr

Imports

Predicates

exprNeedsCopyIfNotLoaded

Holds if the translation of expr will not directly generate any Instruction for use as result. For such instructions we can synthesize a CopyValue instruction to ensure that there is a 1-to-1 mapping between expressions and result-bearing instructions.

getEnclosingDeclaration
getEnclosingDeclaration0
getEnclosingFunction
getEnclosingVariable
getEnclosingVariable0
getTranslatedAllocationSize
getTranslatedAllocatorCall
getTranslatedDeleteOrDeleteArray
getTranslatedExpr

Gets the TranslatedExpr for the specified expression. If expr is a load or synthesized temporary object, the result is the TranslatedExpr for the load or synthetic temporary object portion.

Classes

StructorCallContext

Abstract class implemented by any TranslatedElement that has a child expression that is a call to a constructor or destructor, in order to provide a pointer to the object being constructed or destroyed.

TranslatedAllocationSize

The IR translation of the allocation size argument passed to operator new in a new expression.

TranslatedAllocatorCall

The IR translation of a call to operator new as part of a new or new[] expression.

TranslatedArithmeticLiteral
TranslatedArrayExpr

IR translation of an array access expression (e.g. a[i]). The array being accessed will either be a prvalue of pointer type (possibly due to an implicit array-to-pointer conversion), or a glvalue of a GNU vector type.

TranslatedAssignExpr
TranslatedAssignOperation
TranslatedAssumeExpr

The IR translation of an __assume expression. We currently translate these as NoOp. In the future, we will probably want to do something better. At a minimum, we can model __assume(0) as Unreached.

TranslatedBinaryConditionalExpr

The IR translation of a two-operand conditional operator (a ?: b). This is a GCC language extension. This version of the conditional expression returns its first operand (the condition) if that condition is non-zero. Since we’ll be reusing the value of the condition, we’ll compute that value directly before branching, even if that value was a short-circuit logical expression.

TranslatedBinaryOperation

IR translation of a simple binary operation.

TranslatedBlockAssignExpr
TranslatedBoolConversion

Represents the translation of a BoolConversion expression, which generates a comparison with zero.

TranslatedBuiltInOperation

The IR translation of a built-in operation (i.e. anything that extends BuiltInOperation).

TranslatedCoAwaitExpr

IR translation of co_await.

TranslatedCoYieldxpr

IR translation of co_yield.

TranslatedCommaExpr
TranslatedConditionDeclExpr

The IR translation of a ConditionDeclExpr, which represents the value of the declared variable after conversion to bool in code such as: if (int* p = &x) { }

TranslatedConditionValue
TranslatedConditionalExpr

The IR translation of the ?: operator. This class has the portions of the implementation that are shared between the standard three-operand form (a ? b : c) and the GCC-extension two-operand form (a ?: c).

TranslatedConstantAllocationSize

The IR translation of a constant allocation size.

TranslatedConstantExpr

IR translation of an expression with a compile-time constant value. This includes not only literals, but also “integral constant expressions” (e.g. 1 + 2).

TranslatedConversion
TranslatedCoreExpr

The IR translation of the “core” part of an expression. This is the part of the expression that produces the result value of the expression, before any lvalue-to-rvalue conversion on the result. Every expression has a single TranslatedCoreExpr.

TranslatedCrementOperation
TranslatedDeleteOrDeleteArrayExpr

The IR translation of a delete or delete[] expression.

TranslatedDestructorFieldDestruction

Represents the IR translation of the destruction of a field from within the destructor of the field’s declaring class.

TranslatedDestructorsAfterThrow

The IR translation of the destructor calls of the parent TranslatedThrow.

TranslatedDynamicCast

Represents the translation of a dynamic_cast expression.

TranslatedErrorExpr
TranslatedExpr

The IR translation of some part of an expression. A single Expr may consist of multiple TranslatedExpr objects. Every Expr has a single TranslatedCoreExpr, which produces the result of the expression before any implicit lvalue-to-rvalue conversion. Any expression with an lvalue-to-rvalue conversion will also have a TranslatedLoad to perform that conversion on the original result. A few expressions have additional TranslatedExpr objects that compute intermediate values, such as the TranslatedAllocatorCall and TranslatedAllocationSize within the translation of a NewExpr.

TranslatedFieldAccess
TranslatedFunctionAccess
TranslatedInheritanceConversion

Represents the translation of a BaseClassConversion or DerivedClassConversion expression.

TranslatedLambdaExpr

The IR translation of a lambda expression. This initializes a temporary variable whose type is that of the lambda, using the initializer list that represents the captures of the lambda.

TranslatedLoad

IR translation of an implicit lvalue-to-rvalue conversion on the result of an expression.

TranslatedNewArrayExpr

The IR translation of a new[] expression.

TranslatedNewExpr

The IR translation of a new expression.

TranslatedNewOrNewArrayExpr

The IR translation of a new or new[] expression.

TranslatedNonConstantAllocationSize

The IR translation of a non-constant allocation size.

TranslatedNonConstantExpr

IR translation of an expression whose value is not known at compile time.

TranslatedNonFieldVariableAccess
TranslatedPostfixCrementOperation
TranslatedPrefixCrementOperation
TranslatedReThrowExpr

IR translation of a throw expression with no argument (e.g. throw;).

TranslatedResultCopy

IR translation of an expression that simply returns its result. We generate an otherwise useless CopyValue instruction for these expressions so that there is at least one instruction associated with the expression.

TranslatedReuseExpr

IR translation of a ReuseExpr.

TranslatedSimpleConversion

Represents the translation of a conversion expression that generates a Convert instruction.

TranslatedSingleInstructionConversion

Represents the translation of a conversion expression that generates a single instruction.

TranslatedSingleInstructionExpr

IR translation of an expression that performs a single operation on its operands and returns the result.

TranslatedStmtExpr

The IR translation of StmtExpr (the GNU statement expression extension to C/C++), such as ({ doSomething(); a + b; })

TranslatedStringLiteral
TranslatedStructuredBindingVariableAccess

The IR translation of a variable access of a structured binding, where the type of the structured binding is not of a reference type, e.g., x0 and x1 in auto [x0, x1] = xs where xs is an array. Although the type of the structured binding is a non-reference type, the structured binding behaves like a reference. Hence, the translation requires a VariableAddress followed by a Load instead of only a VariableAddress as produced by TranslatedVariableAccess.

TranslatedSyntheticTemporaryObject

The IR translation of a temporary object synthesized by the IR to hold a class prvalue on which a member access is going to be performed. This differs from TranslatedTemporaryObjectExpr in that instances of TranslatedSyntheticTemporaryObject are synthesized during IR construction, whereas TranslatedTemporaryObjectExpr instances are created from TemporaryObjectExpr nodes from the AST.

TranslatedTemporaryObjectExpr

IR translation of the materialization of a temporary object.

TranslatedTernaryConditionalExpr

The IR translation of the ternary conditional operator (a ? b : c). For this version, we expand the condition as a TranslatedCondition, rather than a TranslatedExpr, to simplify the control flow in the presence of short-circuit logical operators.

TranslatedThisExpr
TranslatedThrowExpr

IR translation of a throw expression.

TranslatedThrowValueExpr

IR translation of a throw expression with an argument (e.g. throw std::bad_alloc()).

TranslatedTransparentConversion
TranslatedTransparentExpr
TranslatedTransparentUnaryOperation
TranslatedUnaryExpr
TranslatedVacuousDestructorCall

The IR translation of a vacuous destructor call. That is, an expression that looks like a destructor call, but has no effect.

TranslatedValueCategoryAdjustment

The IR translation of a node synthesized to adjust the value category of its operand. One of: - TranslatedLoad - Convert from glvalue to prvalue by loading from the location. - TranslatedSyntheticTemporaryObject - Convert from prvalue to glvalue by storing to a temporary variable.

TranslatedVarArg

The IR translation of a BuiltInVarArg expression.

TranslatedVarArgCopy

The IR translation of a BuiltInVarArgCopy expression.

TranslatedVarArgsEnd

The IR translation of a BuiltInVarArgsEnd expression.

TranslatedVarArgsStart

The IR translation of a BuiltInVarArgsStart expression.

TranslatedVariableAccess