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

Module Type

Provides a hierarchy of classes for modeling C/C++ types.

Import path

import semmle.code.cpp.Type

Imports

Element

Provides the Element class, which is the base class for all classes representing C or C++ program elements.

Function

Provides classes for working with functions, including template functions.

Classes

ArithmeticType

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

ArrayType

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

AutoType

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

BinaryFloatingPointType

A floating-point type whose representation is base 2.

BlockType

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

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

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;

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;

Char8Type

The C/C++ char8_t type. This is available starting with C++20. char8_t c8;

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;

ComplexDomain

The type domain of a floating-point type that represents a complex number.

ComplexNumberType

A floating-point type representing a complex number.

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;

DecimalFloatingPointType

A floating-point type whose representation is base 10.

Decltype

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

DerivedType

A C/C++ derived type.

DoubleType

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

ErroneousType

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

Float128Type

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

FloatType

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

FloatingPointType

The C/C++ floating point types. See 4.5. This includes float, double and long double, the fixed-size floating-point types like _Float32, the extended-precision floating-point types like _Float64x, and the decimal floating-point types like _Decimal32. It also includes the complex and imaginary versions of all of these types.

FunctionPointerIshType

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

FunctionPointerType

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

FunctionReferenceType

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

GNUVectorType

A GNU/Clang vector type.

ImaginaryDomain

The type domain of a floating-point type that represents an imaginary number.

ImaginaryNumberType

A floating-point type representing an imaginary number.

Int128Type

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

IntType

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

IntegralOrEnumType

A C/C++ integral or enum 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.

LValueReferenceType

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

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;

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;

PlainCharType

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

PointerToMemberType

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

PointerType

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

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

RealDomain

The type domain of a floating-point type that represents a real number.

RealNumberType

A floating-point type representing a real number.

ReferenceType

A C++ reference type. See 4.9.1.

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:

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;

SpecifiedType

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

TemplateParameter

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

TemplateTemplateParameter

A C++ template template parameter.

Type

A C/C++ type.

TypeDomain

The type domain of a floating-point type. One of RealDomain, ComplexDomain, or ImaginaryDomain.

TypeMention

A source code location referring to a user-defined type.

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;

VoidType

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

WideCharType

The C/C++ wide character type.