mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
C#: Generic control flow graph splitting
Refactor existing logic for splitting control flow nodes belonging to a `finally` block. A `Split` defines (1) when to enter the split, (2) when to stay in the split, and (3) when to leave the split. With only these definitions, control flow splitting is achieved by tagging each control flow element with the set of splits that apply to it.
This commit is contained in:
@@ -123,11 +123,6 @@ class Completion extends TCompletion {
|
||||
this instanceof NormalCompletion or
|
||||
this instanceof ContinueCompletion
|
||||
}
|
||||
|
||||
/** Holds if this completion is a valid completion for exiting a callable. */
|
||||
predicate isValidCallableExitCompletion() {
|
||||
not this instanceof GotoCompletion
|
||||
}
|
||||
}
|
||||
|
||||
/** Holds if expression `e` has the Boolean constant value `value`. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,19 @@
|
||||
import csharp
|
||||
import semmle.code.csharp.controlflow.ControlFlowGraph
|
||||
import Internal
|
||||
|
||||
from FinallySplitControlFlowNode f
|
||||
class MyFinallySplitControlFlowNode extends ControlFlowElementNode {
|
||||
MyFinallySplitControlFlowNode() {
|
||||
exists(FinallySplitting::FinallySplitType type |
|
||||
type = this.getASplit().(FinallySplit).getType() |
|
||||
not type instanceof ControlFlowEdgeSuccessor
|
||||
)
|
||||
}
|
||||
|
||||
TryStmt getTryStmt() {
|
||||
this.getElement() = FinallySplitting::getAFinallyDescendant(result)
|
||||
}
|
||||
}
|
||||
|
||||
from MyFinallySplitControlFlowNode f
|
||||
select f.getTryStmt(), f
|
||||
|
||||
Reference in New Issue
Block a user