Commit Graph

8549 Commits

Author SHA1 Message Date
Tom Hvitved
0ee5fe88d9 CIL: Account for multiple VariableUpdate::getSource()s in nullness analysis
For methods compiled without optimization (and possibly also with optimization),
it is possible for a variable update to have multiple possible assigned values.
For example, the non-optimized CIL for

```
return cond ? null : "not null"
```

is

```
0: nop
1: ldarg.0
2: ldfld cond
3: brtrue.s 6:
4: ldstr "not null"
5: br.s 7:
6: ldnull
7: stloc.0 L0 // stores either `null` or "not null"
8: br.s 9:
9: ldloc.0
10: ret
```

Consequently, an existential in `CallableReturns.qll` must be a `forex`.
2019-05-28 10:13:00 +02:00
Tom Hvitved
4fc61ebbf3 C#: Add tests for maybe-null CIL methods 2019-05-28 10:05:33 +02:00
Tom Hvitved
c82a2f0fec C#: Refactor data flow predicates to be defined by dispatch 2019-05-27 13:40:41 +02:00
Calum Grant
ae8ecc88e6 C#: Address review comments. 2019-05-24 14:56:58 +01:00
Calum Grant
d2aea635e4 C#: Address review comments 2019-05-24 13:49:05 +01:00
Calum Grant
14147a1abe C#: DB upgrade script and stats 2019-05-24 13:49:05 +01:00
Tom Hvitved
a1e58cedac C#: Refactor recursive patterns implementation
- Extract names of properties in a propery match, using the `exprorstmt_name` relation.
- Simplify extraction of properties by not distinguishing between top-level patterns
  and nested patterns.
- Introduce `PatternExpr` to capture patterns in `is` expressions, `case` statements,
  and `switch` expression arms.
- Generalize `IsTypeExpr`, `IsPatternExpr`, `IsRecursivePatternExpr`, and `IsConstantExpr`
  to just `IsExpr` with a member predicate `PatternExpr getPattern()`.
- Generalize `TypeCase`, `RecursivePatternCase`, and `ConstCase` to just `CaseStmt` with
  a member predicate `PatternExpr getPattern()`.
- Introduce classes `Switch` and `Case` as base classes of switch statements/expressions
  and case statements/switch expression arms, respectively.
