Module cpp

Provides classes and predicates for working with C/C++ code.

Where the documentation refers to the standards, it gives references to the freely-available drafts.

For C++11, these references are of the form [N3337 5.3.2/1], and the corresponding draft of the standard can be downloaded from https://github.com/cplusplus/draft/raw/master/papers/n3337.pdf

For C++14, these references are of the form [N4140 5.3.2/1], and the corresponding draft of the standard can be downloaded from https://github.com/cplusplus/draft/raw/master/papers/n4140.pdf

Import path

import cpp

Predicates

affectedByMacro

Holds if element is affected by a macro.

allocationCall

A call to a library routine that allocates memory.

allocationFunction

A library routine that allocates memory.

bbDominates

Holds if dominator is a dominator of node in the control-flow graph of basic blocks. This is reflexive.

bbIDominates

Holds if dominator is an immediate dominator of node in the control-flow graph of basic blocks.

bbIPostDominates

Holds if postDominator is an immediate post-dominator of node in the control-flow graph of basic blocks.

bbPostDominates

Holds if postDominator is a post-dominator of node in the control-flow graph of basic blocks. This is reflexive.

bbStrictlyDominates

Holds if dominator is a strict dominator of node in the control-flow graph of basic blocks. Being strict means that dominator != node.

bbStrictlyPostDominates

Holds if postDominator is a strict post-dominator of node in the control-flow graph of basic blocks. Being strict means that postDominator != node.

callByReference

Holds if call passes v by reference, either with an explicit address-of operator or implicitly as a C++ reference. Both const and non-const references are included.

callDereferences

Holds if the call fc will dereference argument i.

callMayReturnNull

Holds if call may, directly or indirectly, evaluate to a null literal.

canValueFlow

Holds if a value can flow directly from one expr to another.

checkedNull

Holds if var is likely to be null at node.

checkedValid

Holds if var is likely to be non-null at node.

conditionAlwaysFalse

Holds if condition always evaluates to zero.

conditionAlwaysTrue

Holds if condition always evaluates to a nonzero value.

cyclomaticComplexityBranches

Gets the number of branching statements and expressions in a block. This is for computing cyclomatic complexity.

definitelyNull

Holds if a simple data-flow analysis determines that e is definitely null.

definition

Holds if def is a (potential) assignment to stack variable v. That is, the variable may hold another value in the control-flow node(s) following def than before.

definitionBarrier

Holds if barrier is either a (potential) definition of v or follows an access that gets the address of v. In both cases, the value of v after barrier cannot be assumed to be the same as before.

definitionByReference

Holds if va is a variable passed by reference as argument def, where the callee potentially assigns the corresponding parameter. The definitions-and-uses library models assignment by reference as if it happens on evaluation of the argument, def.

definitionReaches

Holds if the definition def of some stack variable can reach node, which is a definition or use, without crossing definitions of the same variable.

definitionUsePair

Computed relation: A “definition-use-pair” for a particular variable. Intuitively, this means that def is an assignment to var, and use is a read of var at which the value assigned by def may be read. (There can be more than one definition reaching a single use, and a single definition can reach many uses.)

deref

Holds if evaluation of op dereferences v.

dereferenced

Holds if e will be dereferenced after being evaluated.

dereferencedByOperation

Holds if evaluation of op dereferences e.

dominates

Holds if dominator is a dominator of node in the control-flow graph. This is reflexive.

exprDefinition

Holds if def is a (definite) assignment to the stack variable v. e is the assigned expression.

falsecond_base
freeCall

A call to a library routine that frees memory.

freeFunction

A library routine that frees memory.

functionDereferences

Holds if the body of a function f is likely to dereference its ith parameter unconditionally. This analysis does not account for reassignment.

functionEntry

Holds if entry is the entry point of a function.

functionExit

Holds if exit is the exit node of a function.

getAFormatterWideType

A type that is used as a format string by any formatting function.

getOptions
getter

Holds if f is a getter member function for v, in class c. See StructLikeClass.getAGetter.

iDominates

Holds if dominator is an immediate dominator of node in the control-flow graph.

iPostDominates

Holds if postDominator is an immediate post-dominator of node in the control-flow graph.

inMacroExpansion

Holds if element is in the expansion of a macro.

inSystemMacroExpansion

Holds if element is in the expansion of a macro from a system header.

isAllocationExpr

Is e some kind of allocation (new, alloc, realloc etc)?

isDeallocationExpr

Is e some kind of deallocation (delete, free, realloc etc)?

isFixedSizeAllocationExpr

Is e some kind of allocation (new, alloc, realloc etc) with a fixed size?

isLinkerAwareExtracted

Holds if this database was created with the linker awareness feature switched on.

isMemoryManagementExpr

Is e some kind of allocation or deallocation (new, alloc, realloc, delete, free etc)?

isStdLibAllocationExpr

Is e an allocation from stdlib.h (malloc, realloc etc)?

lockCall
loopConditionAlwaysTrueUponEntry

The condition condition for the loop loop is provably true upon entry. That is, at least one iteration of the loop is guaranteed.

macroLine

Holds if there is a macro invocation on line line of file f.

macroLocation

Holds if l is the location of a macro.

mayReturnNull

Holds if f may, directly or indirectly, return a null literal.

maybeNull

Holds if a simple data-flow analysis determines that e may be null.

mkElement

Get the Element that represents this @element. Normally this will simply be a cast of e, but sometimes it is not. For example, for an incomplete struct e the result may be a complete struct with the same name.

mustlockCall
nullCheckExpr

Holds if var is null when checkExpr evaluates to a true value.

nullInit

Holds if the evaluation of n may have the effect of, directly or indirectly, assigning a null literal to var.

nullValue

Holds if val is a null literal or a call to a function that may return a null literal.

parameterUsePair

Holds if va is a use of the parameter p that could observe the passed-in value.

possibleMacroLocation

Holds if there might be a macro invocation at location l.

postDominates

Holds if postDominator is a post-dominator of node in the control-flow graph. This is reflexive.

primitiveVariadicFormatter

A standard function such as vprintf that has a format parameter and a variable argument list of type va_arg.

qlCast

A node representing the Cast sub-class of entity cast.

qlConversion

A node representing the Conversion sub-class of entity cast.

reachable

Holds if the control-flow node n is reachable, meaning that either it is an entry point, or there exists a path in the control-flow graph of its function that connects an entry point to it. Compile-time constant conditions are taken into account, so that the call to f is not reachable in if (0) f(); even if the if statement as a whole is reachable.

setter

Holds if f is a setter member function for v, in class c. See StructLikeClass.getASetter.

strictlyDominates

Holds if dominator is a strict dominator of node in the control-flow graph. Being strict means that dominator != node.

strictlyPostDominates

Holds if postDominator is a strict post-dominator of node in the control-flow graph. Being strict means that postDominator != node.

successors_extended

Holds if there is a control-flow edge from source to target in either the extractor-generated control-flow graph or in a subclass of AdditionalControlFlowEdge. Use this relation instead of successors.

truecond_base
trylockCall
underlyingElement

INTERNAL: Do not use.

unlockCall
unreachable

Correct relation for reachability of ControlFlowNodes.

unresolveElement

INTERNAL: Do not use.

useOfVar

Holds if use is a non-definition use of stack variable v. This will not include accesses on the LHS of an assignment (which don’t retrieve the variable value), but will include accesses in increment/decrement operations.

useOfVarActual

Same as useOfVar(v, use), but with the extra condition that the access use actually reads the value of the stack variable v at run-time. (Non-examples include &x and function calls where the callee does not use the relevant parameter.)

useUsePair

A use/use pair is a pair of uses of a particular variable var where the same value might be read (meaning that there is a control-flow path from first to second without crossing a definition of var).

validCheckExpr

Holds if var is non-null when checkExpr evaluates to a true value.

var_definition

Extended version of definition that also includes parameters but excludes static variables.

variadicFormatter

Holds if f is a function such as vprintf that has a format parameter (at formatParamIndex) and a variable argument list of type va_arg.

Classes

AbstractClass

An “abstract class”, in other words a class/struct that contains at least one pure virtual function.

Access

A C/C++ access expression. This refers to a function, variable, or enum constant.

AccessHolder

