Skip to content

Commit 9471134

Browse files
authored
Merge pull request #2417 from jbj/enclosing-reeval
C++: Prevent cached stages from being re-evaluated
2 parents ca1b91a + 0e4ed1c commit 9471134

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Element stmtEnclosingElement(Stmt s) {
1313
/**
1414
* Gets the enclosing element of expression `e`.
1515
*/
16+
// The `pragma[nomagic]` is a workaround to prevent this cached stage (and all
17+
// subsequent stages) from being evaluated twice. See QL-888. It has the effect
18+
// of making the `Conversion` class predicate get the same optimization in all
19+
// queries.
20+
pragma[nomagic]
1621
cached
1722
Element exprEnclosingElement(Expr e) {
1823
result = exprEnclosingElement(e.getParent())

0 commit comments

Comments
 (0)