A C/C++ cast expression.
To get the type which the expression is being cast to, use
There are two groups of subtypes of
Cast. The first group differentiates
between the different cast syntax forms, e.g.
etc. The second group differentiates between the semantic operation being
performed by the cast, e.g.
The two groups are largely orthogonal to one another. For example, a
cast that is syntactically as
CStyleCast may also be an
PointerBaseClassConversion, or some other semantic conversion. Similarly,
PointerDerivedClassConversion may also be a
CStyleCast or a
This is a root QL class representing the different casts. For specific examples, consult the documentation for any of QL classes mentioned above.
Known direct subtypes
Gets a string describing the semantic conversion operation being performed by this cast.
Gets the source of this element: either itself or a macro that expanded to this element.
Holds if this element may be from source. This predicate holds for all elements, except for those in the dummy file, whose name is the empty string. The dummy file contains declarations that are built directly into the compiler.
Gets a child of this expression.
Gets a node such that the control-flow edge
Gets a direct predecessor of this control-flow node, if any.
Gets the name of a primary CodeQL class to which this element belongs.
Gets a direct successor of this control-flow node, if any.
Gets a node such that the control-flow edge
Gets the type of this expression, after any implicit conversions and explicit casts, and after resolving typedefs.
Gets the nth child of this expression.
Gets the function containing this control-flow node.
Gets the conversion associated with this expression, if any.
Gets a string describing the conversion associated with this expression, or "" if there is none.
Gets the nearest enclosing set of curly braces around this expression in the source, if any.
Gets the enclosing variable or function of this expression.
Gets the closest
Gets the enclosing function of this expression, if any.
Gets the smallest statement containing this control-flow node.
Gets the enclosing variable of this expression, if any.
Gets this expression with all of its explicit casts, but none of its implicit casts. More precisely this takes conversions up to the last explicit cast (there may be implicit conversions along the way), but does not include conversions after the last explicit cast.
Gets the expression being converted.
Gets the primary file where this element occurs.
Gets the fully converted form of this expression, including all type casts and other conversions.
Gets this expression with all of its initial implicit casts, but none of its explicit casts. More precisely, this takes all implicit conversions up to (but not including) the first explicit cast (if any).
Gets the location of this expression.
Gets the number of direct children of this expression.
Gets the parent of this expression, if any.
Gets the parent scope of this
Gets the parent of this expression, if any, in an alternative syntax tree that has
Gets the precedence of the main operator of this expression; higher precedence binds tighter.
Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.
Gets the type of this expression.
Gets the unique non-
Gets the type of this expression after typedefs have been resolved.
Gets the type of this expression after specifiers have been deeply stripped and typedefs have been resolved.
Gets the value of this expression, if it is a constant.
Gets a string representation of the value category of the expression. This is intended only for debugging. The possible values are:
Gets the source text for the value of this expression, if it is a constant.
Holds if e is the nth child of this expression.
Holds if this expression has a conversion.
Holds if this expression has an explicit conversion.
Holds if this expression has an implicit conversion.
Holds if this expression has undergone an lvalue-to-rvalue conversion to extract its value. for example:
Holds if this element is affected in any way by a macro. All elements that are totally or partially generated by a macro are included, so this is a super-set of
Holds if this is an auxiliary expression generated by the compiler.
Holds if this node is the top-level expression of a conditional statement, meaning that
Holds if this expression has a value that can be determined at compile time.
Holds if this
Holds if this
Holds if this expression is a glvalue. A glvalue is either an lvalue or an xvalue.
Holds if this conversion is an implicit conversion.
Holds if this element comes from a macro expansion. Only elements that are entirely generated by a macro are included - for elements that partially come from a macro, see
Holds if this expression is an lvalue, in the sense of having an address.
Holds if this expression is an lvalue. An lvalue is an expression that represents a location, rather than a value. See [basic.lval] for more about lvalues.
Holds if this expression is a prvalue. A prvalue is an expression that represents a value, rather than a location. See [basic.lval] for more about prvalues.
Holds if this expression is parenthesised.
Holds if this expression is side-effect free (conservative approximation). This predicate cannot be overridden; override mayBeImpure() instead.
Holds if this expression is an rvalue. An rvalue is either a prvalue or an xvalue.
Holds if this expression will not be evaluated because of its context, such as an expression inside a sizeof.
Holds if this expression is an xvalue. An xvalue is a location whose lifetime is about to end (e.g. an rvalue reference returned from a function call). See [basic.lval] for more about xvalues.
Holds if it is possible that the expression may be impure. If we are not sure, then it holds. Unlike
Holds if it is possible that the expression may be impure. If we are not sure, then it holds.
Gets a textual representation of this expression.