Skip to content

Commit 5db069e

Browse files
committed
C++: Fix more consistency errors.
1 parent 9247e6a commit 5db069e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,7 +1687,9 @@ private class IndirectInstructionParameterNode extends AbstractIndirectParameter
16871687
InitializeParameterInstruction init;
16881688

16891689
IndirectInstructionParameterNode() {
1690-
IndirectInstruction.super.hasInstructionAndIndirectionIndex(init, _)
1690+
IndirectInstruction.super.hasInstructionAndIndirectionIndex(init, _) and
1691+
// We don't model catch parameters as parameter nodes
1692+
not exists(init.getParameter().getCatchBlock())
16911693
}
16921694

16931695
int getArgumentIndex() { init.hasIndex(result) }
@@ -1759,7 +1761,10 @@ abstract private class AbstractExplicitParameterNode extends AbstractDirectParam
17591761
private class ExplicitParameterInstructionNode extends AbstractExplicitParameterNode,
17601762
InstructionDirectParameterNode
17611763
{
1762-
ExplicitParameterInstructionNode() { exists(instr.getParameter()) }
1764+
ExplicitParameterInstructionNode() {
1765+
// We don't model catch parameters as parameter nodes.
1766+
exists(instr.getParameter().getFunction())
1767+
}
17631768

17641769
override string toStringImpl() { result = instr.getParameter().toString() }
17651770
}

cpp/ql/test/library-tests/syntax-zoo/dataflow-ir-consistency.expected

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ postWithInFlow
2929
| try_catch.cpp:7:8:7:8 | call to exception | PostUpdateNode should not be the target of local flow. |
3030
viableImplInCallContextTooLarge
3131
uniqueParameterNodeAtPosition
32-
| ir.cpp:726:6:726:13 | TryCatch | *0 | ir.cpp:737:22:737:22 | *s | Parameters with overlapping positions. |
33-
| ir.cpp:726:6:726:13 | TryCatch | *0 | ir.cpp:740:24:740:24 | *e | Parameters with overlapping positions. |
3432
uniqueParameterNodePosition
3533
uniqueContentApprox
3634
identityLocalStep

0 commit comments

Comments
 (0)