A declaration that can potentially have more C++ access rights than its enclosing element. This comprises Class (they have access to their own private members) along with other UserTypes and Function (they can be the target of friend declarations). For example MyClass and myFunction in the following code: ``` class MyClass { public: … };

AccessSpecifier

A C++ access specifier: public, protected, or private.

AddExpr

A C/C++ add expression. c = a + b;

AdditionalControlFlowEdge

An abstract class that can be extended to add additional edges to the control-flow graph. Instances of this class correspond to the source nodes of such edges, and the predicate getAnEdgeTarget should be overridden to produce the target nodes of each source.

AddressOfExpr

A C/C++ address-of expression. int *ptr = &var;

AggregateLiteral

A C/C++ aggregate literal.

AlignAs

A C++11 alignas construct.

AlignofExprOperator

A C++11 alignof expression whose operand is an expression. int addrMask = ~(alignof(expr) - 1);

AlignofOperator

A C++11 alignof expression.

AlignofTypeOperator

A C++11 alignof expression whose operand is a type name. bool proper_alignment = (alingof(T) == alignof(T[0]);

AnalysedExpr

An expression that has been extended with member predicates that provide information about the role of this expression in nullness checks.

AnalysedString

An analysed null terminated string.

ArithmeticConversion

A conversion from one arithmetic or enum type to another.

ArithmeticType

The C/C++ arithmetic types. See 4.1.1.

ArrayAggregateLiteral

A C/C++ aggregate literal that initializes an array S s[4] = { s_1, s_2, s_3, s_n };

ArrayExpr

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

ArrayLiteral

DEPRECATED: Objective-C is no longer supported. An Objective C @[…] literal.

ArrayOrVectorAggregateLiteral

A C/C++ aggregate literal that initializes an array or a GNU vector type.

ArrayToPointerConversion

A C/C++ array to pointer conversion.

ArrayType

A C/C++ array type. See 4.9.1. char table[32];

AsmStmt

A C/C++ ‘asm’ statement.

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;

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.

AssumeExpr

A Microsoft C/C++ __assume expression.

AtEncodeExpr

DEPRECATED: Objective-C is no longer supported. An Objective C @encode expression, for example @encode(int *).

AtExpr

DEPRECATED: Objective-C is no longer supported. An Objective C @ expression which boxes a single value, such as @(22).

AtProtocolExpr

DEPRECATED: Objective-C is no longer supported. An Objective C @protocol expression, for example @protocol(SomeProtocol).

AtSelectorExpr

DEPRECATED: Objective-C is no longer supported. An Objective C @selector expression, for example @selector(driveForDistance:).

Attribute

An attribute introduced by GNU’s __attribute__((name)) syntax, Microsoft’s __declspec(name) syntax, Microsoft’s [name] syntax, the C++11 standard [[name]] syntax, or the C++11 alignas syntax.

AttributeArgument

An argument to an Attribute.

AttributeFormattingFunction

A function that can be identified as a printf style formatting function by its use of the GNU format attribute.

AutoReleasePoolStmt

DEPRECATED: Objective-C is no longer supported. An Objective C @autoreleasepool statement, for example @autoreleasepool { int x; int y; }.

AutoType

A type representing the use of the C++11 auto keyword. auto val = some_typed_expr();

BaseClassConversion

A conversion from a pointer or glvalue of a derived class to a pointer or glvalue of a direct or virtual base class.

BasicBlock

A basic block in the C/C++ control-flow graph.

BinaryArithmeticOperation

A C/C++ binary arithmetic operation.

BinaryBitwiseOperation

A C/C++ binary bitwise operation.

BinaryLogicalOperation

A C/C++ binary logical operation.

BinaryOperation

A C/C++ binary operation.

BitField

A C structure member or C++ member variable declared with an explicit size in bits. For example the member variable x in the following code: struct MyStruct { int x : 3; };

BitwiseAndExpr

A C/C++ bitwise AND expression. unsigned c = a & b;

BitwiseOrExpr

A C/C++ bitwise OR expression. unsigned c = a | b;

BitwiseXorExpr

A C/C++ bitwise XOR expression. unsigned c = a ^ b;

Block

A C/C++ block statement.

BlockExpr

A code block expression, for example: ^ int (int x, int y) {return x + y;} Blocks are a language extension supported by Clang, and by Apple’s branch of GCC.

BlockType

A block type, for example, int(^)(char, float).

BoolConversion

A conversion to bool. Returns false if the source value is zero, false, or nullptr. Returns true otherwise.

BoolType

The C/C++ boolean type. See 4.2. This is the C _Bool type or the C++ bool type. For example: extern bool a, b; // C++ _Bool c, d; // C

BreakStmt

A C/C++ ‘break’ statement.

BuiltInChooseExpr

The __builtin_choose_expr expression. This is a GNU/Clang extension.

BuiltInComplexOperation

The GNU __builtin_complex operation.

BuiltInFunction

A GCC built-in function. For example: __builtin___memcpy_chk.

BuiltInIntAddr

A C/C++ __INTADDR__ built-in operation (used by some implementations of offsetof). The operation retains its semantics even in the presence of an overloaded operator &). This is an EDG extension. struct S { int a, b; }; int d = __INTADDR__(struct S, b); // usually 4

BuiltInNoOp

A Microsoft C/C++ __noop expression, which does nothing. __noop;

BuiltInOperation

A C/C++ builtin operation. This is the root QL class encompassing built-in functionality.

BuiltInOperationBuiltInAddressOf

A clang __builtin_addressof function (can be used to implement C++’s std::addressof).

BuiltInOperationBuiltInConvertVector

A clang __builtin_convertvector expression.

BuiltInOperationBuiltInOffsetOf

A C/C++ __builtin_offsetof built-in operation (used by some implementations of offsetof). The operation retains its semantics even in the presence of an overloaded operator &). This is a GNU/Clang extension. struct S { int a, b; }; int d = __builtin_offsetof(struct S, b); // usually 4

BuiltInOperationBuiltInShuffleVector

A clang __builtin_shufflevector expression.

BuiltInOperationBuiltInTypesCompatibleP

A C++ __builtin_types_compatible_p built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasAssign

A C++ __has_assign built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasCopy

A C++ __has_copy built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasFinalizer

The __has_finalizer built-in operation. This is a Microsoft extension.

BuiltInOperationHasNoThrowAssign

A C++ __has_nothrow_assign built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasNoThrowConstructor

A C++ __has_nothrow_constructor built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasNoThrowCopy

A C++ __has_nothrow_copy built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasNothrowMoveAssign

The __has_nothrow_move_assign built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasTrivialAssign

A C++ __has_trivial_assign built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasTrivialConstructor

A C++ __has_trivial_constructor built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasTrivialCopy

A C++ __has_trivial_copy built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasTrivialDestructor

A C++ __has_trivial_destructor built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasTrivialMoveAssign

The __has_trivial_move_assign built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasTrivialMoveConstructor

The __has_trivial_move_constructor built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasUserDestructor

A C++ __has_user_destructor built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationHasVirtualDestructor

A C++ __has_virtual_destructor built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsAbstract

A C++ __is_abstract built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsBaseOf

A C++ __is_base_of built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsClass

A C++ __is_class built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsConstructible

The __is_constructible built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsConvertibleTo

A C++ __is_convertible_to built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsDelegate

The __is_delegate built-in operation. This is a Microsoft extension.

BuiltInOperationIsDestructible

The __is_destructible built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsEmpty

A C++ __is_empty built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsEnum

A C++ __is_enum built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsFinal

The __is_final built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsInterfaceClass

The __is_interface_class built-in operation. This is a Microsoft extension.

BuiltInOperationIsLiteralType

The __is_literal_type built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsNothrowAssignable

The __is_nothrow_assignable built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsNothrowConstructible

The __is_nothrow_constructible built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsNothrowDestructible

The __is_nothrow_destructible built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsPod

A C++ __is_pod built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsPolymorphic

A C++ __is_polymorphic built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsRefArray

The __is_ref_array built-in operation. This is a Microsoft extension.

BuiltInOperationIsRefClass

The __is_ref_class built-in operation. This is a Microsoft extension.

BuiltInOperationIsSealed

The __is_sealed built-in operation. This is a Microsoft extension.

BuiltInOperationIsSimpleValueClass

The __is_simple_value_class built-in operation. This is a Microsoft extension.

BuiltInOperationIsStandardLayout

The __is_standard_layout built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsTriviallyAssignable

The __is_trivially_assignable built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsTriviallyConstructible

The __is_trivially_constructible built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsTriviallyCopyable

The __is_trivially_copyable built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsTriviallyDestructible

The __is_trivially_destructible built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsUnion

A C++ __is_union built-in operation (used by some implementations of the <type_traits> header).

BuiltInOperationIsValueClass

The __is_value_class built-in operation. This is a Microsoft extension.

BuiltInType

A C/C++ built-in primitive type (int, float, void, and so on). See 4.1.1. In the following example, unsigned int and double denote primitive built-in types: double a; unsigned int ua[40]; typedef double LargeFloat;

BuiltInVarArg

A C/C++ __builtin_va_arg built-in operation (used by some implementations of va_arg). ap = __builtin_va_arg(ap, long);

BuiltInVarArgCopy

A C/C++ __builtin_va_copy built-in operation (used by some implementations of va_copy). va_list ap, aq; __builtin_va_start(ap, last_named_param); va_copy(aq, ap);

BuiltInVarArgsEnd

A C/C++ __builtin_va_end built-in operation (used by some implementations of va_end). __builtin_va_start(ap, last_named_param); ap = __builtin_va_arg(ap, long); __builtin_va_end(ap);

BuiltInVarArgsList

The __builtin_va_list type, used to provide variadic functionality.

BuiltInVarArgsStart

A C/C++ __builtin_va_start built-in operation (used by some implementations of va_start). __builtin_va_list ap; __builtin_va_start(ap, last_named_param);

CFile

A C source file, as determined by file extension.

CStyleCast

A cast expression in C, or a C-style cast expression in C++. float f = 3.0f; int i = (int)f;

CStyleComment

A C style comment (one which starts with /*).

CTypedefType

A traditional C/C++ typedef type. See 4.9.1. For example the type declared in the following code: typedef int my_int;

Call

A C/C++ call.

Cast

A C/C++ cast expression.

CatchAnyBlock

A C++ ‘catch-any block’, for example the third block in the following code: try { f(); } catch(std::exception &e) { g(); } catch(...) { h(); }

CatchBlock

A ‘catch block’, for example the second and third blocks in the following code: try { f(); } catch(std::exception &e) { g(); } catch(...) { h(); }

Category

DEPRECATED: Objective-C is no longer supported. An Objective C category or class extension.

Char16Type

The C/C++ char16_t type. This is available starting with C11 and C++11. char16_t c16;

Char32Type

The C/C++ char32_t type. This is available starting with C11 and C++11. char32_t c32;

CharLiteral

A character literal. For example: char c1 = 'a'; wchar_t c2 = L'b';

CharPointerType

The C/C++ char* type.

CharType

The C/C++ character types. See 4.3. This includes the char, signed char and unsigned char types, all of which are distinct from one another. For example: char a, b; signed char c, d; unsigned char e, f;

Class

A class type [N4140 9].

ClassAggregateLiteral

A C/C++ aggregate literal that initializes a class, struct, or union. For example: S s = { arg1, arg2, { arg3, arg4 }, arg5 };

ClassDerivation

A class derivation, for example the public B in the following code: class D : public B { ... };

ClassExtension

DEPRECATED: Objective-C is no longer supported. An Objective C class extension.

ClassMessageExpr

DEPRECATED: Objective-C is no longer supported. An Objective C message expression whose receiver is the name of a class, and is therefore calling a class method rather than an instance method. This occurs most commonly for the “+alloc”, “+new”, and “+class” selectors.

ClassTemplateInstantiation

A class that is an instantiation of a template. For example in the following code there is a MyTemplateClass<int> instantiation: ``` template class MyTemplateClass { … };

