Skip to content

Commit a3f806b

Browse files
committed
Use GVN in AV rule 79.
1 parent fbbec5d commit a3f806b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cpp/ql/src/jsf/4.10 Classes/AV Rule 79.ql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import cpp
1515
import Critical.NewDelete
16+
import semmle.code.cpp.valuenumbering.GlobalValueNumbering
1617

1718
/**
1819
* An expression that acquires a resource, and the kind of resource that is acquired. The
@@ -101,7 +102,7 @@ private predicate exprReleases(Expr e, Expr released, string kind) {
101102
exprReleases(_, exprOrDereference(f.getParameter(arg).getAnAccess()), kind)
102103
)
103104
or
104-
exists(Function f, ThisExpr innerThis |
105+
exists(Function f, ThisExpr innerThis, Expr likeInnerThis |
105106
// `e` is a call to a method that releases `this`, and `released`
106107
// is the object that is called
107108
(
@@ -110,7 +111,8 @@ private predicate exprReleases(Expr e, Expr released, string kind) {
110111
) and
111112
e.(FunctionCall).getQualifier() = exprOrDereference(released) and
112113
innerThis.getEnclosingFunction() = f and
113-
exprReleases(_, innerThis, kind)
114+
globalValueNumber(innerThis) = globalValueNumber(likeInnerThis) and
115+
exprReleases(_, likeInnerThis, kind)
114116
)
115117
}
116118

0 commit comments

Comments
 (0)