Files
codeql/csharp/ql/test/library-tests/controlflow/graph/BooleanNode.expected
Tom Hvitved 5ce9b25ec9 C#: Improve CFG for assignments
Write accesses in assignments, such as the access to `x` in `x = 0` are not
evaluated, so they should not have entries in the control flow graph. However,
qualifiers (and indexer arguments) should still be evaluated, for example in

```
x.Foo.Bar = 0;
```

the CFG should be `x --> x.Foo --> 0 --> x.Foo.Bar = 0` (as opposed to
`x --> x.Foo --> x.Foo.Bar --> 0 --> x.Foo.Bar = 0`, prior to this change).

A special case is assignments via acessors (properties, indexers, and event
adders), where we do want to include the access in the control flow graph,
as it represents the accessor call:

```
x.Prop = 0;
```

But instead of `x --> x.set_Prop --> 0 --> x.Prop = 0` the CFG should be
`x --> 0 --> x.set_Prop --> x.Prop = 0`, as the setter is called *after* the
assigned value has been evaluated.

An even more special case is tuple assignments via accessors:

```
(x.Prop1, y.Prop2) = (0, 1);
```

Here the CFG should be
`x --> y --> 0 --> 1 --> x.set_Prop1 --> y.set_Prop2 --> (x.Prop1, y.Prop2) = (0, 1)`.
2019-02-16 19:19:24 +01:00

162 lines
16 KiB
Plaintext

