[CPP-418] Add QLDoc entries for typedef types, user types, bitwise operations and built-in operations.

This commit is contained in:
Ziemowit Laski
2019-09-04 21:19:11 -07:00
committed by Geoffrey White
parent 1f35f4bb52
commit b0a93481cb
5 changed files with 420 additions and 82 deletions

View File

@@ -362,7 +362,7 @@ private predicate isIntegralType(@builtintype type, int kind) {
}
/**
* A C/C++ integral or enum type.
* A C/C++ integral or `enum` type.
*
* The definition of "integral type" in the C++ Standard excludes `enum` types,
* but because an `enum` type holds a value of its underlying integral type,
@@ -569,7 +569,7 @@ class PlainCharType extends CharType {
/**
* The C/C++ `unsigned char` type (which is distinct from plain `char`
* even when `char` is unsigned by default).
* even when `char` is `unsigned` by default).
* ```
* unsigned char e, f;
* ```
@@ -582,7 +582,7 @@ class UnsignedCharType extends CharType {
/**
* The C/C++ `signed char` type (which is distinct from plain `char`
* even when `char` is signed by default).
* even when `char` is `signed` by default).
* ```
* signed char c, d;
* ```
@@ -928,17 +928,17 @@ class Decltype extends Type, @decltype {
*/
Type getBaseType() { decltypes(underlyingElement(this), _, unresolveElement(result), _) }
override string getCanonicalQLClass() { result = "Decltype" }
/**
* Whether an extra pair of parentheses around the expression would change the semantics of this decltype.
*
* The following example shows the effect of an extra pair of parentheses:
* struct A { double x; };
* const A* a = new A();
* decltype( a->x ); // type is double
* decltype((a->x)); // type is const double&
* Consult the C++11 standard for more details.
* ```
* struct A { double x; };
* const A* a = new A();
* decltype( a->x ); // type is double
* decltype((a->x)); // type is const double&
* ```
* Please consult the C++11 standard for more details.
*/
predicate parenthesesWouldChangeMeaning() { decltypes(underlyingElement(this), _, _, true) }
@@ -1007,7 +1007,7 @@ class PointerType extends DerivedType {
/**
* A C++ reference type. See 4.9.1.
*
* For C++11 code bases, this includes both _lvalue_ references (&) and _rvalue_ references (&&).
* For C++11 code bases, this includes both _lvalue_ references (`&`) and _rvalue_ references (`&&`).
* To distinguish between them, use the LValueReferenceType and RValueReferenceType classes.
*/
class ReferenceType extends DerivedType {
@@ -1033,7 +1033,7 @@ class ReferenceType extends DerivedType {
}
/**
* A C++11 lvalue reference type (e.g. `int&`).
* A C++11 lvalue reference type (e.g. `int &`).
* ```
* int a;
* int& b = a;
@@ -1046,8 +1046,8 @@ class LValueReferenceType extends ReferenceType {
}
/**
* A C++11 rvalue reference type (e.g. `int&&`). It is used to
* implement "move" semantics for object construction and assignments.
* 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;
@@ -1251,7 +1251,7 @@ class FunctionReferenceType extends FunctionPointerIshType {
}
/**
* A block type, for example int(^)(char, float).
* A block type, for example, `int(^)(char, float)`.
*
* Block types (along with blocks themselves) are a language extension
* supported by Clang, and by Apple's branch of GCC.

View File

@@ -2,12 +2,11 @@ import semmle.code.cpp.Type
private import semmle.code.cpp.internal.ResolveClass
/**
* A C/C++ typedef type. See 4.9.1.
*
* Represents either of the following typedef styles:
*
* * CTypedefType: typedef <type> <name>;
* * UsingAliasTypedefType: using <name> = <type>;
* 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;
* ```
*/
class TypedefType extends UserType {
TypedefType() {
@@ -48,7 +47,10 @@ class TypedefType extends UserType {
}
/**
* A traditional C/C++ typedef type. See 4.9.1.
* A traditional C/C++ typedef type. See 4.9.1. For example the type declared in the following code:
* ```
* typedef int my_int;
* ```
*/
class CTypedefType extends TypedefType {
CTypedefType() { usertypes(underlyingElement(this), _, 5) }
@@ -61,7 +63,10 @@ class CTypedefType extends TypedefType {
}
/**
* A using alias C++ typedef type.
* A using alias C++ typedef type. For example the type declared in the following code:
* ```
* using my_int2 = int;
* ```
*/
class UsingAliasTypedefType extends TypedefType {
UsingAliasTypedefType() { usertypes(underlyingElement(this), _, 14) }
@@ -74,7 +79,11 @@ class UsingAliasTypedefType extends TypedefType {
}
/**
* A C++ typedef type that is directly enclosed by a function.
* 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; }
* ```
*/
class LocalTypedefType extends TypedefType {
LocalTypedefType() { isLocal() }
@@ -83,7 +92,11 @@ class LocalTypedefType extends TypedefType {
}
/**
* A C++ typedef type that is directly enclosed by a class, struct or union.
* 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; };
* ```
*/
class NestedTypedefType extends TypedefType {
NestedTypedefType() { this.isMember() }

View File

@@ -5,8 +5,14 @@ import semmle.code.cpp.Function
private import semmle.code.cpp.internal.ResolveClass
/**
* A C/C++ user-defined type. Examples include `Class`, `Struct`, `Union`,
* `Enum`, and `TypedefType`.
* 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; };
* ```
*/
class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @usertype {
/**
@@ -88,6 +94,11 @@ class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @
/**
* A particular definition or forward declaration of a C/C++ user-defined type.
* ```
* class C;
* typedef int ti;
* extern void foo(int);
* ```
*/
class TypeDeclarationEntry extends DeclarationEntry, @type_decl {
override UserType getDeclaration() { result = getType() }

View File

@@ -7,6 +7,9 @@ abstract class UnaryBitwiseOperation extends UnaryOperation { }
/**
* A C/C++ complement expression.
* ```
* unsigned c = ~a;
* ```
*/
class ComplementExpr extends UnaryBitwiseOperation, @complementexpr {
override string getOperator() { result = "~" }
@@ -23,6 +26,9 @@ abstract class BinaryBitwiseOperation extends BinaryOperation { }
/**
* A C/C++ left shift expression.
* ```
* unsigned c = a << b;
* ```
*/
class LShiftExpr extends BinaryBitwiseOperation, @lshiftexpr {
override string getOperator() { result = "<<" }
@@ -34,6 +40,9 @@ class LShiftExpr extends BinaryBitwiseOperation, @lshiftexpr {
/**
* A C/C++ right shift expression.
* ```
* unsigned c = a >> b;
* ```
*/
class RShiftExpr extends BinaryBitwiseOperation, @rshiftexpr {
override string getOperator() { result = ">>" }
@@ -44,7 +53,10 @@ class RShiftExpr extends BinaryBitwiseOperation, @rshiftexpr {
}
/**
* A C/C++ bitwise and expression.
* A C/C++ bitwise AND expression.
* ```
* unsigned c = a & b;
* ```
*/
class BitwiseAndExpr extends BinaryBitwiseOperation, @andexpr {
override string getOperator() { result = "&" }
@@ -55,7 +67,10 @@ class BitwiseAndExpr extends BinaryBitwiseOperation, @andexpr {
}
/**
* A C/C++ bitwise or expression.
* A C/C++ bitwise OR expression.
* ```
* unsigned c = a | b;
* ```
*/
class BitwiseOrExpr extends BinaryBitwiseOperation, @orexpr {
override string getOperator() { result = "|" }
@@ -66,7 +81,10 @@ class BitwiseOrExpr extends BinaryBitwiseOperation, @orexpr {
}
/**
* A C/C++ bitwise xor expression.
* A C/C++ bitwise XOR expression.
* ```
* unsigned c = a ^ b;
* ```
*/
class BitwiseXorExpr extends BinaryBitwiseOperation, @xorexpr {
override string getOperator() { result = "^" }

View File

@@ -1,14 +1,19 @@
import semmle.code.cpp.exprs.Expr
/**
* A C/C++ builtin operation.
* A C/C++ builtin operation. This is the root QL class encompassing
* built-in functionality.
*/
abstract class BuiltInOperation extends Expr {
override string getCanonicalQLClass() { result = "BuiltInOperation" }
}
/**
* A C/C++ `__builtin_va_start` expression (used by some implementations of `va_start`).
* A C/C++ `__builtin_va_start` built-in predicate (used by some implementations of `va_start`).
* ```
__builtin_va_list ap;
__builtin_va_start(ap, last_named_param);
* ```
*/
class BuiltInVarArgsStart extends BuiltInOperation, @vastartexpr {
override string toString() { result = "__builtin_va_start" }
@@ -17,7 +22,12 @@ class BuiltInVarArgsStart extends BuiltInOperation, @vastartexpr {
}
/**
* A C/C++ `__builtin_va_end` expression (used by some implementations of `va_end`).
* A C/C++ `__builtin_va_end` built-in predicate (used by some implementations of `va_end`).
* ```
* __builtin_va_start(ap, last_named_param);
* ap = __builtin_va_arg(ap, long);
* __builtin_va_end(ap);
```
*/
class BuiltInVarArgsEnd extends BuiltInOperation, @vaendexpr {
override string toString() { result = "__builtin_va_end" }
@@ -26,7 +36,10 @@ class BuiltInVarArgsEnd extends BuiltInOperation, @vaendexpr {
}
/**
* A C/C++ `__builtin_va_arg` expression (used by some implementations of `va_arg`).
* A C/C++ `__builtin_va_arg` built-in predicate (used by some implementations of `va_arg`).
* ```
* ap = __builtin_va_arg(ap, long);
* ```
*/
class BuiltInVarArg extends BuiltInOperation, @vaargexpr {
override string toString() { result = "__builtin_va_arg" }
@@ -35,7 +48,12 @@ class BuiltInVarArg extends BuiltInOperation, @vaargexpr {
}
/**
* A C/C++ `__builtin_va_copy` expression (used by some implementations of `va_copy`).
* A C/C++ `__builtin_va_copy` built-in predicate (used by some implementations of `va_copy`).
* ```
* va_list ap, aq;
* __builtin_va_start(ap, last_named_param);
* va_copy(aq, ap);
* ```
*/
class BuiltInVarArgCopy extends BuiltInOperation, @vacopyexpr {
override string toString() { result = "__builtin_va_copy" }
@@ -45,6 +63,9 @@ class BuiltInVarArgCopy extends BuiltInOperation, @vacopyexpr {
/**
* A Microsoft C/C++ `__noop` expression, which does nothing.
* ```
* __noop;
* ```
*/
class BuiltInNoOp extends BuiltInOperation, @noopexpr {
override string toString() { result = "__noop" }
@@ -53,7 +74,11 @@ class BuiltInNoOp extends BuiltInOperation, @noopexpr {
}
/**
* A C++ `__offsetof` expression (used by some implementations of offsetof in the presence of user-defined `operator&`).
* A C++ `__offsetof` built-in predicate (used by some implementations of `offsetof` in the presence of user-defined `operator&`).
* It computes the offset (in bytes) of data member `m` from the beginning of its enclosing `struct`/`class`/`union` `st`.
* ```
* #define offsetof(st, m) __offsetof(st, m)
* ```
*/
class BuiltInOperationOffsetOf extends BuiltInOperation, @offsetofexpr {
override string toString() { result = "__offsetof" }
@@ -63,6 +88,10 @@ class BuiltInOperationOffsetOf extends BuiltInOperation, @offsetofexpr {
/**
* A C/C++ `__INTADDR__` expression, used by EDG to implement `offsetof` in the presence of user-defined `operator&`.
* It computes the offset (in bytes) of data member `m` from the beginning of its enclosing `struct`/`class`/`union` `st`.
* ```
* #define offsetof(st, m) __INTADDR__(st, m)
* ```
*/
class BuiltInIntAddr extends BuiltInOperation, @intaddrexpr {
override string toString() { result = "__INTADDR__" }
@@ -71,7 +100,11 @@ class BuiltInIntAddr extends BuiltInOperation, @intaddrexpr {
}
/**
* A C++ `__has_assign` expression (used by some implementations of the type_traits header).
* A C++ `__has_assign` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has a copy assignment operator.
* ```
* bool v = __has_assign(MyType);
* ```
*/
class BuiltInOperationHasAssign extends BuiltInOperation, @hasassignexpr {
override string toString() { result = "__has_assign" }
@@ -80,7 +113,11 @@ class BuiltInOperationHasAssign extends BuiltInOperation, @hasassignexpr {
}
/**
* A C++ `__has_copy` expression (used by some implementations of the type_traits header).
* A C++ `__has_copy` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has a copy constructor.
* ```
* std::integral_constant< bool, __has_copy(_Tp)> hc;
* ```
*/
class BuiltInOperationHasCopy extends BuiltInOperation, @hascopyexpr {
override string toString() { result = "__has_copy" }
@@ -89,7 +126,11 @@ class BuiltInOperationHasCopy extends BuiltInOperation, @hascopyexpr {
}
/**
* A C++ `__has_nothrow_assign` expression (used by some implementations of the type_traits header).
* A C++ `__has_nothrow_assign` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if a copy assignment operator has an empty exception specification.
* ```
* std::integral_constant< bool, __has_nothrow_assign(_Tp)> hnta;
* ```
*/
class BuiltInOperationHasNoThrowAssign extends BuiltInOperation, @hasnothrowassign {
override string toString() { result = "__has_nothrow_assign" }
@@ -98,7 +139,11 @@ class BuiltInOperationHasNoThrowAssign extends BuiltInOperation, @hasnothrowassi
}
/**
* A C++ `__has_nothrow_constructor` expression (used by some implementations of the type_traits header).
* A C++ `__has_nothrow_constructor` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the default constructor has an empty exception specification.
* ```
* bool v = __has_nothrow_constructor(MyType);
* ```
*/
class BuiltInOperationHasNoThrowConstructor extends BuiltInOperation, @hasnothrowconstr {
override string toString() { result = "__has_nothrow_constructor" }
@@ -107,7 +152,11 @@ class BuiltInOperationHasNoThrowConstructor extends BuiltInOperation, @hasnothro
}
/**
* A C++ `__has_nothrow_copy` expression (used by some implementations of the type_traits header).
* A C++ `__has_nothrow_copy` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the copy constructor has an empty exception specification.
* ```
* std::integral_constant< bool, __has_nothrow_copy(MyType) >;
* ```
*/
class BuiltInOperationHasNoThrowCopy extends BuiltInOperation, @hasnothrowcopy {
override string toString() { result = "__has_nothrow_copy" }
@@ -116,7 +165,11 @@ class BuiltInOperationHasNoThrowCopy extends BuiltInOperation, @hasnothrowcopy {
}
/**
* A C++ `__has_trivial_assign` expression (used by some implementations of the type_traits header).
* A C++ `__has_trivial_assign` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has a trivial (compiler-generated) assignment operator.
* ```
* bool v = __has_trivial_assign(MyType);
* ```
*/
class BuiltInOperationHasTrivialAssign extends BuiltInOperation, @hastrivialassign {
override string toString() { result = "__has_trivial_assign" }
@@ -125,7 +178,11 @@ class BuiltInOperationHasTrivialAssign extends BuiltInOperation, @hastrivialassi
}
/**
* A C++ `__has_trivial_constructor` expression (used by some implementations of the type_traits header).
* A C++ `__has_trivial_constructor` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has a trivial (compiler-generated) constructor.
* ```
* bool v = __has_trivial_constructor(MyType);
* ```
*/
class BuiltInOperationHasTrivialConstructor extends BuiltInOperation, @hastrivialconstr {
override string toString() { result = "__has_trivial_constructor" }
@@ -134,7 +191,11 @@ class BuiltInOperationHasTrivialConstructor extends BuiltInOperation, @hastrivia
}
/**
* A C++ `__has_trivial_copy` expression (used by some implementations of the type_traits header).
* A C++ `__has_trivial_copy` built-in predicate (used by some implementations of the `type_traits` header).
* Returns true if the type has a trivial (compiler-generated) copy constructor.
* ```
* std::integral_constant< bool, __has_trivial_copy(MyType) > htc;
* ```
*/
class BuiltInOperationHasTrivialCopy extends BuiltInOperation, @hastrivialcopy {
override string toString() { result = "__has_trivial_copy" }
@@ -143,7 +204,11 @@ class BuiltInOperationHasTrivialCopy extends BuiltInOperation, @hastrivialcopy {
}
/**
* A C++ `__has_trivial_destructor` expression (used by some implementations of the type_traits header).
* A C++ `__has_trivial_destructor` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has a trivial (compiler-generated) destructor.
* ```
* bool v = __has_trivial_destructor(MyType);
* ```
*/
class BuiltInOperationHasTrivialDestructor extends BuiltInOperation, @hastrivialdestructor {
override string toString() { result = "__has_trivial_destructor" }
@@ -152,7 +217,11 @@ class BuiltInOperationHasTrivialDestructor extends BuiltInOperation, @hastrivial
}
/**
* A C++ `__has_user_destructor` expression (used by some implementations of the type_traits header).
* A C++ `__has_user_destructor` built-in predicate (used by some implementations of the `type_traits` header).
* Returns true if the type has a user-declared destructor.
* ```
* bool v = __has_user_destructor(MyType);
* ```
*/
class BuiltInOperationHasUserDestructor extends BuiltInOperation, @hasuserdestr {
override string toString() { result = "__has_user_destructor" }
@@ -161,7 +230,14 @@ class BuiltInOperationHasUserDestructor extends BuiltInOperation, @hasuserdestr
}
/**
* A C++ `__has_virtual_destructor` expression (used by some implementations of the type_traits header).
* A C++ `__has_virtual_destructor` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has a virtual destructor.
* ```
* template<typename _Tp>
* struct has_virtual_destructor
* : public integral_constant<bool, __has_virtual_destructor(_Tp)>
* { };
* ```
*/
class BuiltInOperationHasVirtualDestructor extends BuiltInOperation, @hasvirtualdestr {
override string toString() { result = "__has_virtual_destructor" }
@@ -170,7 +246,11 @@ class BuiltInOperationHasVirtualDestructor extends BuiltInOperation, @hasvirtual
}
/**
* A C++ `__is_abstract` expression (used by some implementations of the type_traits header).
* A C++ `__is_abstract` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the class has at least one pure virtual function.
* ```
* bool v = __is_abstract(MyType);
* ```
*/
class BuiltInOperationIsAbstract extends BuiltInOperation, @isabstractexpr {
override string toString() { result = "__is_abstract" }
@@ -179,7 +259,11 @@ class BuiltInOperationIsAbstract extends BuiltInOperation, @isabstractexpr {
}
/**
* A C++ `__is_base_of` expression (used by some implementations of the type_traits header).
* A C++ `__is_base_of` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the first type is a base class of the second type, of if both types are the same.
* ```
* bool v = __is_base_of(MyType, OtherType);
* ```
*/
class BuiltInOperationIsBaseOf extends BuiltInOperation, @isbaseofexpr {
override string toString() { result = "__is_base_of" }
@@ -188,7 +272,11 @@ class BuiltInOperationIsBaseOf extends BuiltInOperation, @isbaseofexpr {
}
/**
* A C++ `__is_class` expression (used by some implementations of the type_traits header).
* A C++ `__is_class` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type is a `class` or a `struct`.
* ```
* bool v = __is_class(MyType);
* ```
*/
class BuiltInOperationIsClass extends BuiltInOperation, @isclassexpr {
override string toString() { result = "__is_class" }
@@ -197,7 +285,11 @@ class BuiltInOperationIsClass extends BuiltInOperation, @isclassexpr {
}
/**
* A C++ `__is_convertible_to` expression (used by some implementations of the type_traits header).
* A C++ `__is_convertible_to` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the first type can be converted to the second type.
* ```
* bool v = __is_convertible_to(MyType, OtherType);
* ```
*/
class BuiltInOperationIsConvertibleTo extends BuiltInOperation, @isconvtoexpr {
override string toString() { result = "__is_convertible_to" }
@@ -206,7 +298,11 @@ class BuiltInOperationIsConvertibleTo extends BuiltInOperation, @isconvtoexpr {
}
/**
* A C++ `__is_empty` expression (used by some implementations of the type_traits header).
* A C++ `__is_empty` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has no instance data members.
* ```
* bool v = __is_empty(MyType);
* ```
*/
class BuiltInOperationIsEmpty extends BuiltInOperation, @isemptyexpr {
override string toString() { result = "__is_empty" }
@@ -215,7 +311,11 @@ class BuiltInOperationIsEmpty extends BuiltInOperation, @isemptyexpr {
}
/**
* A C++ `__is_enum` expression (used by some implementations of the type_traits header).
* A C++ `__is_enum` built-in predicate (used by some implementations of the `type_traits` header).
* Returns true if the type is an `enum`.
* ```
* bool v = __is_enum(MyType);
* ```
*/
class BuiltInOperationIsEnum extends BuiltInOperation, @isenumexpr {
override string toString() { result = "__is_enum" }
@@ -224,7 +324,12 @@ class BuiltInOperationIsEnum extends BuiltInOperation, @isenumexpr {
}
/**
* A C++ `__is_pod` expression (used by some implementations of the type_traits header).
* A C++ `__is_pod` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type is a `class`, `struct` or `union`, WITHOUT (1) constructors,
* (2) private or protected non-static members (3) base classes, or (4) virtual functions.
* ```
* bool v = __is_pod(MyType);
* ```
*/
class BuiltInOperationIsPod extends BuiltInOperation, @ispodexpr {
override string toString() { result = "__is_pod" }
@@ -233,7 +338,11 @@ class BuiltInOperationIsPod extends BuiltInOperation, @ispodexpr {
}
/**
* A C++ `__is_polymorphic` expression (used by some implementations of the type_traits header).
* A C++ `__is_polymorphic` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has at least one virtual function.
* ```
* bool v = __is_polymorphic(MyType);
* ```
*/
class BuiltInOperationIsPolymorphic extends BuiltInOperation, @ispolyexpr {
override string toString() { result = "__is_polymorphic" }
@@ -242,7 +351,11 @@ class BuiltInOperationIsPolymorphic extends BuiltInOperation, @ispolyexpr {
}
/**
* A C++ `__is_union` expression (used by some implementations of the type_traits header).
* A C++ `__is_union` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type is a `union`.
* ```
* bool v = __is_union(MyType);
* ```
*/
class BuiltInOperationIsUnion extends BuiltInOperation, @isunionexpr {
override string toString() { result = "__is_union" }
@@ -256,7 +369,14 @@ class BuiltInOperationIsUnion extends BuiltInOperation, @isunionexpr {
deprecated class BuiltInOperationBuiltInTypes = BuiltInOperationBuiltInTypesCompatibleP;
/**
* A C++ `__builtin_types_compatible_p` expression (used by some implementations of the type_traits header).
* A C++ `__builtin_types_compatible_p` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the two types are the same (modulo qualifiers).
* ```
* template<typename _Tp1, typename _Tp2>
* struct types_compatible
* : public integral_constant<bool, __builtin_types_compatible_p(_Tp1, _Tp2) >
* { };
* ```
*/
class BuiltInOperationBuiltInTypesCompatibleP extends BuiltInOperation, @typescompexpr {
override string toString() { result = "__builtin_types_compatible_p" }
@@ -264,6 +384,13 @@ class BuiltInOperationBuiltInTypesCompatibleP extends BuiltInOperation, @typesco
/**
* A clang `__builtin_shufflevector` expression.
* It outputs a permutation of elements from one or two input vectors. Please visit
* https://releases.llvm.org/3.7.0/tools/clang/docs/LanguageExtensions.html#langext-builtin-shufflevector
* for more information.
* ```
* // Concatenate every other element of 4-element vectors V1 and V2.
* V3 = __builtin_shufflevector(V1, V2, 0, 2, 4, 6);
* ```
*/
class BuiltInOperationBuiltInShuffleVector extends BuiltInOperation, @builtinshufflevector {
override string toString() { result = "__builtin_shufflevector" }
@@ -273,6 +400,15 @@ class BuiltInOperationBuiltInShuffleVector extends BuiltInOperation, @builtinshu
/**
* A clang `__builtin_convertvector` expression.
* Allows for conversion of vectors of equal element count and compatible element types. Please see
* https://releases.llvm.org/3.7.0/tools/clang/docs/LanguageExtensions.html#builtin-convertvector
* for more information.
* ```
* float vf __attribute__((__vector_size__(16)));
* typedef double vector4double __attribute__((__vector_size__(32)));
* // convert from a vector of 4 floats to a vector of 4 doubles.
* vector4double vd = __builtin_convertvector(vf, vector4double);
* ```
*/
class BuiltInOperationBuiltInConvertVector extends BuiltInOperation, @builtinconvertvector {
override string toString() { result = "__builtin_convertvector" }
@@ -282,6 +418,11 @@ class BuiltInOperationBuiltInConvertVector extends BuiltInOperation, @builtincon
/**
* A clang `__builtin_addressof` expression (can be used to implement C++'s std::addressof).
* This function disregards any overloads created for `operator &`.
* ```
* int a = 1;
* int *b = __builtin_addressof(a);
* ```
*/
class BuiltInOperationBuiltInAddressOf extends UnaryOperation, BuiltInOperation, @builtinaddressof {
/** Gets the function or variable whose address is taken. */
@@ -298,7 +439,15 @@ class BuiltInOperationBuiltInAddressOf extends UnaryOperation, BuiltInOperation,
}
/**
* The `__is_trivially_constructible` type trait.
* The `__is_trivially_constructible` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has a trivial (compiler-generated) default constructor,
* copy constructor or move constructor.
* ```
* template<typename T, typename... Args>
* struct is_trivially_constructible
* : public integral_constant<bool, __is_trivially_constructible(T) >
* { };
* ```
*/
class BuiltInOperationIsTriviallyConstructible extends BuiltInOperation,
@istriviallyconstructibleexpr {
@@ -308,7 +457,12 @@ class BuiltInOperationIsTriviallyConstructible extends BuiltInOperation,
}
/**
* The `__is_destructible` type trait.
* The `__is_destructible` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type's destructor is not `delete`d and is accessible in derived `class`es, and whose
* base `class` and all non-static data members are also destructible.
* ```
* bool v = __is_destructible(MyType);
* ```
*/
class BuiltInOperationIsDestructible extends BuiltInOperation, @isdestructibleexpr {
override string toString() { result = "__is_destructible" }
@@ -317,7 +471,12 @@ class BuiltInOperationIsDestructible extends BuiltInOperation, @isdestructibleex
}
/**
* The `__is_nothrow_destructible` type trait.
* The `__is_nothrow_destructible` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type is destructible and whose constructor, and those of
* member data and any super`class`es all have an empty exception specification.
* ```
* bool v = __is_nothrow_destructible(MyType);
* ```
*/
class BuiltInOperationIsNothrowDestructible extends BuiltInOperation, @isnothrowdestructibleexpr {
override string toString() { result = "__is_nothrow_destructible" }
@@ -326,7 +485,12 @@ class BuiltInOperationIsNothrowDestructible extends BuiltInOperation, @isnothrow
}
/**
* The `__is_trivially_destructible` type trait.
* The `__is_trivially_destructible` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type is destructible and whose constructor, and those of
* member data and any super`class`es are all trivial (compiler-generated).
* ```
* bool v = __is_trivially_destructible(MyType);
* ```
*/
class BuiltInOperationIsTriviallyDestructible extends BuiltInOperation, @istriviallydestructibleexpr {
override string toString() { result = "__is_trivially_destructible" }
@@ -335,7 +499,15 @@ class BuiltInOperationIsTriviallyDestructible extends BuiltInOperation, @istrivi
}
/**
* The `__is_trivially_assignable` type trait.
* The `__is_trivially_assignable` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the assignment operator `C::operator =(const C& c)` is trivial (compiler-generated). The
* generated code will have resembled a `memcpy` operation.
* ```
* template<typename T>
* struct is_trivially_assignable
* : public integral_constant<bool, __is_trivially_assignable(T) >
* { };
* ```
*/
class BuiltInOperationIsTriviallyAssignable extends BuiltInOperation, @istriviallyassignableexpr {
override string toString() { result = "__is_trivially_assignable" }
@@ -344,7 +516,12 @@ class BuiltInOperationIsTriviallyAssignable extends BuiltInOperation, @istrivial
}
/**
* The `__is_nothrow_assignable` type trait.
* The `__is_nothrow_assignable` built-in predicate (used by some implementations of the `type_traits` header).
* Returns true if there exists a `C::operator =(const C& c) nothrow` assignment operator (i.e, with an
* empty excepion specification).
* ```
* bool v = __is_nothrow_assignable(MyType);
* ```
*/
class BuiltInOperationIsNothrowAssignable extends BuiltInOperation, @isnothrowassignableexpr {
override string toString() { result = "__is_nothrow_assignable" }
@@ -353,7 +530,13 @@ class BuiltInOperationIsNothrowAssignable extends BuiltInOperation, @isnothrowas
}
/**
* The `__is_standard_layout` type trait.
* The `__is_standard_layout` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type is a primitive type, or a`class`, `struct` or `union` WITHOUT (1) virtual functions or base classes,
* (2) reference member variable or (3) multiple occurrences of base `class` objects, among other restrictions.
* Please see https://en.cppreference.com/w/cpp/named_req/StandardLayoutType for more information.
* ```
* bool v = __is_standard_layout(MyType);
* ```
*/
class BuiltInOperationIsStandardLayout extends BuiltInOperation, @isstandardlayoutexpr {
override string toString() { result = "__is_standard_layout" }
@@ -362,7 +545,9 @@ class BuiltInOperationIsStandardLayout extends BuiltInOperation, @isstandardlayo
}
/**
* The `__is_trivially_copyable` type trait.
* The `__is_trivially_copyable` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if instances of this type can be copied by trivial (compiler-generated) means. The copying is done
* in a mannter similar to the `memcpy` function.
*/
class BuiltInOperationIsTriviallyCopyable extends BuiltInOperation, @istriviallycopyableexpr {
override string toString() { result = "__is_trivially_copyable" }
@@ -371,7 +556,13 @@ class BuiltInOperationIsTriviallyCopyable extends BuiltInOperation, @istrivially
}
/**
* The `__is_literal_type` type trait.
* The `__is_literal_type` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type is a scalar type, a reference type or an array of literal types, among
* others. Please see https://en.cppreference.com/w/cpp/named_req/LiteralType for more information.
*
* ```
* std::integral_constant< bool, __is_literal_type(_Tp)> ilt;
* ```
*/
class BuiltInOperationIsLiteralType extends BuiltInOperation, @isliteraltypeexpr {
override string toString() { result = "__is_literal_type" }
@@ -380,7 +571,12 @@ class BuiltInOperationIsLiteralType extends BuiltInOperation, @isliteraltypeexpr
}
/**
* The `__has_trivial_move_constructor` type trait.
* The `__has_trivial_move_constructor` built-in predicate (used by some implementations of the `type_traits` header).
* Returns true if the move (`&&`) constructor can be generated by the compiler, with semantics
* of the `memcpy` operation.
* ```
* std::integral_constant< bool, __has_trivial_move_constructor(_Tp)> htmc;
* ```
*/
class BuiltInOperationHasTrivialMoveConstructor extends BuiltInOperation,
@hastrivialmoveconstructorexpr {
@@ -390,7 +586,15 @@ class BuiltInOperationHasTrivialMoveConstructor extends BuiltInOperation,
}
/**
* The `__has_trivial_move_assign` type trait.
* The `__has_trivial_move_assign` built-in predicate (used by some implementations of the `type_traits` header).
* Returns if the move-assign operator `C::operator =(C &&c)` is trivial (i.e., can be generated by the
* compiler).
* ```
* template<typename T>
* struct is_trivially_assignable
* : public integral_constant<bool, __is_trivially_assignable(T) >
* { };
* ```
*/
class BuiltInOperationHasTrivialMoveAssign extends BuiltInOperation, @hastrivialmoveassignexpr {
override string toString() { result = "__has_trivial_move_assign" }
@@ -399,7 +603,12 @@ class BuiltInOperationHasTrivialMoveAssign extends BuiltInOperation, @hastrivial
}
/**
* The `__has_nothrow_move_assign` type trait.
* The `__has_nothrow_move_assign` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type has a `C::operator=(C&& c) nothrow`, that is, an assignment operator with
* an empty exception specification.
* ```
* bool v = __has_nothrow_move_assign(MyType);
* ```
*/
class BuiltInOperationHasNothrowMoveAssign extends BuiltInOperation, @hasnothrowmoveassignexpr {
override string toString() { result = "__has_nothrow_move_assign" }
@@ -408,7 +617,14 @@ class BuiltInOperationHasNothrowMoveAssign extends BuiltInOperation, @hasnothrow
}
/**
* The `__is_constructible` type trait.
* The `__is_constructible` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type can be constructed using specified arguments (or none).
* ```
* template<typename T, typename... Args>
* struct is_trivially_constructible
* : public integral_constant<bool, __is_trivially_constructible(T) >
* { };
* ```
*/
class BuiltInOperationIsConstructible extends BuiltInOperation, @isconstructibleexpr {
override string toString() { result = "__is_constructible" }
@@ -417,7 +633,12 @@ class BuiltInOperationIsConstructible extends BuiltInOperation, @isconstructible
}
/**
* The `__is_nothrow_constructible` type trait.
* The `__is_nothrow_constructible` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the type is constructable and all its constructors have an empty exception specification
* (i.e., are declared with `nothrow`);
* ```
* bool v = __is_nothrow_constructible(MyType);
* ```
*/
class BuiltInOperationIsNothrowConstructible extends BuiltInOperation, @isnothrowconstructibleexpr {
override string toString() { result = "__is_nothrow_constructible" }
@@ -426,7 +647,13 @@ class BuiltInOperationIsNothrowConstructible extends BuiltInOperation, @isnothro
}
/**
* The `__has_finalizer` type trait.
* The `__has_finalizer` built-in predicate.
* This is a Microsoft extension.
* Returns `true` if the type defines a _finalizer_ `C::!C(void)`, to be called from either the
* regular destructor or the garbage collector.
* ```
* bool v = __has_finalizer(MyType);
* ```
*/
class BuiltInOperationHasFinalizer extends BuiltInOperation, @hasfinalizerexpr {
override string toString() { result = "__has_finalizer" }
@@ -435,7 +662,11 @@ class BuiltInOperationHasFinalizer extends BuiltInOperation, @hasfinalizerexpr {
}
/**
* The `__is_delegate` type trait.
* The `__is_delegate` built-in predicate.
* This is a Microsoft extension.
* Returns `true` if the function has been declared as a `delegate`, used in message forwarding.
* Please see https://docs.microsoft.com/en-us/cpp/extensions/delegate-cpp-component-extensions
* for more information.
*/
class BuiltInOperationIsDelegate extends BuiltInOperation, @isdelegateexpr {
override string toString() { result = "__is_delegate" }
@@ -444,7 +675,11 @@ class BuiltInOperationIsDelegate extends BuiltInOperation, @isdelegateexpr {
}
/**
* The `__is_interface_class` type trait.
* The `__is_interface_class` built-in predicate.
* This is a Microsoft extension.
* Returns `true` if the type has been declared as an `interface`. Please see
* https://docs.microsoft.com/en-us/cpp/extensions/interface-class-cpp-component-extensions
* for more information.
*/
class BuiltInOperationIsInterfaceClass extends BuiltInOperation, @isinterfaceclassexpr {
override string toString() { result = "__is_interface_class" }
@@ -453,7 +688,15 @@ class BuiltInOperationIsInterfaceClass extends BuiltInOperation, @isinterfacecla
}
/**
* The `__is_ref_array` type trait.
* The `__is_ref_array` built-in predicate.
* This is a Microsoft extension.
* Returns `true` if the object passed in is a _platform array_. Please see
* https://docs.microsoft.com/en-us/cpp/extensions/arrays-cpp-component-extensions
* for more information.
* ```
* array<int>^ x = gcnew array<int>(10);
* bool b = __is_ref_array(array<int>);
* ```
*/
class BuiltInOperationIsRefArray extends BuiltInOperation, @isrefarrayexpr {
override string toString() { result = "__is_ref_array" }
@@ -462,7 +705,15 @@ class BuiltInOperationIsRefArray extends BuiltInOperation, @isrefarrayexpr {
}
/**
* The `__is_ref_class` type trait.
* The `__is_ref_class` built-in predicate.
* This is a Microsoft extension.
* Returns `true` if the type is a _reference class_. Please see
* https://docs.microsoft.com/en-us/cpp/extensions/classes-and-structs-cpp-component-extensions
* for more information.
* ```
* ref class R {};
* bool b = __is_ref_class(R);
* ```
*/
class BuiltInOperationIsRefClass extends BuiltInOperation, @isrefclassexpr {
override string toString() { result = "__is_ref_class" }
@@ -471,7 +722,16 @@ class BuiltInOperationIsRefClass extends BuiltInOperation, @isrefclassexpr {
}
/**
* The `__is_sealed` type trait.
* The `__is_sealed` built-in predicate.
* This is a Microsoft extension.
* Returns `true` if a given class or virtual function is marked as `sealed`,
* meaning that it cannot be extended or overridden. The `sealed` keyword
* is similar to the C++11 `final` keyword.
* ```
* ref class X sealed {
* virtual void f() sealed { }
* };
* ```
*/
class BuiltInOperationIsSealed extends BuiltInOperation, @issealedexpr {
override string toString() { result = "__is_sealed" }
@@ -480,7 +740,15 @@ class BuiltInOperationIsSealed extends BuiltInOperation, @issealedexpr {
}
/**
* The `__is_simple_value_class` type trait.
* The `__is_simple_value_class` built-in predicate. This is a Microsoft extension.
* Returns `true` if passed a value type that contains no references to the garbage-collected heap.
* ```
* ref class R {}; // __is_simple_value_class(R) == false
* value struct V {}; // __is_simple_value_class(V) == true
* value struct V2 { // __is_simple_value_class(V2) == false
* R ^ r; // not a simnple value type
* };
* ```
*/
class BuiltInOperationIsSimpleValueClass extends BuiltInOperation, @issimplevalueclassexpr {
override string toString() { result = "__is_simple_value_class" }
@@ -489,7 +757,14 @@ class BuiltInOperationIsSimpleValueClass extends BuiltInOperation, @issimplevalu
}
/**
* The `__is_value_class` type trait.
* The `__is_value_class` built-in predicate. This is a Microsoft extension.
* Returns `true` if passed a value type. Please see
* https://docs.microsoft.com/en-us/cpp/extensions/classes-and-structs-cpp-component-extensions
* For more information.
* ```
* value struct V {};
* bool v = __is_value_class(V);
* ```
*/
class BuiltInOperationIsValueClass extends BuiltInOperation, @isvalueclassexpr {
override string toString() { result = "__is_value_class" }
@@ -498,7 +773,14 @@ class BuiltInOperationIsValueClass extends BuiltInOperation, @isvalueclassexpr {
}
/**
* The `__is_final` type trait.
* The `__is_final` built-in predicate (used by some implementations of the `type_traits` header).
* Returns `true` if the `class` has been marked with the `final` specifier.
* ```
* template<typename T>
* struct is_final
* : public integral_constant<bool, __is_final(T) >
* { };
* ```
*/
class BuiltInOperationIsFinal extends BuiltInOperation, @isfinalexpr {
override string toString() { result = "__is_final" }
@@ -507,17 +789,31 @@ class BuiltInOperationIsFinal extends BuiltInOperation, @isfinalexpr {
}
/**
* The `__builtin_choose_expr` type trait.
* The `__builtin_choose_expr` expression. This is a GNU/Clang extension.
* The expression functions similarly to the ternary `?:` operator, except
* that it is evaluated at compile-time.
* ```
* int sz = __builtin_choose_expr(__builtin_types_compatible_p(int, long), 4, 8);
* ```
*/
class BuiltInChooseExpr extends BuiltInOperation, @builtinchooseexpr {
override string toString() { result = "__builtin_choose_expr" }
override string getCanonicalQLClass() { result = "BuiltInChooseExpr" }
}
/**
* Fill operation on a GNU vector.
* Fill operation on a vector. This is a GNU extension.
* ```
* typedef float float4 __attribute__((ext_vector_type(4)));
* float4 v4si = (float4){ 1.0, 2.0, 3.0, 4.0 };
*
* ```
*/
class VectorFillOperation extends UnaryOperation, @vec_fill {
override string getOperator() { result = "(vector fill)" }
override string getCanonicalQLClass() { result = "VectorFillOperation" }
}
/**