ClassTemplateSpecialization

A specialization of a class template (this may be a full or partial template specialization - see FullClassTemplateSpecialization and PartialClassTemplateSpecialization).

Closure

A class written by the compiler to be the type of a C++11 lambda expression. For example the variable a in the following code has a closure type: auto a = [x, y](int z) -> int { return x + y + z; };

CmdExpr

DEPRECATED: Objective-C is no longer supported. An Objective C _cmd expression.

CommaExpr

A C/C++ comma expression. int c = compute1(), compute2(), resulting_value;

Comment

A C/C++ comment. For example the comment in the following code: // C++ style single-line comment or a C style comment (which starts with /*).

ComparisonOperation

A C/C++ comparison operation, that is, either an equality operation or a relational operation.

Compilation

An invocation of the compiler. Note that more than one file may be compiled per invocation. For example, this command compiles three source files:

CompilerCatastrophe

A compiler error that prevents compilation from continuing.

CompilerDiscretionaryError

A compiler-generated discretionary error (a compile-time error that may be suppressed).

CompilerError

A compiler error message.

CompilerRemark

A compiler-generated remark (milder than a warning).

CompilerWarning

A compiler-generated warning.

ComplementExpr

A C/C++ complement expression. unsigned c = ~a;

ComputedGotoStmt

A ‘goto’ statement whose target is computed by a non-constant expression (a non-standard extension to C/C++).

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

ConditionalExpr

A C/C++ conditional ternary expression. a = (b > c ? d : e);

ConditionalStmt

A C/C++ conditional statement, that is, either an ‘if’ statement or a ‘switch’ statement.

ConjugationExpr

A C/C++ GNU conjugation expression. It operates on _Complex or __complex__numbers, and is similar to the C99 conj, conjf and conjl functions. _Complex double a = ( 1.0, 2.0 ); _Complex double b = ~ a; // ( 1.0, - 2.0 )

ConstCast

A C++ const_cast expression.

ConstMemberFunction

