Skip to content

Commit 5b29a49

Browse files
author
Matthew Gretton-Dann
committed
C++: Add library support for consteval
1 parent 29a5ea1 commit 5b29a49

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

cpp/ql/src/semmle/code/cpp/Function.qll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
103103

104104
/**
105105
* Holds if this function is declared to be `constexpr`.
106+
*
107+
* Note that this does not hold if the function has been declared
108+
* `consteval`.
106109
*/
107110
predicate isDeclaredConstexpr() { this.hasSpecifier("declared_constexpr") }
108111

@@ -115,9 +118,16 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
115118
* template <typename T> constexpr int g(T x) { return f(x); }
116119
* ```
117120
* `g<int>` is declared constexpr, but is not constexpr.
121+
*
122+
* Will also hold if this function is `consteval`.
118123
*/
119124
predicate isConstexpr() { this.hasSpecifier("is_constexpr") }
120125

126+
/**
127+
* Holds if this function is declared to be `consteval`.
128+
*/
129+
predicate isConsteval() { this.hasSpecifier("is_consteval") }
130+
121131
/**
122132
* Holds if this function is declared with `__attribute__((naked))` or
123133
* `__declspec(naked)`.

0 commit comments

Comments
 (0)