Skip to content

Commit 7ff6f09

Browse files
committed
C++: Improve the QL doc of isConstant
1 parent 5950865 commit 7ff6f09

File tree

1 file changed

+13
-1
lines changed
  • cpp/ql/lib/semmle/code/cpp/exprs

1 file changed

+13
-1
lines changed

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,19 @@ class Expr extends StmtParent, @expr {
152152
else result = this.getValue()
153153
}
154154

155-
/** Holds if this expression has a value that can be determined at compile time. */
155+
/**
156+
* Holds if this expression has a value that can be determined at compile time.
157+
*
158+
* An expression has a value that can be determined at compile time when:
159+
* - it is a compile-time constant, e.g., a literal value or the result of a constexpr
160+
* compile-time constant;
161+
* - it is an address of a (member) function, an address of a constexpr variable
162+
* initialized to a constant address, or an address of an lvalue, or any of the
163+
* previous with a constant value added to or subtracted from the address;
164+
* - it is a reference to a (member) function, a reference to a constexpr variable
165+
* initialized to a constant address, or a reference to an lvalue;
166+
* - it is a non-template parameter of a uninstantiated template.
167+
*/
156168
cached
157169
predicate isConstant() {
158170
valuebind(_, underlyingElement(this))

0 commit comments

Comments
 (0)