Skip to content

Commit ce326a0

Browse files
committed
C++: Fix joins.
1 parent 16e53d3 commit ce326a0

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
328328
MetricFunction getMetrics() { result = this }
329329

330330
/** Holds if this function calls the function `f`. */
331+
pragma[nomagic]
331332
predicate calls(Function f) { this.calls(f, _) }
332333

333334
/**

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,13 @@ class Resource extends MemberVariable {
126126
}
127127

128128
private predicate calledFromDestructor(Function f) {
129-
f instanceof Destructor and f.getDeclaringType() = this.getDeclaringType()
129+
pragma[only_bind_into](f) instanceof Destructor and
130+
f.getDeclaringType() = this.getDeclaringType()
130131
or
131-
exists(Function mid, FunctionCall fc |
132+
exists(Function mid |
132133
this.calledFromDestructor(mid) and
133-
fc.getEnclosingFunction() = mid and
134-
fc.getTarget() = f and
135-
f.getDeclaringType() = this.getDeclaringType()
134+
mid.calls(f) and
135+
pragma[only_bind_out](f.getDeclaringType()) = pragma[only_bind_out](this.getDeclaringType())
136136
)
137137
}
138138

0 commit comments

Comments
 (0)