mirror of
https://github.com/github/codeql.git
synced 2025-12-16 08:43:11 +01:00
C++: Support more builtin operations
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
class Expr extends @expr {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
class Location extends @location_expr {
|
||||
string toString() { none() }
|
||||
}
|
||||
|
||||
predicate isExprWithNewBuiltin(Expr expr) {
|
||||
exists(int kind | exprs(expr, kind, _) | 364 <= kind and kind <= 384)
|
||||
}
|
||||
|
||||
from Expr expr, int kind, int kind_new, Location location
|
||||
where
|
||||
exprs(expr, kind, location) and
|
||||
if isExprWithNewBuiltin(expr) then kind_new = 1 else kind_new = kind
|
||||
select expr, kind_new, location
|
||||
2289
cpp/downgrades/3d35dd6b50edfc540c14c6757e0c7b3c5b7b04dd/old.dbscheme
Normal file
2289
cpp/downgrades/3d35dd6b50edfc540c14c6757e0c7b3c5b7b04dd/old.dbscheme
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
description: Add new builtin operations
|
||||
compatibility: partial
|
||||
exprs.rel: run exprs.qlo
|
||||
@@ -383,6 +383,37 @@ class BuiltInOperationIsConvertibleTo extends BuiltInOperation, @isconvtoexpr {
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsConvertibleTo" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_convertible` built-in operation (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(MyType, OtherType);
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationIsConvertible extends BuiltInOperation, @isconvertible {
|
||||
override string toString() { result = "__is_convertible" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsConvertible" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_nothrow_convertible` built-in operation (used by some implementations
|
||||
* of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if the first type can be converted to the second type without
|
||||
* potentially rasing an exception.
|
||||
* ```
|
||||
* bool v = __is_nothrow_convertible(MyType, OtherType);
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationIsNothrowConvertible extends BuiltInOperation, @isnothrowconvertible {
|
||||
override string toString() { result = "__is_nothrow_convertible" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsNothrowConvertible" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_empty` built-in operation (used by some implementations of the
|
||||
* `<type_traits>` header).
|
||||
@@ -675,6 +706,26 @@ class BuiltInOperationIsAssignable extends BuiltInOperation, @isassignable {
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsAssignable" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The `__is_assignable_no_precondition_check` built-in operation (used by some
|
||||
* implementations of the `<type_traits>` header).
|
||||
*
|
||||
* Returns true if there exists a `C::operator =(const D& d)` assignment
|
||||
* operator.
|
||||
* ```
|
||||
* bool v = __is_assignable_no_precondition_check(MyType1, MyType2);
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationIsAssignableNoPreconditionCheck extends BuiltInOperation,
|
||||
@isassignablenopreconditioncheck
|
||||
{
|
||||
override string toString() { result = "__is_assignable_no_precondition_check" }
|
||||
|
||||
override string getAPrimaryQlClass() {
|
||||
result = "BuiltInOperationIsAssignableNoPreconditionCheck"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The `__is_standard_layout` built-in operation (used by some implementations
|
||||
* of the `<type_traits>` header).
|
||||
@@ -708,6 +759,20 @@ class BuiltInOperationIsTriviallyCopyable extends BuiltInOperation, @istrivially
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsTriviallyCopyable" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The `__is_trivially_copy_assignable` built-in operation (used by some
|
||||
* implementations of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if instances of this type can be copied using a trivial
|
||||
* copy operator.
|
||||
*/
|
||||
class BuiltInOperationIsTriviallyCopyAssignable extends BuiltInOperation, @istriviallycopyassignable
|
||||
{
|
||||
override string toString() { result = "__is_trivially_copy_assignable" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsTriviallyCopyAssignable" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The `__is_literal_type` built-in operation (used by some implementations of
|
||||
* the `<type_traits>` header).
|
||||
@@ -1062,6 +1127,24 @@ class BuiltInOperationIsSame extends BuiltInOperation, @issame {
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsSame" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_same_as` built-in operation (used by some implementations of the
|
||||
* `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if two types are the same.
|
||||
* ```
|
||||
* template<typename _Tp, typename _Up>
|
||||
* struct is_same
|
||||
* : public integral_constant<bool, __is_same_as(_Tp, _Up)>
|
||||
* { };
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationIsSameAs extends BuiltInOperation, @issameas {
|
||||
override string toString() { result = "__is_same_as" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsSameAs" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_function` built-in operation (used by some implementations of the
|
||||
* `<type_traits>` header).
|
||||
@@ -1120,6 +1203,87 @@ class BuiltInOperationIsPointerInterconvertibleBaseOf extends BuiltInOperation,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_pointer_interconvertible_with_class` built-in operation (used
|
||||
* by some implementations of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if the member pointer is pointer-interconvertible with a
|
||||
* class type.
|
||||
* ```
|
||||
* template<typename _Tp, typename _Up>
|
||||
* constexpr bool is_pointer_interconvertible_with_class(_Up _Tp::*mp) noexcept
|
||||
* = __is_pointer_interconvertible_with_class(_Tp, mp);
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationIsPointerInterconvertibleWithClass extends BuiltInOperation,
|
||||
@ispointerinterconvertiblewithclass
|
||||
{
|
||||
override string toString() { result = "__is_pointer_interconvertible_with_class" }
|
||||
|
||||
override string getAPrimaryQlClass() {
|
||||
result = "BuiltInOperationIsPointerInterconvertibleWithClass"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__builtin_is_pointer_interconvertible_with_class` built-in operation (used
|
||||
* by some implementations of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if the member pointer is pointer-interconvertible with a class type.
|
||||
* ```
|
||||
* template<typename _Tp, typename _Up>
|
||||
* constexpr bool is_pointer_interconvertible_with_class(_Up _Tp::*mp) noexcept
|
||||
* = __builtin_is_pointer_interconvertible_with_class(mp);
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationBuiltInIsPointerInterconvertible extends BuiltInOperation,
|
||||
@builtinispointerinterconvertiblewithclass
|
||||
{
|
||||
override string toString() { result = "__builtin_is_pointer_interconvertible_with_class" }
|
||||
|
||||
override string getAPrimaryQlClass() {
|
||||
result = "BuiltInOperationBuiltInIsPointerInterconvertible"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_corresponding_member` built-in operation (used
|
||||
* by some implementations of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if the member pointers refer to corresponding
|
||||
* members in the initial sequences of two class types.
|
||||
* ```
|
||||
* template<typename _Tp1, typename _Tp2, typename _Up1, typename _Up2>
|
||||
* constexpr bool is_corresponding_member(_Up1 _Tp1::*mp1, _Up2 _Tp2::*mp2 ) noexcept
|
||||
* = __is_corresponding_member(_Tp1, _Tp2, mp1, mp2);
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationIsCorrespondingMember extends BuiltInOperation, @iscorrespondingmember {
|
||||
override string toString() { result = "__is_corresponding_member" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsCorrespondingMember" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__builtin_is_corresponding_member` built-in operation (used
|
||||
* by some implementations of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if the member pointers refer to corresponding
|
||||
* members in the initial sequences of two class types.
|
||||
* ```
|
||||
* template<typename _Tp1, typename _Tp2, typename _Up1, typename _Up2>
|
||||
* constexpr bool is_corresponding_member(_Up1 _Tp1::*mp1, _Up2 _Tp2::*mp2 ) noexcept
|
||||
* = __builtin_is_corresponding_member(mp1, mp2);
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationBuiltInIsCorrespondingMember extends BuiltInOperation,
|
||||
@builtiniscorrespondingmember
|
||||
{
|
||||
override string toString() { result = "__builtin_is_corresponding_member" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationBuiltInIsCorrespondingMember" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_array` built-in operation (used by some implementations of the
|
||||
* `<type_traits>` header).
|
||||
@@ -1138,6 +1302,42 @@ class BuiltInOperationIsArray extends BuiltInOperation, @isarray {
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsArray" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_bounded_array` built-in operation (used by some implementations
|
||||
* of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if a type is a bounded array type.
|
||||
* ```
|
||||
* template<typename _Tp>
|
||||
* struct is_bounded_array
|
||||
* : public integral_constant<bool, __is_bounded_array(_Tp)>
|
||||
* { };
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationIsBoundedArray extends BuiltInOperation, @isboundedarray {
|
||||
override string toString() { result = "__is_bounded_array" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsBoundedArray" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_unbounded_array` built-in operation (used by some implementations
|
||||
* of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if a type is an unbounded array type.
|
||||
* ```
|
||||
* template<typename _Tp>
|
||||
* struct is_bounded_array
|
||||
* : public integral_constant<bool, __is_unbounded_array(_Tp)>
|
||||
* { };
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationIsUnboundedArray extends BuiltInOperation, @isunboundedarray {
|
||||
override string toString() { result = "__is_unbounded_array" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsUnboundedArray" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__array_rank` built-in operation (used by some implementations of the
|
||||
* `<type_traits>` header).
|
||||
@@ -1554,10 +1754,10 @@ class BuiltInBitCast extends BuiltInOperation, @builtinbitcast {
|
||||
*
|
||||
* Returns `true` if a type is a trivial type.
|
||||
* ```
|
||||
* template<typename _Tp>
|
||||
* struct is_trivial
|
||||
* : public integral_constant<bool, __is_trivial(_Tp)>
|
||||
* {};
|
||||
* template<typename _Tp>
|
||||
* struct is_trivial
|
||||
* : public integral_constant<bool, __is_trivial(_Tp)>
|
||||
* {};
|
||||
* ```
|
||||
*/
|
||||
class BuiltInIsTrivial extends BuiltInOperation, @istrivialexpr {
|
||||
@@ -1565,3 +1765,124 @@ class BuiltInIsTrivial extends BuiltInOperation, @istrivialexpr {
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInIsTrivial" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__reference_constructs_from_temporary` built-in operation
|
||||
* (used by some implementations of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if a type is a trivial type.
|
||||
* ```
|
||||
* template<typename _Tp>
|
||||
* struct reference_constructs_from_temporary
|
||||
* : public integral_constant<bool, __reference_constructs_from_temporary(_Tp)>
|
||||
* {};
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationReferenceConstructsFromTemporary extends BuiltInOperation,
|
||||
@referenceconstructsfromtemporary
|
||||
{
|
||||
override string toString() { result = "__reference_constructs_from_temporary" }
|
||||
|
||||
override string getAPrimaryQlClass() {
|
||||
result = "BuiltInOperationReferenceConstructsFromTemporary"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__reference_converts_from_temporary` built-in operation
|
||||
* (used by some implementations of the `<type_traits>` header).
|
||||
*
|
||||
* Returns `true` if a type is a trivial type.
|
||||
* ```
|
||||
* template<typename _Tp>
|
||||
* struct reference_converts_from_temporary
|
||||
* : public integral_constant<bool, __reference_converts_from_temporary(_Tp)>
|
||||
* {};
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationReferenceCovertsFromTemporary extends BuiltInOperation,
|
||||
@referenceconstructsfromtemporary
|
||||
{
|
||||
override string toString() { result = "__reference_constructs_from_temporary" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationReferenceCovertsFromTemporary" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__reference_binds_to_temporary` built-in operation (used by some
|
||||
* implementations of the `<tuple>` header).
|
||||
*
|
||||
* Returns `true` if a reference of type `Type1` bound to an expression of
|
||||
* type `Type1` binds to a temporary object.
|
||||
* ```
|
||||
* __reference_binds_to_temporary(Type1, Type2)
|
||||
*/
|
||||
class BuiltInOperationReferenceBindsToTemporary extends BuiltInOperation, @referencebindstotemporary
|
||||
{
|
||||
override string toString() { result = "__reference_binds_to_temporary" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationReferenceBindsToTemporary" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__builtin_has_attribute` built-in operation.
|
||||
*
|
||||
* Returns `true` if a type or expression has been declared with an
|
||||
* attribute.
|
||||
* ```
|
||||
* __attribute__ ((aligned(8))) int v;
|
||||
* bool has_attribute = __builtin_has_attribute(v, aligned);
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationHasAttribute extends BuiltInOperation, @builtinhasattribute {
|
||||
override string toString() { result = "__builtin_has_attribute" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationHasAttribute" }
|
||||
}
|
||||
|
||||
/**
|
||||
* A C++ `__is_referenceable` built-in operation.
|
||||
*
|
||||
* Returns `true` if a type can be referenced.
|
||||
* ```
|
||||
* bool is_referenceable = __is_referenceable(int);
|
||||
* ```
|
||||
*/
|
||||
class BuiltInOperationIsReferenceable extends BuiltInOperation, @isreferenceable {
|
||||
override string toString() { result = "__is_referenceable" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInIsReferenceable" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The `__is_valid_winrt_type` built-in operation. This is a Microsoft extension.
|
||||
*
|
||||
* Returns `true` if the type is a valid WinRT type.
|
||||
*/
|
||||
class BuiltInOperationIsValidWinRtType extends BuiltInOperation, @isvalidwinrttype {
|
||||
override string toString() { result = "__is_valid_winrt_type" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsValidWinRtType" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The `__is_win_class` built-in operation. This is a Microsoft extension.
|
||||
*
|
||||
* Returns `true` if the class is a ref class.
|
||||
*/
|
||||
class BuiltInOperationIsWinClass extends BuiltInOperation, @iswinclass {
|
||||
override string toString() { result = "__is_win_class" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsWinClass" }
|
||||
}
|
||||
|
||||
/**
|
||||
* The `__is_win_class` built-in operation. This is a Microsoft extension.
|
||||
*
|
||||
* Returns `true` if the class is an interface class.
|
||||
*/
|
||||
class BuiltInOperationIsWinInterface extends BuiltInOperation, @iswininterface {
|
||||
override string toString() { result = "__is_win_interface" }
|
||||
|
||||
override string getAPrimaryQlClass() { result = "BuiltInOperationIsWinInterface" }
|
||||
}
|
||||
|
||||
@@ -1748,6 +1748,25 @@ case @expr.kind of
|
||||
| 361 = @isvoid
|
||||
| 362 = @isvolatile
|
||||
| 363 = @reuseexpr
|
||||
| 364 = @istriviallycopyassignable
|
||||
| 365 = @isassignablenopreconditioncheck
|
||||
| 366 = @referencebindstotemporary
|
||||
| 367 = @issameas
|
||||
| 368 = @builtinhasattribute
|
||||
| 369 = @ispointerinterconvertiblewithclass
|
||||
| 370 = @builtinispointerinterconvertiblewithclass
|
||||
| 371 = @iscorrespondingmember
|
||||
| 372 = @builtiniscorrespondingmember
|
||||
| 373 = @isboundedarray
|
||||
| 374 = @isunboundedarray
|
||||
| 375 = @isreferenceable
|
||||
| 378 = @isnothrowconvertible
|
||||
| 379 = @referenceconstructsfromtemporary
|
||||
| 380 = @referenceconvertsfromtemporary
|
||||
| 381 = @isconvertible
|
||||
| 382 = @isvalidwinrttype
|
||||
| 383 = @iswinclass
|
||||
| 384 = @iswininterface
|
||||
;
|
||||
|
||||
@var_args_expr = @vastartexpr
|
||||
@@ -1842,6 +1861,25 @@ case @expr.kind of
|
||||
| @isunsigned
|
||||
| @isvoid
|
||||
| @isvolatile
|
||||
| @istriviallycopyassignable
|
||||
| @isassignablenopreconditioncheck
|
||||
| @referencebindstotemporary
|
||||
| @issameas
|
||||
| @builtinhasattribute
|
||||
| @ispointerinterconvertiblewithclass
|
||||
| @builtinispointerinterconvertiblewithclass
|
||||
| @iscorrespondingmember
|
||||
| @builtiniscorrespondingmember
|
||||
| @isboundedarray
|
||||
| @isunboundedarray
|
||||
| @isreferenceable
|
||||
| @isnothrowconvertible
|
||||
| @referenceconstructsfromtemporary
|
||||
| @referenceconvertsfromtemporary
|
||||
| @isconvertible
|
||||
| @isvalidwinrttype
|
||||
| @iswinclass
|
||||
| @iswininterface
|
||||
;
|
||||
|
||||
new_allocated_type(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
description: Add new builtin operations
|
||||
compatibility: backwards
|
||||
@@ -1,4 +1,4 @@
|
||||
// semmle-extractor-options: --clang --clang_version 100000
|
||||
// semmle-extractor-options: --clang --clang_version 180000
|
||||
|
||||
struct S {
|
||||
void f() {}
|
||||
@@ -93,3 +93,18 @@ struct S2 {
|
||||
|
||||
bool bok_is_trivial1 = __is_trivial(int);
|
||||
bool bok_is_trivial2 = __is_trivial(S2);
|
||||
|
||||
bool bok_reference_binds_to_temporary1 = __reference_binds_to_temporary(int&, long&);
|
||||
bool bok_reference_binds_to_temporary2 = __reference_binds_to_temporary(int const &, long&);
|
||||
|
||||
bool b_is_same_as1 = __is_same_as(int, int);
|
||||
bool b_is_same_as2 = __is_same_as(int, float);
|
||||
|
||||
bool b_is_bounded_array1 = __is_bounded_array(int[]);
|
||||
bool b_is_bounded_array2 = __is_bounded_array(int[42]);
|
||||
|
||||
bool b_is_unbounded_array1 = __is_unbounded_array(int[]);
|
||||
bool b_is_unbounded_array2 = __is_unbounded_array(int[42]);
|
||||
|
||||
bool b_is_referenceable1 = __is_referenceable(int);
|
||||
bool b_is_referenceable2 = __is_referenceable(void);
|
||||
|
||||
@@ -125,9 +125,78 @@
|
||||
| clang.cpp:94:24:94:40 | int | | <none> |
|
||||
| clang.cpp:95:24:95:39 | S2 | | <none> |
|
||||
| clang.cpp:95:24:95:39 | __is_trivial | S2 | 0 |
|
||||
| clang.cpp:97:42:97:84 | __reference_binds_to_temporary | int &,long & | 0 |
|
||||
| clang.cpp:97:42:97:84 | int & | | <none> |
|
||||
| clang.cpp:97:42:97:84 | long & | | <none> |
|
||||
| clang.cpp:98:42:98:91 | __reference_binds_to_temporary | const int &,long & | 1 |
|
||||
| clang.cpp:98:42:98:91 | const int & | | <none> |
|
||||
| clang.cpp:98:42:98:91 | long & | | <none> |
|
||||
| clang.cpp:100:22:100:43 | __is_same_as | int,int | 1 |
|
||||
| clang.cpp:100:22:100:43 | int | | <none> |
|
||||
| clang.cpp:100:22:100:43 | int | | <none> |
|
||||
| clang.cpp:101:22:101:45 | __is_same_as | int,float | 0 |
|
||||
| clang.cpp:101:22:101:45 | float | | <none> |
|
||||
| clang.cpp:101:22:101:45 | int | | <none> |
|
||||
| clang.cpp:103:28:103:52 | __is_bounded_array | int[] | 0 |
|
||||
| clang.cpp:103:28:103:52 | int[] | | <none> |
|
||||
| clang.cpp:104:28:104:54 | __is_bounded_array | int[42] | 1 |
|
||||
| clang.cpp:104:28:104:54 | int[42] | | <none> |
|
||||
| clang.cpp:104:51:104:52 | 42 | | 42 |
|
||||
| clang.cpp:104:51:104:52 | (unsigned long)... | | 42 |
|
||||
| clang.cpp:106:30:106:56 | __is_unbounded_array | int[] | 1 |
|
||||
| clang.cpp:106:30:106:56 | int[] | | <none> |
|
||||
| clang.cpp:107:30:107:58 | __is_unbounded_array | int[42] | 0 |
|
||||
| clang.cpp:107:30:107:58 | int[42] | | <none> |
|
||||
| clang.cpp:107:55:107:56 | 42 | | 42 |
|
||||
| clang.cpp:107:55:107:56 | (unsigned long)... | | 42 |
|
||||
| clang.cpp:109:28:109:50 | __is_referenceable | int | 1 |
|
||||
| clang.cpp:109:28:109:50 | int | | <none> |
|
||||
| clang.cpp:110:28:110:51 | __is_referenceable | void | 0 |
|
||||
| clang.cpp:110:28:110:51 | void | | <none> |
|
||||
| file://:0:0:0:0 | 0 | | 0 |
|
||||
| file://:0:0:0:0 | 1 | | 1 |
|
||||
| file://:0:0:0:0 | 2 | | 2 |
|
||||
| gcc.cpp:3:25:3:25 | 8 | | 8 |
|
||||
| gcc.cpp:4:25:4:59 | 0 | | 0 |
|
||||
| gcc.cpp:4:25:4:59 | __builtin_has_attribute | v,0 | 1 |
|
||||
| gcc.cpp:4:49:4:49 | v | | <none> |
|
||||
| gcc.cpp:5:25:5:62 | 0 | | 0 |
|
||||
| gcc.cpp:5:25:5:62 | __builtin_has_attribute | v,0 | 0 |
|
||||
| gcc.cpp:5:49:5:49 | v | | <none> |
|
||||
| gcc.cpp:13:50:13:111 | __builtin_is_pointer_interconvertible_with_class | i | 1 |
|
||||
| gcc.cpp:13:99:13:110 | i | | <none> |
|
||||
| gcc.cpp:14:50:14:111 | __builtin_is_pointer_interconvertible_with_class | d | 0 |
|
||||
| gcc.cpp:14:99:14:110 | d | | <none> |
|
||||
| gcc.cpp:16:35:16:95 | __builtin_is_corresponding_member | i,i | 1 |
|
||||
| gcc.cpp:16:69:16:80 | i | | <none> |
|
||||
| gcc.cpp:16:83:16:94 | i | | <none> |
|
||||
| gcc.cpp:17:35:17:95 | __builtin_is_corresponding_member | i,d | 0 |
|
||||
| gcc.cpp:17:69:17:80 | i | | <none> |
|
||||
| gcc.cpp:17:83:17:94 | d | | <none> |
|
||||
| gcc.cpp:19:34:19:67 | __is_nothrow_convertible | int,int | 1 |
|
||||
| gcc.cpp:19:34:19:67 | int | | <none> |
|
||||
| gcc.cpp:19:34:19:67 | int | | <none> |
|
||||
| gcc.cpp:20:34:20:72 | __is_nothrow_convertible | a_struct,int | 0 |
|
||||
| gcc.cpp:20:34:20:72 | a_struct | | <none> |
|
||||
| gcc.cpp:20:34:20:72 | int | | <none> |
|
||||
| gcc.cpp:22:26:22:51 | __is_convertible | int,int | 1 |
|
||||
| gcc.cpp:22:26:22:51 | int | | <none> |
|
||||
| gcc.cpp:22:26:22:51 | int | | <none> |
|
||||
| gcc.cpp:23:26:23:56 | __is_convertible | a_struct,int | 0 |
|
||||
| gcc.cpp:23:26:23:56 | a_struct | | <none> |
|
||||
| gcc.cpp:23:26:23:56 | int | | <none> |
|
||||
| gcc.cpp:25:47:25:95 | __reference_constructs_from_temporary | int &&,int | 1 |
|
||||
| gcc.cpp:25:47:25:95 | int | | <none> |
|
||||
| gcc.cpp:25:47:25:95 | int && | | <none> |
|
||||
| gcc.cpp:26:47:26:97 | __reference_constructs_from_temporary | int &&,int && | 0 |
|
||||
| gcc.cpp:26:47:26:97 | int && | | <none> |
|
||||
| gcc.cpp:26:47:26:97 | int && | | <none> |
|
||||
| gcc.cpp:28:45:28:91 | (no string representation) | int &&,int | 1 |
|
||||
| gcc.cpp:28:45:28:91 | int | | <none> |
|
||||
| gcc.cpp:28:45:28:91 | int && | | <none> |
|
||||
| gcc.cpp:29:45:29:93 | (no string representation) | int &&,int && | 0 |
|
||||
| gcc.cpp:29:45:29:93 | int && | | <none> |
|
||||
| gcc.cpp:29:45:29:93 | int && | | <none> |
|
||||
| ms.cpp:38:41:38:45 | 0 | | 0 |
|
||||
| ms.cpp:88:27:88:45 | __has_assign | empty | 0 |
|
||||
| ms.cpp:88:27:88:45 | empty | | <none> |
|
||||
@@ -452,3 +521,38 @@
|
||||
| ms.cpp:272:51:272:104 | __is_pointer_interconvertible_base_of | empty,abstract | 0 |
|
||||
| ms.cpp:272:51:272:104 | abstract | | <none> |
|
||||
| ms.cpp:272:51:272:104 | empty | | <none> |
|
||||
| ms.cpp:274:44:274:85 | __is_trivially_copy_assignable | has_assign | 0 |
|
||||
| ms.cpp:274:44:274:85 | has_assign | | <none> |
|
||||
| ms.cpp:275:44:275:78 | __is_trivially_copy_assignable | int | 1 |
|
||||
| ms.cpp:275:44:275:78 | int | | <none> |
|
||||
| ms.cpp:277:51:277:107 | __is_assignable_no_precondition_check | a_struct,a_struct | 1 |
|
||||
| ms.cpp:277:51:277:107 | a_struct | | <none> |
|
||||
| ms.cpp:277:51:277:107 | a_struct | | <none> |
|
||||
| ms.cpp:278:51:278:104 | __is_assignable_no_precondition_check | a_struct,empty | 0 |
|
||||
| ms.cpp:278:51:278:104 | a_struct | | <none> |
|
||||
| ms.cpp:278:51:278:104 | empty | | <none> |
|
||||
| ms.cpp:279:51:279:102 | __is_assignable_no_precondition_check | a_struct,int | 0 |
|
||||
| ms.cpp:279:51:279:102 | a_struct | | <none> |
|
||||
| ms.cpp:279:51:279:102 | int | | <none> |
|
||||
| ms.cpp:281:54:281:117 | __is_pointer_interconvertible_with_class | a_struct,i | 1 |
|
||||
| ms.cpp:281:54:281:117 | a_struct | | <none> |
|
||||
| ms.cpp:281:105:281:116 | i | | <none> |
|
||||
| ms.cpp:282:54:282:117 | __is_pointer_interconvertible_with_class | a_struct,d | 0 |
|
||||
| ms.cpp:282:54:282:117 | a_struct | | <none> |
|
||||
| ms.cpp:282:105:282:116 | d | | <none> |
|
||||
| ms.cpp:284:39:284:111 | __is_corresponding_member | a_struct,a_struct,i,i | 1 |
|
||||
| ms.cpp:284:39:284:111 | a_struct | | <none> |
|
||||
| ms.cpp:284:39:284:111 | a_struct | | <none> |
|
||||
| ms.cpp:284:85:284:96 | i | | <none> |
|
||||
| ms.cpp:284:99:284:110 | i | | <none> |
|
||||
| ms.cpp:285:39:285:111 | __is_corresponding_member | a_struct,a_struct,i,d | 0 |
|
||||
| ms.cpp:285:39:285:111 | a_struct | | <none> |
|
||||
| ms.cpp:285:39:285:111 | a_struct | | <none> |
|
||||
| ms.cpp:285:85:285:96 | i | | <none> |
|
||||
| ms.cpp:285:99:285:110 | d | | <none> |
|
||||
| ms.cpp:287:34:287:59 | __is_valid_winrt_type | int | 1 |
|
||||
| ms.cpp:287:34:287:59 | int | | <none> |
|
||||
| ms.cpp:288:27:288:45 | __is_win_class | int | 0 |
|
||||
| ms.cpp:288:27:288:45 | int | | <none> |
|
||||
| ms.cpp:289:31:289:53 | __is_win_interface | int | 0 |
|
||||
| ms.cpp:289:31:289:53 | int | | <none> |
|
||||
|
||||
29
cpp/ql/test/library-tests/builtins/type_traits/gcc.cpp
Normal file
29
cpp/ql/test/library-tests/builtins/type_traits/gcc.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
// semmle-extractor-options: --gnu_version 130000
|
||||
|
||||
__attribute__ ((aligned(8))) int v;
|
||||
bool b_has_attribute1 = __builtin_has_attribute(v, aligned);
|
||||
bool b_has_attribute2 = __builtin_has_attribute(v, aligned(4));
|
||||
|
||||
|
||||
struct a_struct {
|
||||
int i;
|
||||
double d;
|
||||
};
|
||||
|
||||
bool b_is_pointer_interconvertible_with_class1 = __builtin_is_pointer_interconvertible_with_class(&a_struct::i);
|
||||
bool b_is_pointer_interconvertible_with_class2 = __builtin_is_pointer_interconvertible_with_class(&a_struct::d);
|
||||
|
||||
bool b_is_corresponding_member1 = __builtin_is_corresponding_member(&a_struct::i, &a_struct::i);
|
||||
bool b_is_corresponding_member2 = __builtin_is_corresponding_member(&a_struct::i, &a_struct::d);
|
||||
|
||||
bool b_is_nothrow_convertible1 = __is_nothrow_convertible(int, int);
|
||||
bool b_is_nothrow_convertible2 = __is_nothrow_convertible(a_struct, int);
|
||||
|
||||
bool b_is_convertible1 = __is_convertible(int, int);
|
||||
bool b_is_convertible2 = __is_convertible(a_struct, int);
|
||||
|
||||
bool b_reference_constructs_from_temporary1 = __reference_constructs_from_temporary(int&&, int);
|
||||
bool b_reference_constructs_from_temporary2 = __reference_constructs_from_temporary(int&&, int&&);
|
||||
|
||||
bool b_reference_converts_from_temporary1 = __reference_converts_from_temporary(int&&, int);
|
||||
bool b_reference_converts_from_temporary2 = __reference_converts_from_temporary(int&&, int&&);
|
||||
@@ -270,4 +270,21 @@ void f(void) {
|
||||
|
||||
bool b_is_pointer_interconvertible_base_of1 = __is_pointer_interconvertible_base_of(empty, empty);
|
||||
bool b_is_pointer_interconvertible_base_of2 = __is_pointer_interconvertible_base_of(empty, abstract);
|
||||
|
||||
bool b_is_trivially_copy_assignable1 = __is_trivially_copy_assignable(has_assign);
|
||||
bool b_is_trivially_copy_assignable2 = __is_trivially_copy_assignable(int);
|
||||
|
||||
bool b_is_assignable_no_precondition_check1 = __is_assignable_no_precondition_check(a_struct, a_struct);
|
||||
bool b_is_assignable_no_precondition_check2 = __is_assignable_no_precondition_check(a_struct, empty);
|
||||
bool b_is_assignable_no_precondition_check3 = __is_assignable_no_precondition_check(a_struct, int);
|
||||
|
||||
bool b_is_pointer_interconvertible_with_class1 = __is_pointer_interconvertible_with_class(a_struct, &a_struct::i);
|
||||
bool b_is_pointer_interconvertible_with_class2 = __is_pointer_interconvertible_with_class(a_struct, &a_struct::d);
|
||||
|
||||
bool b_is_corresponding_member1 = __is_corresponding_member(a_struct, a_struct, &a_struct::i, &a_struct::i);
|
||||
bool b_is_corresponding_member2 = __is_corresponding_member(a_struct, a_struct, &a_struct::i, &a_struct::d);
|
||||
|
||||
bool b_is_valid_winrt_type = __is_valid_winrt_type(int);
|
||||
bool b_is_win_class = __is_win_class(int);
|
||||
bool b_is_win_interface = __is_win_interface(int);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user