C++: Add tests for new builtin operations

This commit is contained in:
Jeroen Ketema
2026-01-09 13:35:02 +01:00
parent 3d959abdeb
commit 93535d1c86
3 changed files with 32 additions and 2 deletions

View File

@@ -1,4 +1,4 @@
// semmle-extractor-options: --clang --clang_version 190000
// semmle-extractor-options: --clang --clang_version 210000
struct S {
void f() {}
@@ -121,3 +121,11 @@ bool b_is_scoped_enum2 = __is_scoped_enum(int);
bool b_is_trivially_relocatable1 = __is_trivially_relocatable(int);
bool b_is_trivially_relocatable2 = __is_trivially_relocatable(void);
struct S3{
S3(S3 &);
S3& operator=(S3&);
};
bool bok_is_bitwise_cloneable1 = __is_bitwise_cloneable(int);
bool bok_is_bitwise_cloneable2 = __is_bitwise_cloneable(S3);

View File

@@ -165,6 +165,10 @@
| clang.cpp:122:36:122:66 | int | | <none> |
| clang.cpp:123:36:123:67 | __is_trivially_relocatable | void | 0 |
| clang.cpp:123:36:123:67 | void | | <none> |
| clang.cpp:130:34:130:60 | __is_bitwise_cloneable | int | 1 |
| clang.cpp:130:34:130:60 | int | | <none> |
| clang.cpp:131:34:131:59 | S3 | | <none> |
| clang.cpp:131:34:131:59 | __is_bitwise_cloneable | S3 | 0 |
| file://:0:0:0:0 | 0 | | 0 |
| file://:0:0:0:0 | 0 | | 0 |
| file://:0:0:0:0 | 1 | | 1 |
@@ -211,6 +215,16 @@
| gcc.cpp:29:45:29:93 | __reference_converts_from_temporary | int &&,int && | 0 |
| gcc.cpp:29:45:29:93 | int && | | <none> |
| gcc.cpp:29:45:29:93 | int && | | <none> |
| gcc.cpp:33:24:33:45 | __is_invocable | f_type | 1 |
| gcc.cpp:33:24:33:45 | f_type | | <none> |
| gcc.cpp:34:24:34:51 | __is_invocable | f_type,bool | 0 |
| gcc.cpp:34:24:34:51 | bool | | <none> |
| gcc.cpp:34:24:34:51 | f_type | | <none> |
| gcc.cpp:36:32:36:61 | __is_nothrow_invocable | f_type | 1 |
| gcc.cpp:36:32:36:61 | f_type | | <none> |
| gcc.cpp:37:32:37:67 | __is_nothrow_invocable | f_type,bool | 0 |
| gcc.cpp:37:32:37:67 | bool | | <none> |
| gcc.cpp:37:32:37:67 | f_type | | <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> |

View File

@@ -1,4 +1,4 @@
// semmle-extractor-options: --gnu_version 130000
// semmle-extractor-options: --gnu_version 150000
__attribute__ ((aligned(8))) int v;
bool b_has_attribute1 = __builtin_has_attribute(v, aligned);
@@ -27,3 +27,11 @@ bool b_reference_constructs_from_temporary2 = __reference_constructs_from_tempor
bool b_reference_converts_from_temporary1 = __reference_converts_from_temporary(int&&, int);
bool b_reference_converts_from_temporary2 = __reference_converts_from_temporary(int&&, int&&);
using f_type = void(*)() noexcept;
bool b_is_invocable1 = __is_invocable(f_type);
bool b_is_invocable2 = __is_invocable(f_type, bool);
bool b_is_nothrow_invocable1 = __is_nothrow_invocable(f_type);
bool b_is_nothrow_invocable2 = __is_nothrow_invocable(f_type, bool);