A const C++ member function [N4140 9.3.1/4]. A const function has the const specifier and does not modify the state of its class. For example the member function day in the following code: ``` class MyClass { …

ConstexprIfStmt

A C/C++ ‘constexpr if’ statement. For example, the if constexpr statement in the following code: if constexpr (x) { ... }

Constructor

A C++ constructor [N4140 12.1]. For example the function MyClass in the following code is a constructor: class MyClass { public: MyClass() { ... } };

ConstructorBaseInit

A call to a constructor of a base class as part of a constructor’s initializer list or compiler-generated actions.

ConstructorCall

A call to a constructor. struct S { S(void) {} }; S s;

ConstructorDelegationInit

A call to a constructor of the same class as part of a constructor’s initializer list, which delegates object construction (C++11 only). struct S { int a; S(int b): a(b) { } S(): S(0) { } // delegation to another constructor };

ConstructorDirectInit

A call to a constructor of a direct non-virtual base class as part of a constructor’s initializer list or compiler-generated actions. struct S { int a; S(int b): a(b) {} }; struct T: S { T(): S(33) {} // S(33) is a constructor call };

ConstructorFieldInit

An initialization of a member variable performed as part of a constructor’s explicit initializer list or implicit actions. In the example below, member variable b is being initialized by constructor parameter a: struct S { int b; S(int a): b(a) {} } s(2);

ConstructorInit

An initialization of a base class or member variable performed as part of a constructor’s explicit initializer list or implicit actions.

ConstructorVirtualInit

A call to a constructor of a virtual base class as part of a constructor’s initializer list or compiler-generated actions.

Container

A file or folder.

ContinueStmt

A C/C++ ‘continue’ statement.

ControlFlowNode

A control-flow node is either a statement or an expression; in addition, functions are control-flow nodes representing the exit point of the function. The graph represents one possible evaluation order out of all the ones the compiler might have picked.

ControlFlowNodeBase

An element that is convertible to ControlFlowNode. This class is similar to ControlFlowNode except that is has no member predicates apart from toString.

ControlStructure

A C/C++ control structure, that is, either a conditional statement or a loop.

Conversion

A C/C++ cast expression or similar unary expression that doesn’t affect the logical value of its operand.

ConversionConstructor

A C++ constructor that also defines an implicit conversion. For example the function MyClass in the following code is a ConversionConstructor: class MyClass { public: MyClass(const MyOtherClass &from) { ... } };

ConversionOperator

A C++ conversion operator [N4140 12.3.2]. For example the function operator int in the following code is a ConversionOperator: class MyClass { public: operator int(); };

CopyAssignmentOperator

A C++ copy assignment operator [N4140 12.8]. For example the function operator= in the following code is a CopyAssignmentOperator: class MyClass { public: MyClass &operator=(const MyClass &other); };

CopyConstructor

A C++ copy constructor [N4140 12.8]. For example the function MyClass in the following code is a CopyConstructor: class MyClass { public: MyClass(const MyClass &from) { ... } };

CppFile

A C++ source file, as determined by file extension.

CppStyleComment

A CPP style comment. For example the comment in the following code: // C++ style single-line comment

CrementOperation

A C/C++ ++ or -- expression (either prefix or postfix).

DataflowAnnotation

INTERNAL: Do not use. A string that identifies a data flow analysis along with a set of member predicates that implement this analysis.

Decimal128Type

The GNU C _Decimal128 primitive type. This is not standard C/C++. _Decimal128 d128;

Decimal32Type

The GNU C _Decimal32 primitive type. This is not standard C/C++. _Decimal32 d32;

Decimal64Type

The GNU C _Decimal64 primitive type. This is not standard C/C++. _Decimal64 d64;

DeclStmt

A C/C++ ‘declaration’ statement.

Declaration

A C/C++ declaration: for example, a variable declaration, a type declaration, or a function declaration.

DeclarationEntry

A C/C++ declaration entry. For example the following code contains five declaration entries: extern int myGlobal; int myVariable; typedef char MyChar; void myFunction(); void myFunction() { // ... } See the comment above Declaration for an explanation of the relationship between Declaration and DeclarationEntry.

Declspec

An attribute introduced by Microsoft’s __declspec(name) syntax, for example: __declspec(dllimport).

Decltype

An instance of the C++11 decltype operator. For example: int a; decltype(a) b;

DecrementOperation

A C/C++ -- expression (either prefix or postfix).

Def
DefOrUse

Utility class: A definition or use of a stack variable.

DefaultCase

A C/C++ ‘default case’ statement.

DefaultMutexType

A class or struct type that has both a lock and an unlock function candidate, and is therefore a mutex.

DeleteArrayExpr

A C++ delete[] (array) expression. delete[] arr;

DeleteExpr

A C++ delete (non-array) expression. delete ptr;

DerivedClassConversion

A conversion from a pointer or glvalue to a base class to a pointer or glvalue to a direct derived class.

DerivedType

A C/C++ derived type.

Destructor

A C++ destructor [N4140 12.4]. For example the function ~MyClass in the following code is a destructor: class MyClass { public: ~MyClass() { ... } };

DestructorBaseDestruction

A call to a destructor of a base class as part of a destructor’s compiler-generated actions.

DestructorCall

A call to a destructor. struct S { ~S(void) {} } *s; s->~S();

DestructorDestruction

A call to a destructor of a base class or field as part of a destructor’s compiler-generated actions.

DestructorDirectDestruction

A call to a destructor of a direct non-virtual base class as part of a destructor’s compiler-generated actions. struct S { ~S(void) {} }; struct T: S { ~T(void) {} // will call ~S() };

DestructorFieldDestruction

A destruction of a member variable performed as part of a destructor’s compiler-generated actions. struct S { ~S(void) {} }; struct T { S s; ~T(void) {} // will call s.~S() };

DestructorVirtualDestruction

A call to a destructor of a direct virtual base class as part of a destructor’s compiler-generated actions.

Diagnostic

A compiler-generated error, warning or remark.

DictionaryLiteral

DEPRECATED: Objective-C is no longer supported. An Objective C @{…} literal.

DivExpr

A C/C++ divide expression. c = a / b;

DoStmt

A C/C++ ‘do’ statement.

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.

DoubleType

The C/C++ double type. double d;

DynamicCast

A C++ dynamic_cast expression.

EQExpr

A C/C++ equal expression. bool c = (a == b);

Element

A C/C++ element. This class is the base class for all C/C++ elements, such as functions, classes, expressions, and so on.

ElementBase

A C/C++ element with no member predicates other than toString. Not for general use. This class does not define a location, so classes wanting to change their location without affecting other classes can extend ElementBase instead of Element to create a new rootdef for getURL, getLocation, or hasLocationInfo.

EmptyStmt

A C/C++ ‘empty’ statement.

EntryBasicBlock

An entry point of a function.

Enum

A C/C++ enum [N4140 7.2]. For example, the types MyEnum and MyScopedEnum in: ``` enum MyEnum { MyEnumConstant };

EnumConstant

A C/C++ enumerator [N4140 7.2], also known as an enumeration constant.

EnumConstantAccess

A C/C++ enum constant access expression. For example the access to MYENUMCONST1 in myFunction in the following code: ``` enum MyEnum { MYENUMCONST1, MYENUMCONST2 };

EnumSwitch

A C/C++ ‘switch’ statement where the controlling expression has an enum type.

EqualityOperation

A C/C++ equality operation, that is, either “==” or “!=”.

ErroneousType

An erroneous type. This type has no corresponding C/C++ syntax.

ErrorExpr

A C/C++ expression that has not been resolved.

ExitBasicBlock

A basic block whose last node is the exit point of a function.

Expr

A C/C++ expression.

ExprCall

A C/C++ call which is performed through a function pointer.

ExprInVoidContext

An expression that occurs in a void context, i.e. either as the toplevel expression of an expression statement or on the left hand side of the comma operator.

ExprMessageExpr

DEPRECATED: Objective-C is no longer supported. An Objective C message expression whose receiver is an expression (which includes the common case of the receiver being “self”).

ExprStmt

A C/C++ ‘expression’ statement.

Field

A C structure member or C++ non-static member variable. For example the member variable m in the following code (but not s): class MyClass { public: int m; static int s; };

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; }

File

A file that was observed on disk during the build process.

FinallyBlock

DEPRECATED: Objective-C is no longer supported. An Objective C @finally block.

FinallyEnd

DEPRECATED: Objective-C is no longer supported. The end of a ‘finally’ clause.

Float128Type

The GNU C __float128 primitive type. This is not standard C/C++. __float128 f128;

FloatType

The C/C++ float type. float f;

FloatingPointConversion

A conversion from one floating point type.

FloatingPointToIntegralConversion

A conversion from a floating point type to an integral or enum type.

FloatingPointType

The C/C++ floating point types. See 4.5. This includes float, double and long double types. float f; double d; long double ld;

FoldExpr

A C++17 fold expression. This will only appear in an uninstantiated template; any instantiations of the template will instead contain the sequence of expressions given by expanding the fold. template < typename... T > auto sum ( T... t ) { return ( t + ... + 0 ); }

Folder

A folder that was observed on disk during the build process.

ForInStmt

DEPRECATED: Objective-C is no longer supported. An Objective C for-in statement.

ForStmt

A C/C++ ‘for’ statement.

FormatAttribute

A GNU format attribute of the form __attribute__((format(archetype, format-index, first-arg))) that declares a function to accept a printf style format string.

FormatLiteral

A class to represent format strings that occur as arguments to invocations of formatting functions.

FormattingFunction

A standard library function that uses a printf-like formatting string.

FormattingFunctionCall

A call to one of the formatting functions.

Fprintf

The standard functions fprintf, fwprintf and their glib variants.

FriendDecl

A C++ friend declaration [N4140 11.3]. For example the two friend declarations in class A of the following code: ``` class A { friend void f(int); friend class X; };

FullClassTemplateSpecialization

A full specialization of a class template. For example MyTemplateClass<int> in the following code is a FullClassTemplateSpecialization: ``` template class MyTemplateClass { … };

Function

A C/C++ function [N4140 8.3.5]. Both member functions and non-member functions are included. For example the function MyFunction in: void MyFunction() { DoSomething(); }

FunctionAccess

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

FunctionCall

A C/C++ function call where the name of the target function is known at compile-time.

FunctionDeclarationEntry

A particular declaration or definition of a C/C++ function. For example the declaration and definition of MyFunction in the following code are each a FunctionDeclarationEntry: ``` void MyFunction();

FunctionPointerIshType

A C/C++ pointer to a function, a C++ function reference, or a clang/Apple block.

FunctionPointerMemberVariable

A C/C++ function pointer member variable.

FunctionPointerType

A C/C++ pointer to a function. See 7.7. int(* pointer)(const void *element1, const void *element2);

FunctionPointerVariable

A C/C++ function pointer variable.

FunctionReferenceType

A C++ reference to a function. int(& reference)(const void *element1, const void *element2);

FunctionSpecifier

A C/C++ function specifier: inline, virtual, or explicit.

FunctionTemplateInstantiation