- Simplify CFG logic using the generalized classes.
- Generalize guards library to cover `switch` expressions tests.
- Generalize data flow library to cover `switch` expression assignments.
2019-05-24 13:49:05 +01:00
Calum Grant
21203cdf0d C#: Minor code tidy. 2019-05-24 13:49:05 +01:00
Calum Grant
aecc9e2a57 C#: Fix LGTM warnings 2019-05-24 13:49:05 +01:00
Calum Grant
55b41cfaf7 C#: DB Upgrade script 2019-05-24 13:49:05 +01:00
Calum Grant
1a40c29aba C#: DB stats 2019-05-24 13:49:05 +01:00
Calum Grant
fa57017720 C#: Minor edit. 2019-05-24 13:49:05 +01:00
calum
1428d0ba93 C#: Implement recursive patterns 2019-05-24 13:49:05 +01:00
calum
318068b52f C#: Implement range operator 2019-05-24 13:49:04 +01:00
Tom Hvitved
d30bce4f31 C#: Update expected test output 2019-05-23 16:03:54 +02:00
Calum Grant
fcfb7b2b8a C#: Fix error caused by Roslyn upgrade. 2019-05-22 16:17:16 +01:00
Calum Grant
e5aa7f3ba7 C#: Upgrade to Roslyn 3.1 2019-05-22 15:54:30 +01:00
Calum Grant
fc8eccfc6b C#: Add some basic qhelp. Since these are internal queries, this is probably not needed. 2019-05-22 10:16:24 +01:00
Denis Levin
0b108fab0f Replaced tabs with spaces 2019-05-21 14:11:30 -07:00
Calum Grant
75c19e3991 C#: Add internal queries for extractor and compiler diagnostics. 2019-05-21 21:22:50 +01:00
Denis Levin
eacded27a9 Japanese Era and Leap Year checks (Likely Bugs) 2019-05-20 15:54:57 -07:00
Anders Schack-Mulligen
9ebeac25ad Merge pull request #1329 from hvitved/dataflow/performance
Data flow: performance improvements
2019-05-20 14:27:03 +02:00
Tom Hvitved
e1d4166e3c C#: Data flow through this parameter 2019-05-20 13:42:32 +02:00
Tom Hvitved
bc00877ff2 Data flow: Add nomagic to storeCand() 2019-05-20 12:05:20 +02:00
Tom Hvitved
360c7a1ac5 Address review comments 2019-05-20 09:59:17 +02:00
Calum Grant
c1e627d739 Merge pull request #1312 from hvitved/csharp/variable-preds
C#: Refactor predicates in `Variable` class to be defined by dispatch
2019-05-16 12:35:12 +01:00
Calum Grant
6994ba904b Merge pull request #1309 from hvitved/csharp/get-explicit-arg-nomagic
Add `pragma[nomagic]` to `getExplicitArgument()`
2019-05-16 10:57:00 +01:00
Tom Hvitved
02ca09aa43 Data flow: performance improvements 2019-05-16 07:35:10 +02:00
Calum Grant
6a198ff7e1 Merge pull request #1306 from hvitved/csharp/dataflow/shared-implementation
C#: Adopt shared data flow implementation
2019-05-15 17:41:46 +01:00
Tom Hvitved
949b3601d0 C#: Address review comments 2019-05-15 14:10:42 +02:00
Tom Hvitved
89e60dc9bf C#: Simplify CallContext.qll 2019-05-14 11:24:23 +02:00
Calum Grant
88b5719103 C#: Add DB upgrade script 2019-05-13 09:18:52 +01:00
Calum Grant
7a3b6575a5 C#: Update expected output following roslyn-3.0.0 update. 2019-05-13 09:18:52 +01:00
calum
7b19402b1f C#: Update DB stats. 2019-05-13 09:18:52 +01:00
calum
39bb3f2d52 C#: Fix elapsed timings and add a test for it. 2019-05-13 09:18:52 +01:00
calum
c67e441003 C#: Implement compilation_referencing_files and update comments for C#. 2019-05-13 09:18:52 +01:00
calum
1a99f4f253 C#: Fix unit tests due to qltest mangling output. 2019-05-13 09:18:52 +01:00
calum
2a484dc4ea C#: Fix alerts and tests. 2019-05-13 09:18:52 +01:00
calum
66b3df7f29 C#: Fix unit tests. 2019-05-13 09:18:52 +01:00
calum
3046cc494a C#: Code tidy. 2019-05-13 09:18:52 +01:00
calum
343cddcbb7 C#: Refactor extractor errors and log extractor errors to the database. 2019-05-13 09:18:52 +01:00
calum
e1158bb5e5 C#: Store compilations, compiler diagnostics and performance in the database. 2019-05-13 09:18:52 +01:00
Tom Hvitved
e3b83d04f5 C#: Refactor predicates in Variable class to be defined by dispatch 2019-05-09 11:53:42 +02:00
Tom Hvitved
a89505ba32 C#: Simplify DataFlow::Node::getType() 2019-05-07 20:52:38 +02:00
calum
c28fa7ed3f C#: Handle VarPatternSyntax class introduced by Roslyn 3.0.0 2019-05-07 18:01:37 +01:00
calum
8a78c8f124 C#: Update xunit and other dependencies. 2019-05-07 18:01:36 +01:00
calum
d84fcbeedb C#: Fix extractor errors. 2019-05-07 18:01:36 +01:00
calum
b7875aef20 C#: Update nuget packages 2019-05-07 18:01:36 +01:00
Tom Hvitved
272545a63c Add pragma[nomagic] to getExplicitArgument() 2019-05-07 15:34:27 +02:00
Tom Hvitved
7b7a1ecea0 C#: Move DelegateDataFlow.qll into internal folder 2019-05-06 14:54:11 +02:00