Skip to content

Commit 5efd5d4

Browse files
committed
C++: Do not limit second level scopes to the top-level
1 parent 0e31bf1 commit 5efd5d4

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

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

+2-6
Original file line numberDiff line numberDiff line change
@@ -1614,8 +1614,6 @@ predicate validParameterAliasStep(Node node1, Node node2) {
16141614
)
16151615
}
16161616

1617-
private predicate isTopLevel(Cpp::Stmt s) { any(Function f).getBlock().getAStmt() = s }
1618-
16191617
private Cpp::Stmt getAChainedBranch(Cpp::IfStmt s) {
16201618
result = s.getThen()
16211619
or
@@ -1646,11 +1644,9 @@ private Instruction getAnInstruction(Node n) {
16461644
}
16471645

16481646
private newtype TDataFlowSecondLevelScope =
1649-
TTopLevelIfBranch(Cpp::Stmt s) {
1650-
exists(Cpp::IfStmt ifstmt | s = getAChainedBranch(ifstmt) and isTopLevel(ifstmt))
1651-
} or
1647+
TTopLevelIfBranch(Cpp::Stmt s) { exists(Cpp::IfStmt ifstmt | s = getAChainedBranch(ifstmt)) } or
16521648
TTopLevelSwitchCase(Cpp::SwitchCase s) {
1653-
exists(Cpp::SwitchStmt switchstmt | s = switchstmt.getASwitchCase() and isTopLevel(switchstmt))
1649+
exists(Cpp::SwitchStmt switchstmt | s = switchstmt.getASwitchCase())
16541650
}
16551651

16561652
/**

0 commit comments

Comments
 (0)