A function that is an instantiation of a template. For example the instantiation myTemplateFunction<int> in the following code: ``` template void myTemplateFunction(T t) { … }

FunctionTemplateSpecialization

An explicit specialization of a C++ function template. For example the function myTemplateFunction<int> in the following code: ``` template void myTemplateFunction(T t) { … }

FunctionTryStmt

A C++ ‘function try’ statement.

GEExpr

A C/C++ greater than or equal expression. bool c = (a >= b);

GNUVectorType

A GNU/Clang vector type.

GTExpr

A C/C++ greater than expression. bool c = (a > b);

GlobalNamespace

The C/C++ global namespace.

GlobalOrNamespaceVariable

A C/C++ variable which has global scope or namespace scope. For example the variables a and b in the following code: ``` int a;

GlobalVariable

A C/C++ variable which has global scope. For example the variable a in the following code: ``` int a;

GlvalueConversion

A conversion of a glvalue from one type to another. The conversion does not modify the address of the glvalue. For glvalue conversions involving base and derived classes, see BaseClassConversion and DerivedClassConversion.

GnuAttribute

An attribute introduced by GNU’s __attribute__((name)) syntax, for example: __attribute__((__noreturn__)).

GotoStmt

A C/C++ ‘goto’ statement which jumps to a label.

Handler

A handler for a ‘try’ statement.

HeaderFile

A C/C++ header file, as determined (mainly) by file extension.

HexLiteral

A hexadecimal literal. unsigned int32_t minus2 = 0xfffffffe;

IfStmt

A C/C++ ‘if’ statement. For example, the if statement in the following code: if (x == 1) { ... }

ImaginaryDivExpr

A C/C++ divide expression with an imaginary number. This is specific to C99 and later. double z; _Imaginary double y; z = z / y;

ImaginaryMulExpr

A C/C++ multiply expression with an imaginary number. This is specific to C99 and later. double z; _Imaginary double x, y; z = x * y;

ImaginaryPartExpr

A C/C++ GNU imaginary part expression. It operates on _Complex or __complex__ numbers. _Complex double f = { 2.0, 3.0 }; double d = __imag(f); // 3.0

ImaginaryRealAddExpr

A C/C++ add expression with an imaginary term and a real term. This is specific to C99 and later. double z; _Imaginary double x; _Complex double w; w = x + z;

ImaginaryRealSubExpr

A C/C++ subtract expression with an imaginary term and a real term. This is specific to C99 and later. double z; _Imaginary double x; _Complex double w; w = x - z;

ImplicitConversionFunction

