Skip to content

Commit af3f855

Browse files
authored
Merge pull request #94 from hvitved/csharp/cfg/minor-fixes
C#: Minor CFG improvements
2 parents 4dec7c5 + 1dff900 commit af3f855

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

csharp/ql/src/semmle/code/csharp/controlflow/ControlFlowGraph.qll

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1714,7 +1714,13 @@ module Internal {
17141714
exists(TryStmt ts |
17151715
ts = last.getTryStmt() and
17161716
exists(lastTryStmtBlock(ts, c)) and
1717-
not ts.definitelyHandles(c.getExceptionClass(), _) and
1717+
not ts.getACatchClause() instanceof GeneralCatchClause and
1718+
forall(SpecificCatchClause scc |
1719+
scc = ts.getACatchClause() |
1720+
scc.hasFilterClause()
1721+
or
1722+
not c.getExceptionClass().getABaseType*() = scc.getCaughtExceptionType()
1723+
) and
17181724
last.isLast()
17191725
)
17201726
}
@@ -2967,6 +2973,11 @@ module Internal {
29672973

29682974
/** Provides logic for calculating reachable control flow nodes. */
29692975
module Reachability {
2976+
/**
2977+
* Holds if `cfe` is a control flow element where the set of possible splits may
2978+
* be different from the set of possible splits for one of `cfe`'s predecessors.
2979+
* That is, `cfe` starts a new block of elements with the same set of splits.
2980+
*/
29702981
private predicate startsSplits(ControlFlowElement cfe) {
29712982
cfe = succEntry(_)
29722983
or

0 commit comments

Comments
 (0)