Commit Graph

54 Commits

Author SHA1 Message Date
Tamas Vajk
b7f13a7e1f C#: Change generic method names to include <> and type args/params 2021-09-06 11:48:22 +02:00
Tamas Vajk
5e2770339f Add adjusted expected files 2021-07-01 16:09:11 +02:00
Tamas Vajk
03d1a3e0ad Trim test files + remove duplicate newlines 2021-07-01 16:09:11 +02:00
Tamas Vajk
c29d11087b C#: Start using 'options' files in tests 2021-07-01 16:08:47 +02:00
Tom Hvitved
4c597dd467 C#: Improve performance of guards library 2021-04-23 10:09:43 +02:00
Tamas Vajk
90acd8c695 Explicitly enable nullability analysis in guards tests 2021-03-04 11:39:56 +01:00
Tamas Vajk
cb4ed90c5c Fix failing tests 2021-03-03 16:58:48 +01:00
Tom Hvitved
ab85b2c2d2 C#: Add is not null guards test 2021-01-25 13:52:17 +01:00
Tom Hvitved
d4ee8cdd18 C#: Always create basic blocks for nodes with a conditional predecessor 2020-11-27 15:08:33 +01:00
Tamas Vajk
ba730b6f02 Fix failing tests 2020-11-11 09:46:18 +01:00
Tom Hvitved
5cd707f17e C#: Add CFG test for assertion with multiple assertion arguments 2020-10-29 15:44:13 +01:00
Tom Hvitved
1a93090778 C#: Improve guards SSA logic in the context of control-flow splitting 2020-10-02 18:00:34 +02:00
Tom Hvitved
f1d6f7cd0c C#: Model assertions in the CFG 2020-10-02 17:56:41 +02:00
Tom Hvitved
17f0ac4b20 C#: Add more CFG assertion tests 2020-10-02 15:35:33 +02:00
Tamas Vajk
5f96c37b28 C#: Fix switch case expression types 2020-09-22 13:16:31 +02:00
Tom Hvitved
b205702853 C#: Fix bug in guards logic for foreach loops 2020-08-28 15:19:11 +02:00
Tom Hvitved
ddb33c914b C#: Add test that demonstrates issue with guards logic for foreach statements 2020-08-28 15:13:18 +02:00
Calum Grant
359dea2c2b C#: Fixed test output. 2020-01-07 18:39:52 +00:00
Calum Grant
a1bedf2e06 C#: Use expression flow state to determine non-null guards 2020-01-07 18:39:51 +00:00
Calum Grant
2eb29224e8 C#: Update guards tests. 2020-01-07 18:39:51 +00:00
Calum Grant
4b0a149704 C#: Update qltest output. 2019-12-06 12:41:20 +00:00
Tom Hvitved
bb83b92c6b C#: Autoformat 2019-09-18 12:02:59 +02:00
Tom Hvitved
170621d1cc C#: Address review comments 2019-09-09 13:38:23 +02:00
Tom Hvitved
bb735c0220 C#: Teach guards library about collections 2019-09-01 10:34:51 +02:00
Tom Hvitved
51d093add0 C#: Address review comments 2019-06-25 17:01:48 +02:00
Tom Hvitved
f95dd6bb35 Guard tests 2019-06-03 16:00:22 +02:00
Tom Hvitved
c68dfb9d68 C#: Switch expression guards 2019-05-29 13:50:42 +02: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
Tom Hvitved
6c182564e7 C#: Adjustments to CIL/nullness analyses
- Cache predicates in the same stage using a cached module.
- Introduce `DefUse::defUseVariableUpdate()` and use in `CallableReturns.qll`.
  The updated file `csharp/ql/test/library-tests/cil/dataflow/Nullness.expected`
  demonstrates why this is needed.
- Utilize CIL analysis in `Guards::nonNullValue()`.
- Analyze SSA definitions in `AlwaysNullExpr`, similar to `NonNullExpr`.
2019-03-22 15:11:31 +01:00
Tom Hvitved
16d3399039 C#: Teach guards library about object.GetType() 2019-01-29 16:40:36 +01:00
Tom Hvitved
87bb4a1d56 C#: Add null guard test involving GetType() 2019-01-29 16:32:13 +01:00
Tom Hvitved
abb3f71ec8 C#: Add GuardedControlFlowNode 2019-01-16 10:29:26 +01:00
Tom Hvitved
af38a2b9c5 Merge branch 'master' into csharp/autoformat/tests 2018-12-20 20:59:10 +01:00
Tom Hvitved
231465143d C#: Autoformat QL tests 2018-12-20 10:19:59 +01:00
Tom Hvitved
e2f271bddb C#: Add more guard implication steps 2018-12-14 12:03:32 +00:00
Tom Hvitved
4739a6334e C#: Fix a bug and generalize guards implication logic 2018-12-03 15:33:00 +01:00
Tom Hvitved
ab9aa7d338 C#: Teach guards library about conditional assignments
For example, in

```
void M(object x)
{
    var y = x != null ? "" : null;
    if (y != null)
        x.ToString();
}
```

the guard `y != null` implies that the guard `x != null` must be true.
2018-11-30 17:41:36 +01:00
Tom Hvitved
80144a00c8 C#: Update nullness analyses
Port the SSA-based logic from the Java nullness analyses.
2018-11-30 17:41:31 +01:00
calumgrant
08f5c2b6a6 Merge pull request #567 from hvitved/csharp/guards-splitting
C#: Account for split SSA definitions in guards library
2018-11-30 14:57:57 +00:00
Tom Hvitved
a12a72e90f C#: Fix bug in guards library when the guarded expression is in a loop
Follow-up on 03e69e9945.
2018-11-29 15:53:03 +01:00
Tom Hvitved
3eb163f656 C#: Account for split SSA definitions in guards library
On 03e69e9945, I updated the guards library to account
for control flow graph splitting. However, the logic that relates SSA qualifiers for
the guard and the guarded expression was not updated accordingly.
2018-11-28 20:00:13 +01:00
Tom Hvitved
1a25f0a068 C#: Add test for guard inside a split CFG block 2018-11-28 19:59:05 +01:00
Tom Hvitved
03e69e9945 C#: Make guards library work with CFG splitting 2018-11-23 15:20:33 +01:00
Tom Hvitved
228189db5a C#: Add tests for guards inside split CFG blocks 2018-11-23 15:20:27 +01:00
Tom Hvitved
29f163fd4e C#: Fix guards implications logic 2018-11-08 20:21:34 +01:00
Tom Hvitved
e4aa196c37 C#: Teach guards library about custom null guards 2018-11-08 20:21:34 +01:00
Tom Hvitved
a5dfc10197 C#: Add tests for custom null guards 2018-11-08 20:21:34 +01:00
Tom Hvitved
5921a9ea51 C#: Teach guards library about assertions 2018-11-08 20:21:34 +01:00
Tom Hvitved
0fb7ddc956 C#: Add assertion guard tests 2018-11-08 20:21:34 +01:00
Tom Hvitved
2d25a04a2e C#: Add test for guard implications logic 2018-11-05 16:47:10 +01:00