Skip to content

Commit 5a6b94e

Browse files
committed
C++: Respond to PR reviews.
1 parent 0d1e061 commit 5a6b94e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -918,11 +918,12 @@ IRBlock getBasicBlock(Node node) {
918918
*/
919919
pragma[nomagic]
920920
int getAdditionalFlowIntoCallNodeTerm(ArgumentNode arg, ParameterNode p) {
921-
exists(ParameterNode switchee, ConditionOperand op, DataFlowCall call |
921+
exists(ParameterNode switchee, SwitchInstruction switch, ConditionOperand op, DataFlowCall call |
922922
viableParamArg(call, p, arg) and
923923
viableParamArg(call, switchee, _) and
924+
switch.getExpressionOperand() = op and
924925
valueNumber(switchee.asInstruction()).getAUse() = op and
925-
result = countNumberOfBranchesUsingParameter(op, p)
926+
result = countNumberOfBranchesUsingParameter(switch, p)
926927
)
927928
}
928929

@@ -954,9 +955,8 @@ private EdgeKind caseOrDefaultEdge() {
954955
/**
955956
* Gets the number of switch branches that that read from (or write to) the parameter `p`.
956957
*/
957-
int countNumberOfBranchesUsingParameter(ConditionOperand op, ParameterNode p) {
958-
exists(SwitchInstruction switch, Ssa::SourceVariable sv |
959-
switch.getExpressionOperand() = op and
958+
int countNumberOfBranchesUsingParameter(SwitchInstruction switch, ParameterNode p) {
959+
exists(Ssa::SourceVariable sv |
960960
parameterNodeHasSourceVariable(p, sv) and
961961
// Count the number of cases that use the parameter. We do this by finding the phi node
962962
// that merges the uses/defs of the parameter. There might be multiple such phi nodes, so

0 commit comments

Comments
 (0)