File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed
csharp/ql/test/library-tests/standalone/controlflow Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ // semmle-extractor-options: --standalone
2+
3+ using System ;
4+
5+ class Cfg
6+ {
7+ void F ( )
8+ {
9+ var v = new InvalidType ( ) ;
10+ Debug . Assert ( v . a . b , "This is true" ) ;
11+
12+ new CounterCreationData ( ) { CounterHelp = string . Empty , CounterType = v . Type } ;
13+ }
14+ }
Original file line number Diff line number Diff line change 1+ | ControlFlow.cs:7:10:7:10 | enter F | ControlFlow.cs:8:5:13:5 | {...} |
2+ | ControlFlow.cs:8:5:13:5 | {...} | ControlFlow.cs:9:9:9:34 | ... ...; |
3+ | ControlFlow.cs:9:9:9:34 | ... ...; | ControlFlow.cs:9:13:9:13 | access to local variable v |
4+ | ControlFlow.cs:10:9:10:13 | Expression | ControlFlow.cs:10:22:10:22 | access to local variable v |
5+ | ControlFlow.cs:10:9:10:43 | Call to unknown method | ControlFlow.cs:12:9:12:87 | ...; |
6+ | ControlFlow.cs:10:9:10:44 | ...; | ControlFlow.cs:10:9:10:13 | Expression |
7+ | ControlFlow.cs:10:22:10:22 | access to local variable v | ControlFlow.cs:10:22:10:24 | Expression |
8+ | ControlFlow.cs:10:22:10:24 | Expression | ControlFlow.cs:10:22:10:26 | Expression |
9+ | ControlFlow.cs:10:22:10:26 | Expression | ControlFlow.cs:10:29:10:42 | "This is true" |
10+ | ControlFlow.cs:10:29:10:42 | "This is true" | ControlFlow.cs:10:9:10:43 | Call to unknown method |
11+ | ControlFlow.cs:12:35:12:86 | { ..., ... } | ControlFlow.cs:7:10:7:10 | exit F |
12+ | ControlFlow.cs:12:37:12:47 | Expression | ControlFlow.cs:12:51:12:62 | access to field Empty |
13+ | ControlFlow.cs:12:37:12:62 | ... = ... | ControlFlow.cs:12:65:12:75 | Expression |
14+ | ControlFlow.cs:12:51:12:62 | access to field Empty | ControlFlow.cs:12:37:12:62 | ... = ... |
15+ | ControlFlow.cs:12:65:12:75 | Expression | ControlFlow.cs:12:79:12:79 | access to local variable v |
16+ | ControlFlow.cs:12:65:12:84 | ... = ... | ControlFlow.cs:12:35:12:86 | { ..., ... } |
17+ | ControlFlow.cs:12:79:12:79 | access to local variable v | ControlFlow.cs:12:79:12:84 | Expression |
18+ | ControlFlow.cs:12:79:12:84 | Expression | ControlFlow.cs:12:65:12:84 | ... = ... |
Original file line number Diff line number Diff line change 1+ import csharp
2+ import semmle.code.csharp.controlflow.ControlFlowGraph
3+
4+ /**
5+ * A method call where the target is unknown.
6+ * The purpose of this is to ensure that all MethodCall expressions
7+ * have a valid `toString()`.
8+ */
9+ class UnknownCall extends MethodCall
10+ {
11+ UnknownCall ( ) { not exists ( this .getTarget ( ) ) }
12+
13+ override string toString ( ) { result = "Call to unknown method" }
14+ }
15+
16+ query predicate edges ( ControlFlowNode n1 , ControlFlowNode n2 ) {
17+ n2 = n1 .getASuccessor ( )
18+ }
You can’t perform that action at this time.
0 commit comments