Commit Graph

9080 Commits

Author SHA1 Message Date
AndreiDiaconu1
46d7b9e3bf Lock stmt
Added support for the lock stmt
Added a test case and updated the expected output
2019-09-06 18:09:15 +01:00
AndreiDiaconu1
4dd548bfa2 Foreach stmt
Addded support for the foreach stmt (for now only the "canonical" desugaring).
Added a test and updated the expected output.
2019-09-06 18:09:15 +01:00
AndreiDiaconu1
a5ec763035 Delegate creation and call
Added support for delegate creation and call.
Added a test case and updated the expected output.
2019-09-06 18:08:03 +01:00
AndreiDiaconu1
331707f3a3 Framework for the translation of compiler elements
Added a framework for the translation of compiler generated elements, so that the process of adding a new desugaring process is almost mechanical.
The files in `internal` serve as the superclasses for all the compiler generated elements.
The file `Common.qll` captures common patterns for the compiler generated code to improve code sharing (by pattern I mean an element that appears in multiple desugarings). For example the `try...finally` pattern appears in the desugaring process of both the `lock` and the `foreach` stmts, so a class the provides a blueprint for this pattern is exposed. Several other patterns are present.
The expected output has also been updated (after a rebase) and it should be ignored.
2019-09-06 18:08:03 +01:00
AndreiDiaconu1
80b7512fe2 Initial restructure
The `raw/internal` folder has been restructured to better enhance code sharing between compiler generated elements and AST generated elements.
The translated calls classes have been refactored to better fit the C# library.
A new folder has been added, `common` that provides blueprints for the classes that deal with translations of calls, declarations, exprs and conditions.
Several `TranslatedX.qll` files have been modified so that they use those blueprint classes.
2019-09-06 18:08:03 +01:00
Calum Grant
f9b99ae245 C#: Adjust date query severity and add precisions. Tidy up tags. 2019-09-06 16:44:29 +01:00
Anders Schack-Mulligen
343230402a C#: Autoformat. 2019-09-06 09:04:16 +02:00
Jonas Jensen
9c9b7ac651 C#/C++/Java: Revert AccessPathNil.toString changes
This caused too many `*.expected` files to change, also in our internal
repo.
2019-09-02 15:59:36 +02:00
Jonas Jensen
a98992f0f9 C#/C++/Java: distinguish toString of nil from cons 2019-09-02 14:22:03 +02:00
Jonas Jensen
cdede8744f C#/C++/Java: Prettier PartialAccessPath.toString 2019-09-02 14:05:50 +02:00
Jonas Jensen
c3bc9f8575 C#/C++/Java: Unbreak partial data flow support
Partial data flow had a semantic merge conflict with this branch. The
problem is that partial data flow doesn't (and shouldn't) cause the
initial pruning steps to run, but the length-2 access paths depend on
the `consCand` information that comes from that initial pruning. The
solution is to restore the old `AccessPath` class, now called
`PartialAccessPath` for use only by partial data flow.