| Field1 (line 129): false | Conditions.cs:131:16:131:19 | [Field1 (line 129): false] true |
| Field1 (line 129): false | Conditions.cs:132:9:140:9 | [Field1 (line 129): false] {...} |
| Field1 (line 129): false | Conditions.cs:133:13:139:13 | [Field1 (line 129): false] if (...) ... |
| Field1 (line 129): false | Conditions.cs:133:17:133:22 | [Field1 (line 129): false] access to field Field1 |
| Field1 (line 129): false | Conditions.cs:133:17:133:22 | [Field1 (line 129): false] this access |
| Field1 (line 129): true | Conditions.cs:131:16:131:19 | [Field1 (line 129): true, Field2 (line 129): false] true |
| Field1 (line 129): true | Conditions.cs:131:16:131:19 | [Field1 (line 129): true, Field2 (line 129): true] true |
| Field1 (line 129): true | Conditions.cs:132:9:140:9 | [Field1 (line 129): true, Field2 (line 129): false] {...} |
| Field1 (line 129): true | Conditions.cs:132:9:140:9 | [Field1 (line 129): true, Field2 (line 129): true] {...} |
| Field1 (line 129): true | Conditions.cs:133:13:139:13 | [Field1 (line 129): true, Field2 (line 129): false] if (...) ... |
| Field1 (line 129): true | Conditions.cs:133:13:139:13 | [Field1 (line 129): true, Field2 (line 129): true] if (...) ... |
| Field1 (line 129): true | Conditions.cs:133:17:133:22 | [Field1 (line 129): true, Field2 (line 129): false] access to field Field1 |
| Field1 (line 129): true | Conditions.cs:133:17:133:22 | [Field1 (line 129): true, Field2 (line 129): false] this access |
| Field1 (line 129): true | Conditions.cs:133:17:133:22 | [Field1 (line 129): true, Field2 (line 129): true] access to field Field1 |
| Field1 (line 129): true | Conditions.cs:133:17:133:22 | [Field1 (line 129): true, Field2 (line 129): true] this access |
| Field1 (line 129): true | Conditions.cs:134:13:139:13 | [Field1 (line 129): true, Field2 (line 129): false] {...} |
| Field1 (line 129): true | Conditions.cs:134:13:139:13 | [Field1 (line 129): true, Field2 (line 129): true] {...} |
| Field1 (line 129): true | Conditions.cs:134:13:139:13 | [Field1 (line 129): true] {...} |
| Field1 (line 129): true | Conditions.cs:135:17:138:17 | [Field1 (line 129): true, Field2 (line 129): false] if (...) ... |
| Field1 (line 129): true | Conditions.cs:135:17:138:17 | [Field1 (line 129): true, Field2 (line 129): true] if (...) ... |
| Field1 (line 129): true | Conditions.cs:135:17:138:17 | [Field1 (line 129): true] if (...) ... |
| Field1 (line 129): true | Conditions.cs:135:21:135:26 | [Field1 (line 129): true, Field2 (line 129): false] access to field Field2 |
| Field1 (line 129): true | Conditions.cs:135:21:135:26 | [Field1 (line 129): true, Field2 (line 129): false] this access |
| Field1 (line 129): true | Conditions.cs:135:21:135:26 | [Field1 (line 129): true, Field2 (line 129): true] access to field Field2 |
| Field1 (line 129): true | Conditions.cs:135:21:135:26 | [Field1 (line 129): true, Field2 (line 129): true] this access |
| Field1 (line 129): true | Conditions.cs:135:21:135:26 | [Field1 (line 129): true] access to field Field2 |
| Field1 (line 129): true | Conditions.cs:135:21:135:26 | [Field1 (line 129): true] this access |
| Field1 (line 129): true | Conditions.cs:136:17:138:17 | [Field1 (line 129): true, Field2 (line 129): true] {...} |
| Field1 (line 129): true | Conditions.cs:137:21:137:26 | [Field1 (line 129): true, Field2 (line 129): true] access to field Field1 |
| Field1 (line 129): true | Conditions.cs:137:21:137:26 | [Field1 (line 129): true, Field2 (line 129): true] this access |
| Field1 (line 129): true | Conditions.cs:137:21:137:37 | [Field1 (line 129): true, Field2 (line 129): true] call to method ToString |
| Field1 (line 129): true | Conditions.cs:137:21:137:38 | [Field1 (line 129): true, Field2 (line 129): true] ...; |
| Field2 (line 129): false | Conditions.cs:131:16:131:19 | [Field1 (line 129): true, Field2 (line 129): false] true |
| Field2 (line 129): false | Conditions.cs:132:9:140:9 | [Field1 (line 129): true, Field2 (line 129): false] {...} |
| Field2 (line 129): false | Conditions.cs:133:13:139:13 | [Field1 (line 129): true, Field2 (line 129): false] if (...) ... |
| Field2 (line 129): false | Conditions.cs:133:17:133:22 | [Field1 (line 129): true, Field2 (line 129): false] access to field Field1 |
| Field2 (line 129): false | Conditions.cs:133:17:133:22 | [Field1 (line 129): true, Field2 (line 129): false] this access |
| Field2 (line 129): false | Conditions.cs:134:13:139:13 | [Field1 (line 129): true, Field2 (line 129): false] {...} |
| Field2 (line 129): false | Conditions.cs:135:17:138:17 | [Field1 (line 129): true, Field2 (line 129): false] if (...) ... |
| Field2 (line 129): false | Conditions.cs:135:21:135:26 | [Field1 (line 129): true, Field2 (line 129): false] access to field Field2 |
| Field2 (line 129): false | Conditions.cs:135:21:135:26 | [Field1 (line 129): true, Field2 (line 129): false] this access |
| Field2 (line 129): true | Conditions.cs:131:16:131:19 | [Field1 (line 129): true, Field2 (line 129): true] true |
| Field2 (line 129): true | Conditions.cs:132:9:140:9 | [Field1 (line 129): true, Field2 (line 129): true] {...} |
| Field2 (line 129): true | Conditions.cs:133:13:139:13 | [Field1 (line 129): true, Field2 (line 129): true] if (...) ... |
| Field2 (line 129): true | Conditions.cs:133:17:133:22 | [Field1 (line 129): true, Field2 (line 129): true] access to field Field1 |
| Field2 (line 129): true | Conditions.cs:133:17:133:22 | [Field1 (line 129): true, Field2 (line 129): true] this access |
| Field2 (line 129): true | Conditions.cs:134:13:139:13 | [Field1 (line 129): true, Field2 (line 129): true] {...} |
| Field2 (line 129): true | Conditions.cs:135:17:138:17 | [Field1 (line 129): true, Field2 (line 129): true] if (...) ... |
| Field2 (line 129): true | Conditions.cs:135:21:135:26 | [Field1 (line 129): true, Field2 (line 129): true] access to field Field2 |
| Field2 (line 129): true | Conditions.cs:135:21:135:26 | [Field1 (line 129): true, Field2 (line 129): true] this access |
| Field2 (line 129): true | Conditions.cs:136:17:138:17 | [Field1 (line 129): true, Field2 (line 129): true] {...} |
| Field2 (line 129): true | Conditions.cs:137:21:137:26 | [Field1 (line 129): true, Field2 (line 129): true] access to field Field1 |
| Field2 (line 129): true | Conditions.cs:137:21:137:26 | [Field1 (line 129): true, Field2 (line 129): true] this access |
| Field2 (line 129): true | Conditions.cs:137:21:137:37 | [Field1 (line 129): true, Field2 (line 129): true] call to method ToString |
| Field2 (line 129): true | Conditions.cs:137:21:137:38 | [Field1 (line 129): true, Field2 (line 129): true] ...; |
| b2 (line 22): false | Conditions.cs:28:9:29:16 | [b2 (line 22): false] if (...) ... |
| b2 (line 22): false | Conditions.cs:28:13:28:14 | [b2 (line 22): false] access to parameter b2 |
| b2 (line 22): true | Conditions.cs:27:17:27:17 | [b2 (line 22): true] access to local variable x |
| b2 (line 22): true | Conditions.cs:27:17:27:19 | [b2 (line 22): true] ...++ |
| b2 (line 22): true | Conditions.cs:27:17:27:20 | [b2 (line 22): true] ...; |
| b2 (line 22): true | Conditions.cs:28:9:29:16 | [b2 (line 22): true] if (...) ... |
| b2 (line 22): true | Conditions.cs:28:13:28:14 | [b2 (line 22): true] access to parameter b2 |
| b2 (line 39): false | Conditions.cs:41:9:42:16 | [b2 (line 39): false] if (...) ... |
| b2 (line 39): false | Conditions.cs:41:13:41:14 | [b2 (line 39): false] access to local variable b2 |
| b2 (line 39): true | Conditions.cs:40:13:40:13 | [b2 (line 39): true] access to local variable x |
| b2 (line 39): true | Conditions.cs:40:13:40:15 | [b2 (line 39): true] ...++ |
| b2 (line 39): true | Conditions.cs:40:13:40:16 | [b2 (line 39): true] ...; |
| b2 (line 39): true | Conditions.cs:41:9:42:16 | [b2 (line 39): true] if (...) ... |
| b2 (line 39): true | Conditions.cs:41:13:41:14 | [b2 (line 39): true] access to local variable b2 |
| b (line 11): false | Conditions.cs:16:9:18:20 | [b (line 11): false] if (...) ... |
| b (line 11): false | Conditions.cs:16:13:16:13 | [b (line 11): false] access to local variable x |
| b (line 11): false | Conditions.cs:16:13:16:17 | [b (line 11): false] ... > ... |
| b (line 11): false | Conditions.cs:16:17:16:17 | [b (line 11): false] 0 |
| b (line 11): false | Conditions.cs:17:13:18:20 | [b (line 11): false] if (...) ... |
| b (line 11): false | Conditions.cs:17:17:17:18 | [b (line 11): false] !... |
| b (line 11): false | Conditions.cs:17:18:17:18 | [b (line 11): false] access to parameter b |
| b (line 11): true | Conditions.cs:15:13:15:13 | [b (line 11): true] access to local variable x |
| b (line 11): true | Conditions.cs:15:13:15:15 | [b (line 11): true] ...++ |
| b (line 11): true | Conditions.cs:15:13:15:16 | [b (line 11): true] ...; |
| b (line 11): true | Conditions.cs:16:9:18:20 | [b (line 11): true] if (...) ... |
| b (line 11): true | Conditions.cs:16:13:16:13 | [b (line 11): true] access to local variable x |
| b (line 11): true | Conditions.cs:16:13:16:17 | [b (line 11): true] ... > ... |
| b (line 11): true | Conditions.cs:16:17:16:17 | [b (line 11): true] 0 |
| b (line 11): true | Conditions.cs:17:13:18:20 | [b (line 11): true] if (...) ... |
| b (line 11): true | Conditions.cs:17:17:17:18 | [b (line 11): true] !... |
| b (line 11): true | Conditions.cs:17:18:17:18 | [b (line 11): true] access to parameter b |
| b (line 46): false | Conditions.cs:49:16:49:16 | [b (line 46): false] access to parameter x |
| b (line 46): false | Conditions.cs:49:16:49:18 | [b (line 46): false] ...-- |
| b (line 46): false | Conditions.cs:49:16:49:22 | [b (line 46): false] ... > ... |
| b (line 46): false | Conditions.cs:49:22:49:22 | [b (line 46): false] 0 |
| b (line 46): false | Conditions.cs:50:9:53:9 | [b (line 46): false] {...} |
| b (line 46): false | Conditions.cs:51:13:52:20 | [b (line 46): false] if (...) ... |
| b (line 46): false | Conditions.cs:51:17:51:17 | [b (line 46): false] access to parameter b |
| b (line 46): true | Conditions.cs:49:16:49:16 | [b (line 46): true] access to parameter x |
| b (line 46): true | Conditions.cs:49:16:49:18 | [b (line 46): true] ...-- |
| b (line 46): true | Conditions.cs:49:16:49:22 | [b (line 46): true] ... > ... |
| b (line 46): true | Conditions.cs:49:22:49:22 | [b (line 46): true] 0 |
| b (line 46): true | Conditions.cs:50:9:53:9 | [b (line 46): true] {...} |
| b (line 46): true | Conditions.cs:51:13:52:20 | [b (line 46): true] if (...) ... |
| b (line 46): true | Conditions.cs:51:17:51:17 | [b (line 46): true] access to parameter b |
| b (line 46): true | Conditions.cs:52:17:52:17 | [b (line 46): true] access to local variable y |
| b (line 46): true | Conditions.cs:52:17:52:19 | [b (line 46): true] ...++ |
| b (line 46): true | Conditions.cs:52:17:52:20 | [b (line 46): true] ...; |
| b (line 57): false | Conditions.cs:60:16:60:16 | [b (line 57): false] access to parameter x |
| b (line 57): false | Conditions.cs:60:16:60:18 | [b (line 57): false] ...-- |
| b (line 57): false | Conditions.cs:60:16:60:22 | [b (line 57): false] ... > ... |
| b (line 57): false | Conditions.cs:60:22:60:22 | [b (line 57): false] 0 |
| b (line 57): false | Conditions.cs:61:9:64:9 | [b (line 57): false] {...} |
| b (line 57): false | Conditions.cs:62:13:63:20 | [b (line 57): false] if (...) ... |
| b (line 57): false | Conditions.cs:62:17:62:17 | [b (line 57): false] access to parameter b |
| b (line 57): false | Conditions.cs:65:9:66:16 | [b (line 57): false] if (...) ... |
| b (line 57): false | Conditions.cs:65:13:65:13 | [b (line 57): false] access to parameter b |
| b (line 57): true | Conditions.cs:60:16:60:16 | [b (line 57): true] access to parameter x |
| b (line 57): true | Conditions.cs:60:16:60:18 | [b (line 57): true] ...-- |
| b (line 57): true | Conditions.cs:60:16:60:22 | [b (line 57): true] ... > ... |
| b (line 57): true | Conditions.cs:60:22:60:22 | [b (line 57): true] 0 |
| b (line 57): true | Conditions.cs:61:9:64:9 | [b (line 57): true] {...} |
| b (line 57): true | Conditions.cs:62:13:63:20 | [b (line 57): true] if (...) ... |
| b (line 57): true | Conditions.cs:62:17:62:17 | [b (line 57): true] access to parameter b |
| b (line 57): true | Conditions.cs:63:17:63:17 | [b (line 57): true] access to local variable y |
| b (line 57): true | Conditions.cs:63:17:63:19 | [b (line 57): true] ...++ |
| b (line 57): true | Conditions.cs:63:17:63:20 | [b (line 57): true] ...; |
| b (line 57): true | Conditions.cs:65:9:66:16 | [b (line 57): true] if (...) ... |
| b (line 57): true | Conditions.cs:65:13:65:13 | [b (line 57): true] access to parameter b |
| b (line 102): false | Conditions.cs:107:9:109:24 | [b (line 102): false] if (...) ... |
| b (line 102): false | Conditions.cs:107:13:107:13 | [b (line 102): false] access to local variable x |
| b (line 102): false | Conditions.cs:107:13:107:20 | [b (line 102): false] access to property Length |
| b (line 102): false | Conditions.cs:107:13:107:24 | [b (line 102): false] ... > ... |
| b (line 102): false | Conditions.cs:107:24:107:24 | [b (line 102): false] 0 |
| b (line 102): false | Conditions.cs:108:13:109:24 | [b (line 102): false] if (...) ... |
| b (line 102): false | Conditions.cs:108:17:108:18 | [b (line 102): false] !... |
| b (line 102): false | Conditions.cs:108:18:108:18 | [b (line 102): false] access to parameter b |
| b (line 102): true | Conditions.cs:106:13:106:13 | [b (line 102): true] access to local variable x |
| b (line 102): true | Conditions.cs:106:13:106:19 | [b (line 102): true] ... + ... |
| b (line 102): true | Conditions.cs:106:13:106:19 | [b (line 102): true] ... = ... |
| b (line 102): true | Conditions.cs:106:13:106:20 | [b (line 102): true] ...; |
| b (line 102): true | Conditions.cs:106:18:106:19 | [b (line 102): true] "" |
| b (line 102): true | Conditions.cs:107:9:109:24 | [b (line 102): true] if (...) ... |
| b (line 102): true | Conditions.cs:107:13:107:13 | [b (line 102): true] access to local variable x |
| b (line 102): true | Conditions.cs:107:13:107:20 | [b (line 102): true] access to property Length |
| b (line 102): true | Conditions.cs:107:13:107:24 | [b (line 102): true] ... > ... |
| b (line 102): true | Conditions.cs:107:24:107:24 | [b (line 102): true] 0 |
| b (line 102): true | Conditions.cs:108:13:109:24 | [b (line 102): true] if (...) ... |
| b (line 102): true | Conditions.cs:108:17:108:18 | [b (line 102): true] !... |
| b (line 102): true | Conditions.cs:108:18:108:18 | [b (line 102): true] access to parameter b |
| inc (line 3): false | Conditions.cs:7:9:8:16 | [inc (line 3): false] if (...) ... |
| inc (line 3): false | Conditions.cs:7:13:7:16 | [inc (line 3): false] !... |
| inc (line 3): false | Conditions.cs:7:14:7:16 | [inc (line 3): false] access to parameter inc |
| inc (line 3): true | Conditions.cs:6:13:6:13 | [inc (line 3): true] access to parameter x |
| inc (line 3): true | Conditions.cs:6:13:6:15 | [inc (line 3): true] ...++ |
| inc (line 3): true | Conditions.cs:6:13:6:16 | [inc (line 3): true] ...; |
| inc (line 3): true | Conditions.cs:7:9:8:16 | [inc (line 3): true] if (...) ... |
| inc (line 3): true | Conditions.cs:7:13:7:16 | [inc (line 3): true] !... |
| inc (line 3): true | Conditions.cs:7:14:7:16 | [inc (line 3): true] access to parameter inc |
| last (line 118): false | Conditions.cs:120:17:120:22 | [last (line 118): false] ... = ... |
| last (line 118): false | Conditions.cs:120:17:120:23 | [last (line 118): false] ...; |
| last (line 118): false | Conditions.cs:120:21:120:22 | [last (line 118): false] "" |
| last (line 118): false | Conditions.cs:121:13:122:25 | [last (line 118): false] if (...) ... |
| last (line 118): false | Conditions.cs:121:17:121:20 | [last (line 118): false] access to local variable last |
| last (line 118): true | Conditions.cs:121:13:122:25 | [last (line 118): true] if (...) ... |
| last (line 118): true | Conditions.cs:121:17:121:20 | [last (line 118): true] access to local variable last |