From 3d959abdeb489e187532af72da0ccf7e1f3a24f9 Mon Sep 17 00:00:00 2001 From: Jeroen Ketema Date: Fri, 9 Jan 2026 13:31:23 +0100 Subject: [PATCH] C++: Support new builtin operations --- .../code/cpp/exprs/BuiltInOperations.qll | 58 +++++++++++++++++++ cpp/ql/lib/semmlecode.cpp.dbscheme | 6 ++ 2 files changed, 64 insertions(+) diff --git a/cpp/ql/lib/semmle/code/cpp/exprs/BuiltInOperations.qll b/cpp/ql/lib/semmle/code/cpp/exprs/BuiltInOperations.qll index dc55bcda9e6..2246a887b9c 100644 --- a/cpp/ql/lib/semmle/code/cpp/exprs/BuiltInOperations.qll +++ b/cpp/ql/lib/semmle/code/cpp/exprs/BuiltInOperations.qll @@ -1941,3 +1941,61 @@ class BuiltInOperationIsTriviallyRelocatable extends BuiltInOperation, @istrivia override string getAPrimaryQlClass() { result = "BuiltInOperationIsTriviallyRelocatable" } } + +/** + * A C++ `__is_bitwise_cloneable` built-in operation. + * + * Returns `true` if an object of type `_Tp` is bitwise cloneable. + * + * ``` + * template + * struct is_bitwise_cloneable + * : public integral_constant + * {}; + * ``` + */ +class BuiltInOperationIsBitwiseCloneable extends BuiltInOperation, @isbitwisecloneable { + override string toString() { result = "__is_bitwise_cloneable" } + + override string getAPrimaryQlClass() { result = "BuiltInOperationIsBitwiseCloneable" } +} + +/** + * A C++ `__is_invocable` built-in operation (used by some implementations + * of the `` header). + * + * Returns `true` if a function of type `_FTpn` can be invoked with arguments of + * type `_Tps`. + * + * ``` + * template + * struct is_invocable + * : public integral_constant + * {}; + * ``` + */ +class BuiltInOperationIsInvocable extends BuiltInOperation, @isinvocable { + override string toString() { result = "__is_invocable" } + + override string getAPrimaryQlClass() { result = "BuiltInOperationIsInvocable" } +} + +/** + * A C++ `__is_nothrow_invocable` built-in operation (used by some implementations + * of the `` header). + * + * Returns `true` if a function of non-throwing type `_FTpn` can be invoked + * with arguments of type `_Tps`. + * + * ``` + * template + * struct is_nothrow_invocable + * : public integral_constant + * {}; + * ``` + */ +class BuiltInOperationIsNothrowInvocable extends BuiltInOperation, @isnothrowinvocable { + override string toString() { result = "__is_nothrow_invocable" } + + override string getAPrimaryQlClass() { result = "BuiltInOperationIsNothrowInvocable" } +} diff --git a/cpp/ql/lib/semmlecode.cpp.dbscheme b/cpp/ql/lib/semmlecode.cpp.dbscheme index d2d611b3fdc..2f1916a4c9b 100644 --- a/cpp/ql/lib/semmlecode.cpp.dbscheme +++ b/cpp/ql/lib/semmlecode.cpp.dbscheme @@ -1902,6 +1902,9 @@ case @expr.kind of | 391 = @nested_requirement | 392 = @compound_requirement | 393 = @concept_id +| 394 = @isinvocable +| 395 = @isnothrowinvocable +| 396 = @isbitwisecloneable ; @var_args_expr = @vastartexpr @@ -2018,6 +2021,9 @@ case @expr.kind of | @istriviallyequalitycomparable | @isscopedenum | @istriviallyrelocatable + | @isinvocable + | @isnothrowinvocable + | @isbitwisecloneable ; compound_requirement_is_noexcept(