Skip to content

Commit 5559d35

Browse files
committed
C++: Support new builtin operations
1 parent e430aa9 commit 5559d35

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

cpp/ql/lib/semmle/code/cpp/exprs/BuiltInOperations.qll

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,3 +1941,61 @@ class BuiltInOperationIsTriviallyRelocatable extends BuiltInOperation, @istrivia
19411941

19421942
override string getAPrimaryQlClass() { result = "BuiltInOperationIsTriviallyRelocatable" }
19431943
}
1944+
1945+
/**
1946+
* A C++ `__is_bitwise_cloneable` built-in operation.
1947+
*
1948+
* Returns `true` if an object of type `_Tp` is bitwise cloneable.
1949+
*
1950+
* ```
1951+
* template<typename _Tp>
1952+
* struct is_bitwise_cloneable
1953+
* : public integral_constant<bool, __is_bitwise_cloneable(_Tp)>
1954+
* {};
1955+
* ```
1956+
*/
1957+
class BuiltInOperationIsBitwiseCloneable extends BuiltInOperation, @isbitwisecloneable {
1958+
override string toString() { result = "__is_bitwise_cloneable" }
1959+
1960+
override string getAPrimaryQlClass() { result = "BuiltInOperationIsBitwiseCloneable" }
1961+
}
1962+
1963+
/**
1964+
* A C++ `__is_invocable` built-in operation (used by some implementations
1965+
* of the `<type_traits>` header).
1966+
*
1967+
* Returns `true` if a function of type `_FTpn` can be invoked with arguments of
1968+
* type `_Tps`.
1969+
*
1970+
* ```
1971+
* template<typename _FTpn, typename... _Tps>
1972+
* struct is_invocable
1973+
* : public integral_constant<bool, __is_invocable(_FTpn, _Tps...)>
1974+
* {};
1975+
* ```
1976+
*/
1977+
class BuiltInOperationIsInvocable extends BuiltInOperation, @isinvocable {
1978+
override string toString() { result = "__is_invocable" }
1979+
1980+
override string getAPrimaryQlClass() { result = "BuiltInOperationIsInvocable" }
1981+
}
1982+
1983+
/**
1984+
* A C++ `__is_nothrow_invocable` built-in operation (used by some implementations
1985+
* of the `<type_traits>` header).
1986+
*
1987+
* Returns `true` if a function of non-throwing type `_FTpn` can be invoked
1988+
* with arguments of type `_Tps`.
1989+
*
1990+
* ```
1991+
* template<typename _FTpn, typename... _Tps>
1992+
* struct is_nothrow_invocable
1993+
* : public integral_constant<bool, __is_nothrow_invocable(_FTpn, _Tps...)>
1994+
* {};
1995+
* ```
1996+
*/
1997+
class BuiltInOperationIsNothrowInvocable extends BuiltInOperation, @isnothrowinvocable {
1998+
override string toString() { result = "__is_nothrow_invocable" }
1999+
2000+
override string getAPrimaryQlClass() { result = "BuiltInOperationIsNothrowInvocable" }
2001+
}

cpp/ql/lib/semmlecode.cpp.dbscheme

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,6 +1902,9 @@ case @expr.kind of
19021902
| 391 = @nested_requirement
19031903
| 392 = @compound_requirement
19041904
| 393 = @concept_id
1905+
| 394 = @isinvocable
1906+
| 395 = @isnothrowinvocable
1907+
| 396 = @isbitwisecloneable
19051908
;
19061909

19071910
@var_args_expr = @vastartexpr
@@ -2018,6 +2021,9 @@ case @expr.kind of
20182021
| @istriviallyequalitycomparable
20192022
| @isscopedenum
20202023
| @istriviallyrelocatable
2024+
| @isinvocable
2025+
| @isnothrowinvocable
2026+
| @isbitwisecloneable
20212027
;
20222028

20232029
compound_requirement_is_noexcept(

0 commit comments

Comments
 (0)