Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13c45b6

Browse files
author
Robert Marsh
committed
C++: remove unnecessary parameter in FlowVar.qll
1 parent c8cdf68 commit 13c45b6

1 file changed

Lines changed: 11 additions & 14 deletions

File tree

  • cpp/ql/src/semmle/code/cpp/dataflow/internal

cpp/ql/src/semmle/code/cpp/dataflow/internal/FlowVar.qll

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ module FlowVar_internal {
240240
(
241241
initializer(v, sbb.getANode())
242242
or
243-
assignmentLikeOperation(sbb, v, _, _)
243+
assignmentLikeOperation(sbb, v, _)
244244
or
245245
exists(PartialDefinition p | p.partiallyDefinesVariableAt(v, sbb))
246246
or
@@ -359,7 +359,7 @@ module FlowVar_internal {
359359
}
360360

361361
override predicate definedByExpr(Expr e, ControlFlowNode node) {
362-
assignmentLikeOperation(node, v, _, e) and
362+
assignmentLikeOperation(node, v, e) and
363363
node = sbb
364364
or
365365
// We pick the defining `ControlFlowNode` of an `Initializer` to be its
@@ -449,7 +449,7 @@ module FlowVar_internal {
449449
pragma[noinline]
450450
private Variable getAVariableAssignedInLoop() {
451451
exists(BasicBlock bbAssign |
452-
assignmentLikeOperation(bbAssign.getANode(), result, _, _) and
452+
assignmentLikeOperation(bbAssign.getANode(), result, _) and
453453
this.bbInLoop(bbAssign)
454454
)
455455
}
@@ -487,7 +487,7 @@ module FlowVar_internal {
487487

488488
pragma[noinline]
489489
private predicate assignsToVar(BasicBlock bb, Variable v) {
490-
assignmentLikeOperation(bb.getANode(), v, _, _) and
490+
assignmentLikeOperation(bb.getANode(), v, _) and
491491
exists(AlwaysTrueUponEntryLoop loop | v = loop.getARelevantVariable())
492492
}
493493

@@ -524,7 +524,7 @@ module FlowVar_internal {
524524
result = mid.getASuccessor() and
525525
variableLiveInSBB(result, v) and
526526
forall(AlwaysTrueUponEntryLoop loop | skipLoop(mid, result, v, loop) | loop.sbbInLoop(sbbDef)) and
527-
not assignmentLikeOperation(result, v, _, _)
527+
not assignmentLikeOperation(result, v, _)
528528
)
529529
}
530530

@@ -566,7 +566,7 @@ module FlowVar_internal {
566566
* Holds if liveness of `v` should stop propagating backwards from `sbb`.
567567
*/
568568
private predicate variableNotLiveBefore(SubBasicBlock sbb, Variable v) {
569-
assignmentLikeOperation(sbb, v, _, _)
569+
assignmentLikeOperation(sbb, v, _)
570570
or
571571
// Liveness of `v` is killed when going backwards from a block that declares it
572572
exists(DeclStmt ds | ds.getADeclaration().(LocalVariable) = v and sbb.contains(ds))
@@ -687,20 +687,18 @@ module FlowVar_internal {
687687
* predicate.
688688
*/
689689
predicate assignmentLikeOperation(
690-
ControlFlowNode node, Variable v, VariableAccess va, Expr assignedExpr
690+
ControlFlowNode node, Variable v, Expr assignedExpr
691691
) {
692692
// Together, the two following cases cover `Assignment`
693693
node =
694694
any(AssignExpr ae |
695-
va = ae.getLValue() and
696-
v = va.getTarget() and
695+
v.getAnAccess() = ae.getLValue() and
697696
assignedExpr = ae.getRValue()
698697
)
699698
or
700699
node =
701700
any(AssignOperation ao |
702-
va = ao.getLValue() and
703-
v = va.getTarget() and
701+
v.getAnAccess() = ao.getLValue() and
704702
// Here and in the `PrefixCrementOperation` case, we say that the assigned
705703
// expression is the operation itself. For example, we say that `x += 1`
706704
// assigns `x += 1` to `x`. The justification is that after this operation,
@@ -712,8 +710,7 @@ module FlowVar_internal {
712710
// `PrefixCrementOperation` is itself a source
713711
node =
714712
any(CrementOperation op |
715-
va = op.getOperand() and
716-
v = va.getTarget() and
713+
v.getAnAccess() = op.getOperand() and
717714
assignedExpr = op
718715
)
719716
}
@@ -749,7 +746,7 @@ module FlowVar_internal {
749746
class DataFlowSubBasicBlockCutNode extends SubBasicBlockCutNode {
750747
DataFlowSubBasicBlockCutNode() {
751748
exists(Variable v | not fullySupportedSsaVariable(v) |
752-
assignmentLikeOperation(this, v, _, _)
749+
assignmentLikeOperation(this, v, _)
753750
or
754751
exists(PartialDefinition p | p.partiallyDefinesVariableAt(v, this))
755752
// It is not necessary to cut the basic blocks at `Initializer` nodes

0 commit comments

Comments
 (0)