With this change, partial data flow will in some cases allow more field
flow than non-partial data flow.
2019-09-02 14:02:39 +02:00
Jonas Jensen
dec0c3a0ee C#/C++/Java: Make AccessPath abstract
This was requested by @hvitved in code review. There is no difference in
the generated DIL.
2019-09-02 13:14:30 +02:00
Jonas Jensen
b1be123e31 C#/C++/Java: Prettier AccessPath.toString
The `ppReprType` predicate should now be `none()` instead of `result=""`
to signal that there is nothing to print. That seems clearer to me.
2019-09-02 13:14:20 +02:00
Jonas Jensen
dbe8034e04 C#: Accept test results 2019-09-02 13:14:17 +02:00
Jonas Jensen
b2c94cc6b4 C++/C#/Java: Restore the AccessPathCons class 2019-09-02 13:14:13 +02:00
Jonas Jensen
fbe34015f3 C++/C#/Java: AccessPath class names reflect length
One -> ConsNil
Two -> ConsCons
2019-09-02 13:13:59 +02:00
Jonas Jensen
e8006bb2cc C++/C#/Java: data flow AccessPath up to length 2
This commit does not include updates to test results.
2019-09-02 13:13:46 +02:00
semmle-qlci
0cf872ed32 Merge pull request #1846 from hvitved/csharp/autoformat
Approved by jbj
2019-09-02 08:31:43 +01:00
Tom Hvitved
675255755b C#: Speedup Completion::isValidFor() 2019-09-01 10:34:52 +02:00
Tom Hvitved
508055fdc8 C#: Add a few pragma[nomagic] 2019-09-01 10:34:51 +02:00
Tom Hvitved
1e7ee8ddad C#: Loop unrolling for foreach statements 2019-09-01 10:34:51 +02:00
Tom Hvitved
1bfef706e2 C#: Add loop unrolling tests 2019-09-01 10:34:51 +02:00
Tom Hvitved
bb735c0220 C#: Teach guards library about collections 2019-09-01 10:34:51 +02:00
semmle-qlci
00fe4734ac Merge pull request #1850 from hvitved/csharp/remove-ref-equal
Approved by calumgrant
2019-09-01 09:31:50 +01:00
yh-semmle
f54545522e Merge pull request #1759 from aschackmull/java/flow-exploration
Java/C++/C#: Add support for dataflow exploration by partial paths.
2019-08-30 17:00:17 -04:00
Tom Hvitved
6dc869d5c6 C#: Remove reference equality 2019-08-30 15:52:42 +02:00
Tom Hvitved
3e716bf806 Merge pull request #1749 from calumgrant/cs/extractor-tidy
C#: Refactor extractor trap generation code
2019-08-30 15:44:35 +02:00
Tom Hvitved
c9275fdc0a Merge pull request #1692 from calumgrant/cs/roslyn-3.2
C#: Upgrade to Roslyn 3.2
2019-08-30 15:09:11 +02:00
Anders Schack-Mulligen
5e6326d1d5 Java/C++/C#: Add support for dataflow exploration by partial paths. 2019-08-30 14:32:55 +02:00
semmle-qlci
394563de43 Merge pull request #1807 from hvitved/csharp/dataflow/barrier-guard
Approved by calumgrant
2019-08-30 12:40:25 +01:00
Calum Grant
c7b685b3b8 C#: Fix changed qltest. 2019-08-30 11:47:43 +01:00
Calum Grant
611af1e2c2 C#: Upgrade to Roslyn 3.2. 2019-08-30 11:47:43 +01:00
Calum Grant
ec61877ce8 Merge pull request #1805 from hvitved/csharp/dataflow/nested-fields
C#: Nested field flow
2019-08-30 10:26:10 +01:00
Calum Grant
0129b42c54 C#: Address review comments. 2019-08-30 10:11:01 +01:00
Calum Grant
7df90f13ed C#: Address review comments. Tidy up tuple generation, consolidating code and use run-time type information instead of FirstParam/NextParam. 2019-08-30 10:11:01 +01:00
Calum Grant
40f56ff4b3 C#: Code tidy. Rename variables, delete dead code, format whitespace, improve comments. 2019-08-30 10:11:01 +01:00
Calum Grant
b3d5e405a6 C#: Fix violations 2019-08-30 10:11:01 +01:00
Calum Grant
97522c506e C#: Add more CIL consistency tests. 2019-08-30 10:11:01 +01:00
Calum Grant
b776421602 C#: Fix up tests. Fix cil_class, and add locations for constructed methods and types. 2019-08-30 10:11:01 +01:00
Calum Grant
02fd51ae61 C#: Resolve merge conflicts. 2019-08-30 10:11:00 +01:00
Calum Grant
b500a02b1e C#: Compare CIL entities directly by handle rather than by label.
C#: Remove IDs from the CIL extractor and make consistent with C# extractor.
C#: Fix method collisions.
2019-08-30 10:11:00 +01:00
Calum Grant
685c494bcb C#: Make the trap compression algorithm configurable. 2019-08-30 10:11:00 +01:00
Calum Grant
fe7e90e25a C#: Remove the tuples from the C# extractor. 2019-08-30 10:11:00 +01:00
Calum Grant
486c192dda C#: Refactoring expression and statement population. 2019-08-30 10:11:00 +01:00
Calum Grant
e41e8d6547 C#: Remove ITrapBuilder in favour of TextWriter. 2019-08-30 10:00:06 +01:00
Calum Grant
aeb38a1757 C#: Refactoring tuple writing to remove Tuple intermediate object and write straight to trap file. 2019-08-30 10:00:06 +01:00
Calum Grant
bd1b0018b0 C#: Rename some methods. 2019-08-30 10:00:06 +01:00
Calum Grant
58e6d236ff C#: Tidy up CommentProcessing. 2019-08-30 10:00:06 +01:00
Tom Hvitved
9f59e385d1 C#: Autoformat 2019-08-30 09:53:50 +02:00
Tom Hvitved
6e7ef66642 C#: Revert to using GuardedDataFlowNode in TaintedPath.qll 2019-08-30 09:37:23 +02:00