Skip to content

Commit 762c977

Browse files
author
Robert Marsh
authored
Merge pull request #1326 from jbj/addressConstantVariable-isConstexpr
C++: Use isConstexpr instead of workaround in AddressConstantExpr
2 parents 5f77ac4 + f38253d commit 762c977

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

cpp/ql/src/semmle/code/cpp/internal/AddressConstantExpression.qll

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
private import cpp
2-
private import semmle.code.cpp.dataflow.EscapesTree
32

43
predicate addressConstantExpression(Expr e) {
54
constantAddressPointer(e)
@@ -14,10 +13,7 @@ predicate addressConstantExpression(Expr e) {
1413
/** Holds if `v` is a constexpr variable initialized to a constant address. */
1514
private predicate addressConstantVariable(Variable v) {
1615
addressConstantExpression(v.getInitializer().getExpr().getFullyConverted()) and
17-
// Here we should also require that `v` is constexpr, but we don't have that
18-
// information in the db. See CPP-314. Instead, we require that the variable
19-
// is never defined except in its initializer.
20-
forall(Expr def | definition(v, def) | def = any(Initializer init).getExpr())
16+
v.isConstexpr()
2117
}
2218

2319
/**

0 commit comments

Comments
 (0)