File tree Expand file tree Collapse file tree 5 files changed +76
-0
lines changed
semmle/code/csharp/interproccontrolflow Expand file tree Collapse file tree 5 files changed +76
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ dependencies:
15
15
codeql/tutorial : ${workspace}
16
16
codeql/util : ${workspace}
17
17
codeql/xml : ${workspace}
18
+ codeql/global-controlflow : ${workspace}
18
19
dataExtensions :
19
20
- ext/*.model.yml
20
21
- ext/generated/*.model.yml
Original file line number Diff line number Diff line change
1
+ import csharp
2
+
3
+ /**
4
+ * Provides classes for performing global (inter-procedural) control flow analyses.
5
+ */
6
+ module ControlFlow {
7
+ private import internal.ControlFlowSpecific
8
+ private import codeql.globalcontrolflow.ControlFlow
9
+ import ControlFlowMake< Location , CSharpControlFlow >
10
+ import Public
11
+ }
Original file line number Diff line number Diff line change
1
+ private import csharp as CS
2
+ private import ControlFlowPublic
3
+
4
+ predicate edge ( Node n1 , Node n2 ) { n1 .getASuccessor ( ) = n2 }
5
+
6
+ predicate callTarget ( CallNode call , Callable target ) { call .getARuntimeTarget ( ) = target }
7
+
8
+ predicate flowEntry ( Callable c , Node entry ) {
9
+ entry .( CS:: ControlFlow:: Nodes:: EntryNode ) .getCallable ( ) = c
10
+ }
11
+
12
+ predicate flowExit ( Callable c , Node exitNode ) {
13
+ exitNode .( CS:: ControlFlow:: Nodes:: ExitNode ) .getCallable ( ) = c
14
+ }
15
+
16
+ Callable getEnclosingCallable ( Node n ) { n .getEnclosingCallable ( ) = result }
17
+
18
+ predicate hiddenNode ( Node n ) { none ( ) }
19
+
20
+ private newtype TSplit = TNone ( ) { none ( ) }
21
+
22
+ class Split extends TSplit {
23
+ abstract string toString ( ) ;
24
+
25
+ abstract CS:: Location getLocation ( ) ;
26
+
27
+ abstract predicate entry ( Node n1 , Node n2 ) ;
28
+
29
+ abstract predicate exit ( Node n1 , Node n2 ) ;
30
+
31
+ abstract predicate blocked ( Node n1 , Node n2 ) ;
32
+ }
Original file line number Diff line number Diff line change
1
+ private import csharp as CS
2
+
3
+ class Node extends CS:: ControlFlow:: Node { }
4
+
5
+ class CallNode extends Node {
6
+ CS:: Call call ;
7
+
8
+ CallNode ( ) { call = super .getAstNode ( ) }
9
+
10
+ Callable getARuntimeTarget ( ) { result = call .getARuntimeTarget ( ) }
11
+ }
12
+
13
+ class Callable = CS:: Callable ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides C#-specific definitions for use in the control-flow library.
3
+ */
4
+
5
+ private import csharp
6
+ private import codeql.globalcontrolflow.ControlFlow
7
+
8
+ module Private {
9
+ import ControlFlowPrivate
10
+ }
11
+
12
+ module Public {
13
+ import ControlFlowPublic
14
+ }
15
+
16
+ module CSharpControlFlow implements InputSig< Location > {
17
+ import Private
18
+ import Public
19
+ }
You can’t perform that action at this time.
0 commit comments