A function that defines an implicit conversion.

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() { // … } };

Import

A #import preprocessor directive (used heavily in Objective C, and supported by GCC as an extension in C). For example the following code contains one Import directive: #import <header3.h>

Include

A C/C++ #include, #include_next, or #import preprocessor directive. The following example contains four different Include directives: #include "header.h" #include <string> #include_next <header2.h> #import <header3.h>

IncludeNext

A #include_next preprocessor directive (a non-standard extension to C/C++). For example the following code contains one IncludeNext directive: #include_next <header2.h>

IncrementOperation

A C/C++ ++ expression (either prefix or postfix).

InheritanceConversion

A conversion between two pointers or _glvalue_s related by inheritance.

Initializer

A C/C++ declaration initializer. For example the initializers 1, 2 and 3 in the following code: ``` int myVariable = 1;

Int128Type

The GNU C __int128 primitive types. They are not part of standard C/C++.

IntPointerType

The C/C++ int* type.

IntType

The C/C++ integer types. See 4.4. This includes int, signed int and unsigned int. unsigned int ui;

IntegralConversion

A conversion from one integral or enum type to another.

IntegralOrEnumType

A C/C++ integral or enum type.

IntegralToFloatingPointConversion

A conversion from an integral or enum type to a floating point type.

IntegralToPointerConversion

A conversion from an integral or enum type to a pointer type.

IntegralType

The C/C++ integral types. See 4.1.1. These are types that are represented as integers of varying sizes. Both enum types and floating-point types are excluded.

Interface

An “interface” is a class that only contains pure virtual functions (and contains at least one such function). For example: class MyInterfaceClass { public: virtual void myMethod1() = 0; virtual void myMethod2() = 0; };

Intmax_t

The C/C++ intmax_t type.

JumpStmt

A C/C++ jump statement.

LEExpr

A C/C++ less than or equal expression. bool c = (a <= b);

LShiftExpr

A C/C++ left shift expression. unsigned c = a << b;

LTExpr

A C/C++ less than expression. bool c = (a < b);

LValueReferenceType

A C++11 lvalue reference type (e.g. int &). int a; int& b = a;

LabelLiteral

A label literal, that is, a use of the ‘&&’ operator to take the address of a label for use in a computed goto statement. This is a non-standard C/C++ extension.

LabelStmt

A C/C++ ‘label’ statement.

LambdaCapture

Information about a value captured as part of a lambda expression. For example in the following code, information about x and y is captured: auto a = [x, y](int z) -> int { return x + y + z; };

LambdaExpression

A C++11 lambda expression, for example the expression initializing a in the following code: auto a = [x, y](int z) -> int { return x + y + z; };

LinkTarget

A linker call during the build process, typically resulting in an executable or a shared library.

Literal

A C/C++ literal.

LocalClass

A class, struct or union that is directly enclosed by a function. For example the struct in the following code is a LocalClass: void myFunction() { struct { int x; int y; } vec = { 1, 2 }; };

LocalEnum

A C/C++ enum that is directly enclosed by a function. For example, the type MyLocalEnum in: void myFunction() { enum MyLocalEnum { MyLocalEnumConstant }; }

LocalScopeVariable

A C/C++ variable with block scope [N4140 3.3.3]. In other words, a local variable or a function parameter. For example, the variables a, b and c in the following code: void myFunction(int a) { int b; static int c; }

LocalStruct

A C/C++ struct that is directly enclosed by a function. For example, the type MyLocalStruct in: void myFunction() { struct MyLocalStruct { int x, y, z; }; }

LocalTypedefType

A C++ typedef type that is directly enclosed by a function. For example the type declared inside the function foo in the following code: int foo(void) { typedef int local; }

LocalUnion

A C/C++ union that is directly enclosed by a function. For example, the type MyLocalUnion in: void myFunction() { union MyLocalUnion { int i; float f; }; }

LocalVariable

A C/C++ local variable. In other words, any variable that has block scope [N4140 3.3.3], but is not a parameter of a Function or CatchBlock. For example the variables b and c in the following code: void myFunction(int a) { int b; static int c; }

Locatable

A C/C++ element that has a location in a file

Location

A location of a C/C++ artifact.

LocationDefault

A location of an element. Not used for expressions or statements, which instead use LocationExpr and LocationStmt respectively.

LocationExpr

A location of an expression.

LocationStmt

A location of a statement.

LogicalAndExpr

A C/C++ logical AND expression. if (a && b) { }

LogicalOrExpr

A C/C++ logical OR expression. if (a || b) { }

LongDoubleType

The C/C++ long double type. long double ld;

LongLongType

The C/C++ long long types. See 4.4. This includes long long, signed long long and unsigned long long. signed long long sll;

LongType

The C/C++ long types. See 4.4. This includes long, signed long and unsigned long. long l;

Loop

A C/C++ loop, that is, either a ‘while’ loop, a ‘for’ loop, or a ‘do’ loop.

LoopControlVariable

A C/C++ variable which is used within the initialization, condition, or update expression of a ‘for’ loop.

LoopCounter

A C/C++ variable which is used within the condition of a ‘for’ loop, and mutated within the update expression of the same ‘for’ loop.

Macro

A macro. For example, the macro MYMACRO in the following code: #define MYMACRO 1

MacroAccess

A macro access. For example: #ifdef MACRO1 // this line contains a MacroAccess int x = MACRO2; // this line contains a MacroAccess #endif

MacroInvocation

A macro invocation (macro access that is expanded). For example: #ifdef MACRO1 int x = MACRO2; // this line contains a MacroInvocation #endif

MacroInvocationExpr

A top-level expression generated by a macro invocation.

MacroInvocationStmt

A top-level statement generated by a macro invocation.

MaxExpr

A C/C++ GNU max expression. c = a >? b;

MemberFunction

A C++ function declared as a member of a class [N4140 9.3]. This includes static member functions. For example the functions MyStaticMemberFunction and MyMemberFunction in: ``` class MyClass { public: void MyMemberFunction() { DoSomething(); }

MemberVariable

A C structure member or C++ member variable. For example the member variables m and s in the following code: class MyClass { public: int m; static int s; };

MessageExpr

DEPRECATED: Objective-C is no longer supported. An Objective C message expression, for example [myColor changeColorToRed:5.0 green:2.0 blue:6.0].

MetricClass

A wrapper that provides metrics for a C++ class.

MetricFile

A wrapper that provides metrics for a C/C++ file.

MetricFunction

A wrapper that provides metrics for a C/C++ function.

MetricNamespace

A wrapper that provides metrics for a C/C++ namespace.

MicrosoftAttribute

An attribute introduced by Microsoft’s “[name]” syntax, for example “[SA_Pre(Deref=1,Access=SA_Read)]”.

MicrosoftInt16Type

The type that the Microsoft C/C++ __int16 type specifier is a synonym for. Note that since __int16 is not a distinct type, MicrosoftInt16Type corresponds to an existing IntegralType as well.

MicrosoftInt32Type

The type that the Microsoft C/C++ __int32 type specifier is a synonym for. Note that since __int32 is not a distinct type, MicrosoftInt32Type corresponds to an existing IntegralType as well.

MicrosoftInt64Type

The type that the Microsoft C/C++ __int64 type specifier is a synonym for. Note that since __int64 is not a distinct type, MicrosoftInt64Type corresponds to an existing IntegralType as well.

MicrosoftInt8Type

The type that the Microsoft C/C++ __int8 type specifier is a synonym for. Note that since __int8 is not a distinct type, MicrosoftInt8Type corresponds to an existing IntegralType as well.

MicrosoftTryExceptStmt

A structured exception handling ‘try except’ statement, for example the __try statement in the following code: __try { f(); } __except(myExceptionFilter()) { g() } This is a Microsoft C/C++ extension.

MicrosoftTryFinallyStmt

A structured exception handling ‘try finally’ statement, for example the __try statement in the following code: __try { f(); } __finally { g() } This is a Microsoft C/C++ extension.

MicrosoftTryStmt

A structured exception handling ‘try’ statement, that is, a __try __except or __try __finally statement. This is a Microsoft C/C++ extension.

MinExpr

A C/C++ GNU min expression. c = a <? b;

MoveAssignmentOperator

A C++ move assignment operator [N4140 12.8]. For example the function operator= in the following code is a MoveAssignmentOperator: class MyClass { public: MyClass &operator=(MyClass &&other); };

MoveConstructor

A C++ move constructor [N4140 12.8]. For example the function MyClass in the following code is a MoveConstructor: class MyClass { public: MyClass(MyClass &&from) { ... } };

MulExpr

A C/C++ multiply expression. c = a * b;

MutexType

A type that acts as a mutex. This class is extended below and and may be extended in Options.qll.

NEExpr

A C/C++ not equal expression. bool c = (a != b);

NULL

A use of the NULL macro.

NULLMacro

A macro defining NULL.

NameQualifiableElement

A C++ element that can be qualified with a name. This is in practice either an expression or a name qualifier. For example, there are two name-qualifiable elements in the following code, the expression f() (which is qualified by N::), and the qualifier N:: (which is not itself qualified in this example): ``` namespace N { int f() { … } }

NameQualifier

A C++ name qualifier, for example N:: in the following code: ``` namespace N { int f() { … } }

NameQualifyingElement

A C++ element that can qualify a name. For example, the namespaces A and A::B and the class A::C in the following code: ``` namespace A { namespace B { … }

Namespace

A C++ namespace.

NamespaceDeclarationEntry

A declaration of (part of) a C++ namespace.

NamespaceVariable

A C/C++ variable which has namespace scope. For example the variable b in the following code: ``` int a;

NestedClass

A class, struct or union that is declared within another class. For example the struct PairT in the following code is a nested class: template<class T> class MyTemplateClass { public: struct PairT { T first, second; }; };

NestedEnum

A C/C++ enum that is declared within a class/struct. For example, the type MyNestedEnum in: class MyClass { public: enum MyNestedEnum { MyNestedEnumConstant }; };

NestedStruct

A C/C++ nested struct. See 11.12. For example, the type MyNestedStruct in: class MyClass { public: struct MyNestedStruct { int x, y, z; }; };

NestedTypedefType

A C++ typedef type that is directly enclosed by a class, struct or union. For example the type declared inside the class C in the following code: class C { typedef int nested; };

NestedUnion

A C/C++ nested union. For example, the type MyNestedUnion in: class MyClass { public: union MyNestedUnion { int i; float f; }; };

NewArrayExpr

A C++ new[] (array) expression. Foo *foo = new Foo[]{1, 3, 5}; Bar *bar = new Bar[5];

NewExpr

A C++ new (non-array) expression. Foo *ptr = new Foo(3);

NewOrNewArrayExpr

A C++ new or new[] expression.

NoArgConstructor

A C++ constructor that takes no arguments (‘default’ constructor). This is the constructor that is invoked when no initializer is given. For example the function MyClass in the following code is a NoArgConstructor: class MyClass { public: MyClass() { ... } };

NoExceptExpr

A C++11 noexcept expression, returning true if its subexpression is guaranteed not to throw exceptions. For example: if (noexcept(func_1() + func_2())) { }

NotExpr

A C/C++ logical not expression. c = !a;

NullPointerType

The (primitive) type of the C++11 nullptr constant. It is a distinct type, denoted by decltype(nullptr), that is not itself a pointer type or a pointer to member type. The <cstddef> header usually defines the std::nullptr_t type as follows: typedef decltype(nullptr) nullptr_t;

NullValue

A C/C++ literal whose value is considered null.

NullnessAnnotation

INTERNAL: Do not use. Two analyses relating to nullness: "pointer-null" and "pointer-valid". These analyses mark expressions that are possibly null or possibly non-null, respectively.

ObjCFile

DEPRECATED: Objective-C is no longer supported. An Objective C source file, as determined by file extension.

ObjCLiteralString

DEPRECATED: Objective-C is no longer supported. An Objective C @“…” string literal.

ObjCppFile

DEPRECATED: Objective-C is no longer supported. An Objective C++ source file, as determined by file extension.

ObjcReThrowExpr

DEPRECATED: Objective-C is no longer supported. An Objective C throw expression with no argument (which causes the current exception to be re-thrown).

ObjcThrowExpr

DEPRECATED: Objective-C is no longer supported. An Objective C throw expression.

ObjcTryStmt

DEPRECATED: Objective-C is no longer supported. An Objective C try statement.

ObjectiveClass

DEPRECATED: Objective-C is no longer supported. An Objective C class.

OctalLiteral

An octal literal. For example: char esc = 033; Octal literals must always start with the digit 0.

Operation

A C/C++ operation.

Operator

A C++ user-defined operator [N4140 13.5].

Options

Default predicates that specify information about the behavior of the program being analyzed.

OverloadedArrayExpr

An instance of a user-defined binary operator[] applied to its arguments. struct T2 { T1 operator[](const T3 &); }; T1 a; T2 b; T3 c; a = b[c];

OverloadedPointerDereferenceExpr

An instance of a user-defined unary operator* applied to its argument. ``` T1 operator*(const T2 &); T1 a; T2 b; a = *b;

ParamAccessForType

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

Parameter

A C/C++ function parameter or catch block parameter. For example the function parameter p and the catch block parameter e in the following code: void myFunction(int p) { try { ... } catch (const std::exception &e) { ... } }

ParameterDeclarationEntry

A parameter as described within a particular declaration or definition of a C/C++ function. For example the declaration of a in the following code: void myFunction(int a) { int b; }

ParameterDef
ParameterIndex

An int that is a parameter index for some function. This is needed for binding in certain cases.

ParenthesisExpr

A C/C++ parenthesis expression.

ParenthesizedBracedInitializerList

A C++11 parenthesized braced initializer list within a template.

PartialClassTemplateSpecialization

A partial specialization of a class template. For example MyTemplateClass<int, T> in the following code is a PartialClassTemplateSpecialization: ``` template<class S, class T> class MyTemplateClass { … };

PlainCharType

The C/C++ char type (which is distinct from signed char and unsigned char). For example: char a, b;

PointerAddExpr

A C/C++ pointer add expression. foo *ptr = &f[0]; ptr = ptr + 2;

PointerArithmeticOperation

A C/C++ pointer arithmetic operation.

PointerConversion

A conversion from one pointer type to another.

PointerDereferenceExpr

An instance of the built-in unary operator * applied to a type.

PointerDiffExpr

A C/C++ pointer difference expression. foo *start = &f[0], *end = &f[4]; int size = end - size;

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).

PointerSubExpr

A C/C++ pointer subtract expression. foo *ptr = &f[3]; ptr = ptr - 2;

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.

PointerToIntegralConversion

A conversion from a pointer type to an integral or enum type.

PointerToMemberBaseClassConversion

A conversion from a pointer-to-member of a derived class to a pointer-to-member of an immediate base class.

PointerToMemberConversion

A conversion from one pointer-to-member type to another.

PointerToMemberDerivedClassConversion

A conversion from a pointer-to-member of a base class to a pointer-to-member of an immediate derived class.

PointerToMemberType

A C++ pointer to data member. See 15.5. class C { int m; }; int C::* p = &C::m; // pointer to data member m of class C class C *; int val = c.*p; // access data member

PointerType

A C/C++ pointer type. See 4.9.1. void *ptr; void **ptr2 = &ptr;

PolymorphicClass

A C++ class or structure which (possibly by inheritance) has at least one virtual method.

PostfixCrementOperation

A C/C++ ++ or -- postfix expression.

PostfixDecrExpr

A C/C++ postfix decrement expression, as in x--.

PostfixIncrExpr

A C/C++ postfix increment expression, as in x++.

PrefixCrementOperation

A C/C++ ++ or -- prefix expression.

PrefixDecrExpr

A C/C++ prefix decrement expression, as in --x.

PrefixIncrExpr

A C/C++ prefix increment expression, as in ++x.

PreprocessorBranch

A C/C++ preprocessor branching directive: #if, #ifdef, #ifndef, or #elif.

PreprocessorBranchDirective

A C/C++ preprocessor branch related directive: #if, #ifdef, #ifndef, #elif, #else or #endif.

PreprocessorDirective

A C/C++ preprocessor directive.

PreprocessorElif

A C/C++ preprocessor #elif directive.

PreprocessorElse

A C/C++ preprocessor #else directive.

PreprocessorEndif

A C/C++ preprocessor #endif directive.

PreprocessorError

A C/C++ preprocessor #error directive.

PreprocessorIf

A C/C++ preprocessor #if directive.

PreprocessorIfdef

A C/C++ preprocessor #ifdef directive.

PreprocessorIfndef

A C/C++ preprocessor #ifndef directive.

PreprocessorLine

A C/C++ preprocessor #line directive.

PreprocessorPragma

A C/C++ preprocessor #pragma directive.

PreprocessorUndef

A C/C++ preprocessor #undef directive.

PreprocessorWarning

A C/C++ preprocessor #warning directive.

Printf

The standard functions printf, wprintf and their glib variants.

PrintfFormatAttribute
Property

DEPRECATED: Objective-C is no longer supported. An Objective C @property.

PropertyAccess

DEPRECATED: Objective-C is no longer supported. An access to an Objective C property using dot syntax.

Protocol

DEPRECATED: Objective-C is no longer supported. An Objective C protocol.

ProxyClass

The proxy class (where needed) associated with a template parameter, as in the following code: template <typename T> struct S : T { // the type of this T is a proxy class ... };

PrvalueAdjustmentConversion

The adjustment of the type of a class prvalue. Most commonly seen in code similar to: class String { ... }; String func(); void caller() { const String& r = func(); } In the above example, the result of the call to func is a prvalue of type String, which will be adjusted to type const String before being bound to the reference.

Ptrdiff_t

The C/C++ ptrdiff_t type.

PureVirtualFunction

A C++ pure virtual function [N4140 10.4]. For example the first function called myVirtualFunction in the following code: ``` class A { public: virtual void myVirtualFunction() = 0; };

Qualifier

An expression that is used to qualify some other expression.

RShiftExpr

A C/C++ right shift expression. unsigned c = a >> b;

RValueReferenceType

A C++11 rvalue reference type (e.g., int &&). It is used to implement “move” semantics for object construction and assignment. class C { E e; C(C&& from): e(std::move(from.e)) { } };

RangeBasedForStmt

A C++11 range-based ‘for’ statement.

RangeSSA
RangeSsaDefinition

A definition of one or more SSA variables, including phi node definitions. An SSA variable is effectively the pair of a definition and the (non-SSA) variable that it defines. Note definitions and uses can be coincident, due to the presence of parameter definitions and phi nodes.

ReThrowExpr

A C++ throw expression with no argument (which causes the current exception to be re-thrown). throw;

RealImaginaryAddExpr

A C/C++ add expression with a real term and an imaginary term. This is specific to C99 and later. double z; _Imaginary double x; _Complex double w; w = z + x;

RealImaginarySubExpr

A C/C++ subtract expression with a real term and an imaginary term. This is specific to C99 and later. double z; _Imaginary double x; _Complex double w; w = z - x;

RealPartExpr

A C/C++ GNU real part expression. It operates on _Complex or __complex__ numbers. _Complex double f = { 2.0, 3.0 }; double d = __real(f); // 2.0

ReferenceDereferenceExpr

An implicit conversion from type T & to type T.

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; }

ReferenceToExpr

An implicit conversion from type T to type T &.

ReferenceType

A C++ reference type. See 4.9.1.

ReinterpretCast

A C++ reinterpret_cast expression.

RelationalOperation

A C/C++ relational operation, that is, one of <=, <, >, or >=.

RemExpr

A C/C++ remainder expression. c = a % b;

ReturnStmt

A C/C++ ‘return’ statement.

RoutineType

A C/C++ routine type. Conceptually, this is what results from stripping away the pointer from a function pointer type. It can also occur in C++ code, for example the base type of myRoutineType in the following code: ``` using myRoutineType = int(int);

SSAHelper

Common SSA logic for standard SSA and range-analysis SSA.

ScopedEnum

A C++ scoped enum, that is, an enum whose constants must be qualified with the name of the enum. For example, the type Color in: enum class Color { red, blue }

SemanticStackVariable

A non-static local variable or parameter that is not part of an uninstantiated template. Uninstantiated templates are purely syntax, and only on instantiation will they be complete with information about types, conversions, call targets, etc. For example in the following code, the variables a in myFunction and b in the instantiation myTemplateFunction<int>, but not b in the template myTemplateFunction<T>: ``` void myFunction() { T a; }

ShortType

The C/C++ short types. See 4.3. This includes short, signed short and unsigned short. signed short ss;

SignedCharType

The C/C++ signed char type (which is distinct from plain char even when char is signed by default). signed char c, d;

Size_t

The C/C++ size_t type.

SizeofExprOperator

A C/C++ sizeof expression whose operand is an expression. if (sizeof(a) == sizeof(b)) { c = (b)a; }

SizeofOperator

A C/C++ sizeof expression.

SizeofPackOperator

A C++11 sizeof... expression which determines the size of a template parameter pack.

SizeofTypeOperator

A C/C++ sizeof expression whose operand is a type name. int szlong = sizeof(int) == sizeof(long)? 4 : 8;

Snprintf

The standard functions snprintf and swprintf, and their Microsoft and glib variants.

SpecialNameQualifyingElement

A special name-qualifying element. For example: __super.

SpecifiedType

A type with specifiers. const int a; volatile char v;

Specifier

A C/C++ specifier: friend, auto, register, static, extern, mutable, inline, virtual, or explicit.

Sprintf

The standard function sprintf and its Microsoft and glib variants.

SsaDefinition

A definition of one or more SSA variables, including phi node definitions. An SSA variable, as defined in the literature, is effectively the pair of an SsaDefinition d and a LocalScopeVariable v, written (d, v) in this documentation. Note that definitions and uses can be coincident due to the presence of parameter definitions and phi nodes.

Ssize_t

The C/C++ ssize_t type.

StackVariable

DEPRECATED: use LocalScopeVariable instead.

StandardSSA
StaticAssert

A C++11 static_assert or C11 _Static_assert construct.

StaticCast

A C++ static_cast expression.

StdAttribute

An attribute introduced by the C++11 standard [[name]] syntax, for example: [[clang::fallthrough]].

StdNamespace

The C++ std:: namespace.

Stmt

A C/C++ statement.

StmtExpr

A compound statement enclosed in parentheses used as an expression (a GNU extension to C/C++). In the example below, b is the return value from the compound statement. int a = ({ int b = c + d; b; });

StmtParent

An element that is the parent of a statement in the C/C++ AST.

StorageClassSpecifier

A C/C++ storage class specifier: auto, register, static, extern, or `mutable".

StringCchPrintf

The Microsoft StringCchPrintf function and variants.

StringLiteral

A string literal. For example: const char *s1 = "abcdef"; const wchar_t *s2 = L"123456";

StrlenCall

A call to a strlen like function.

Struct

A C/C++ structure or union. For example, the types MyStruct and MyUnion in: ``` struct MyStruct { int x, y, z; };

StructLikeClass

A class that is either a struct or just has getters and setters for its members. In either case it just stores data and has no real encapsulation.

SubExpr

A C/C++ subtract expression. c = a - b;

SubscriptExpr

DEPRECATED: Objective-C is no longer supported. An Objective C/C++ overloaded subscripting access expression.

SuperMessageExpr

DEPRECATED: Objective-C is no longer supported. An Objective C message expression whose receiver is super, for example [super init].

SwitchCase

A C/C++ ‘switch case’ statement.

SwitchStmt

A C/C++ ‘switch’ statement.

SynchronizedStmt

DEPRECATED: Objective-C is no longer supported. An Objective C @synchronized statement, for example @synchronized (x) { [x complicationOperation]; }.

Syslog

The standard function syslog.

TemplateClass

A class template (this class also finds partial specializations of class templates). For example in the following code there is a MyTemplateClass<T> template: template<class T> class MyTemplateClass { ... }; Note that this does not include template instantiations, and full specializations. See ClassTemplateInstantiation and FullClassTemplateSpecialization.

TemplateFunction

A C++ function which has a non-empty template argument list. For example the function myTemplateFunction in the following code: template<class T> void myTemplateFunction(T t) { ... }

TemplateParameter

A C++ typename (or class) template parameter.

TemplateTemplateParameter

A C++ template template parameter.

TemplateVariable

A C++14 variable template. For example, in the following code the variable template v defines a family of variables: template<class T> T v;

TextLiteral

A character literal or a string literal.

ThisExpr

A C++ this expression.

ThrowExpr

A C++ throw expression. throw Exc(2);

TopLevelFunction

A C/C++ non-member function (a function that is not a member of any class). For example the in the following code, MyFunction is a TopLevelFunction but MyMemberFunction is not: ``` void MyFunction() { DoSomething(); }

TryStmt

A C/C++ ‘try’ statement.

Type

A C/C++ type.

TypeConformingToProtocol

DEPRECATED: Objective-C is no longer supported. A type which conforms to a protocol. Use getAProtocol to get a protocol that this type conforms to.

TypeDeclarationEntry

A particular definition or forward declaration of a C/C++ user-defined type. class C; typedef int ti;

TypeMention

A source code location referring to a type

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 { … };

TypedefType

A C/C++ typedef type. See 4.9.1. For example the types declared on each line of the following code: typedef int my_int; using my_int2 = int;

TypeidOperator

A C++ typeid expression which provides run-time type information (RTTI) about its argument.

Uintmax_t

The C/C++ uintmax_t type.

UnaryArithmeticOperation

A C/C++ unary arithmetic operation.

UnaryBitwiseOperation

A C/C++ unary bitwise operation.

UnaryLogicalOperation

A C/C++ unary logical operation.

UnaryMinusExpr

A C/C++ unary minus expression. b = - a;

UnaryOperation

A C/C++ unary operation.

UnaryPlusExpr

A C/C++ unary plus expression. b = + a;

Union

A C/C++ union. See C.8.2. For example, the type MyUnion in: union MyUnion { int i; float f; };

UnknownDefaultLocation

A dummy location which is used when something doesn’t have a location in the source code but needs to have a Location associated with it.

UnknownExprLocation

A dummy location which is used when an expression doesn’t have a location in the source code but needs to have a Location associated with it.

UnknownLocation

A dummy location which is used when something doesn’t have a location in the source code but needs to have a Location associated with it. There may be several distinct kinds of unknown locations. For example: one for expressions, one for statements and one for other program elements.

UnknownStmtLocation

A dummy location which is used when a statement doesn’t have a location in the source code but needs to have a Location associated with it.

UnknownType

The unknown type. This type has no corresponding C/C++ syntax.

UnsignedCharType

The C/C++ unsigned char type (which is distinct from plain char even when char is unsigned by default). unsigned char e, f;

Use
UserDefinedFormattingFunction

A function not in the standard library which takes a printf-like formatting string and a variable number of arguments.

UserType

A C/C++ user-defined type. Examples include class, struct, union, enum and typedef types. enum e1 { val1, val2 } b; enum class e2: short { val3, val4 } c; typedef int my_int; class C { int a, b; };

UsingAliasTypedefType

A using alias C++ typedef type. For example the type declared in the following code: using my_int2 = int;

UsingDeclarationEntry

A C++ using declaration. For example:

UsingDirectiveEntry

A C++ using directive. For example:

UsingEntry

A C++ using directive or using declaration.

UuidofOperator

A Microsoft C/C++ __uuidof expression that returns the UUID of a type, as specified by the __declspec(uuid) attribute. struct UUID { char a[16]; }; struct __declspec(uuid("{01234567-89ab-cdef-0123-456789ABCDEF}")) S {}; UUID uuid = __uuidof(S);

VacuousDestructorCall

An expression that looks like a destructor call, but has no effect.

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; }

Variable

A C/C++ variable. For example, in the following code there are four variables, a, b, c and d: ``` extern int a; int a;

VariableAccess

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

VariableCall

A C/C++ call which is performed through a variable of function pointer type. int call_via_ptr(int (*pfn)(int)) { return pfn(5); }

VariableDeclarationEntry

A particular declaration or definition of a C/C++ variable. For example, in the following code there are six variable declaration entries - two each for a and d, and one each for b and c: ``` extern int a; int a;

VectorAggregateLiteral

A C/C++ aggregate literal that initializes a GNU vector type.

VectorFillOperation

Fill operation on a vector. This is a GNU extension.

VirtualBaseClass

A class/struct that is the base of some virtual class derivation. For example MyBaseClass in the following code is a VirtualBaseClass of MyClass: ``` class MyBaseClass { … };

VirtualClassDerivation

A class/struct derivation that is virtual. For example the derivation in the following code is a VirtualClassDerivation: class MyClass : public virtual MyBaseClass { ... };

VirtualFunction

A C++ virtual function. For example the two functions called myVirtualFunction in the following code are each a VirtualFunction: ``` class A { public: virtual void myVirtualFunction() = 0; };

VlaDeclStmt

A C99 statement which declares a variable length array. For example the variable length array declaration in the following code: int myArray[x];

VlaDimensionStmt

A C99 statement which computes the size of a single dimension of a variable length array. For example the variable length array dimension (x) in the following code: int myArray[x];

VoidConversion

A conversion to void.

VoidPointerType

The C/C++ void* type.

VoidType

The C/C++ void type. See 4.7. void foo();

Wchar_t

The C/C++ wchar_t type.

WhileStmt

A C/C++ ‘while’ statement.

WideCharType

The C/C++ wide character type.

XMLAttribute

An attribute that occurs inside an XML element.

XMLCharacters

A sequence of characters that occurs between opening and closing tags of an XML element, excluding other elements.

XMLComment

A comment of the form <!-- ... --> is an XML comment.

XMLDTD

A “Document Type Definition” of an XML file.

XMLElement

An XML tag in an XML file.

XMLFile

An XML file.

XMLLocatable

An XML element that has a location.

XMLNamespace

A namespace used in an XML file

XMLParent

An XMLParent is either an XMLElement or an XMLFile, both of which can contain other elements.

Zero

A C/C++ literal whose value is zero.

Modules

CastSanity

INTERNAL: Do not use. Query predicates used to check invariants that should hold for all Cast nodes. To run all sanity queries for the ASTs, including the ones below, run “semmle/code/cpp/ASTSanity.ql”.

Aliases

BuiltInOperationBuiltInTypes

DEPRECATED: Use BuiltInOperationBuiltInTypesCompatibleP instead.

BuiltInOperationOffsetOf

DEPRECATED: Use BuiltInOperationBuiltInOffsetOf instead.

bb_successor

Successor relation for basic blocks.