Skip to content

Commit 463547f

Browse files
authored
Merge pull request #1581 from jbj/revert-noTarget-workaround
Revert "C++: Work around extractor issue CPP-383"
2 parents 59964bd + ee5eaef commit 463547f

File tree

1 file changed

+1
-34
lines changed

1 file changed

+1
-34
lines changed

cpp/ql/src/semmle/code/cpp/controlflow/internal/ConstantExprs.qll

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -107,42 +107,9 @@ private predicate loopConditionAlwaysUponEntry(ControlFlowNode loop, Expr condit
107107
)
108108
}
109109

110-
/**
111-
* This relation is the same as the `el instanceof Function`, only obfuscated
112-
* so the optimizer will not understand that any `FunctionCall.getTarget()`
113-
* should be in this relation.
114-
*/
115-
pragma[noinline]
116-
private predicate isFunction(Element el) {
117-
el instanceof Function
118-
or
119-
el.(Expr).getParent() = el
120-
}
121-
122-
/**
123-
* Holds if `fc` is a `FunctionCall` with no return value for `getTarget`. This
124-
* can happen due to extractor issue CPP-383.
125-
*/
126-
pragma[noopt]
127-
private predicate callHasNoTarget(@funbindexpr fc) {
128-
exists(Function f |
129-
funbind(fc, f) and
130-
not isFunction(f)
131-
)
132-
}
133-
134-
// This base case is pulled out to work around QL-796
135-
private predicate potentiallyReturningFunctionCall_base(FunctionCall fc) {
136-
fc.isVirtual()
137-
or
138-
callHasNoTarget(fc)
139-
}
140-
141110
/** A function call that *may* return; if in doubt, we assume it may. */
142111
private predicate potentiallyReturningFunctionCall(FunctionCall fc) {
143-
potentiallyReturningFunctionCall_base(fc)
144-
or
145-
potentiallyReturningFunction(fc.getTarget())
112+
potentiallyReturningFunction(fc.getTarget()) or fc.isVirtual()
146113
}
147114

148115
/** A function that *may* return; if in doubt, we assume it may. */

0 commit comments

Comments
 (0)