Commit Graph

8549 Commits

Author SHA1 Message Date
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
Tom Hvitved
751985dcf2 C#: Address review comments 2019-08-30 09:37:23 +02:00
Tom Hvitved
ae5fb7f330 C#: Introduce BarrierGuards 2019-08-30 09:37:16 +02:00
Calum Grant
4dd4167a5a C#: Update test output (following merge). 2019-08-29 18:22:37 +01:00
Calum Grant
83d1e0eaa6 C#: Name DotNet::Namespace a declaration. 2019-08-29 18:12:58 +01:00
Calum Grant
83ab044a73 C#: Update expected test output. 2019-08-29 18:12:58 +01:00
Calum Grant
dfbb1946d3 C#: Minor edits 2019-08-29 18:11:00 +01:00
Calum Grant
5613769654 C#: Add NamespaceAccess, and make namespaces declarations. 2019-08-29 18:11:00 +01:00
Calum Grant
0e62377dd2 C#: Treat _ as an ordinary variable in a foreach. 2019-08-29 18:11:00 +01:00
Calum Grant
8aeeec01ff C#: Add namespace_access_expr because of nameof(Namespace) 2019-08-29 18:11:00 +01:00
Calum Grant
ae36359058 C#: Fix typementions of arrays. 2019-08-29 18:11:00 +01:00
Tom Hvitved
982f90dc2b C#: Refactor local data flow step relations 2019-08-29 13:35:19 +02:00
semmle-qlci
f980d20d6d Merge pull request #1809 from hvitved/csharp/cfg/tests
Approved by calumgrant
2019-08-29 11:35:21 +01:00
Calum Grant
d2bee79370 Merge pull request #1600 from AndreiDiaconu1/ircsharp
C#: Initial port of IR for C#
2019-08-29 09:26:34 +01:00
AndreiDiaconu1
deeff07322 Fixed unused predicate error 2019-08-28 15:50:39 +01:00
AndreiDiaconu1
489dbe1d01 Fixed errors
Added some new classes for built in operations that for the moment
have no effect (added to remove errors)
2019-08-28 14:23:42 +01:00
AndreiDiaconu1
05ae04df72 Synced files 2019-08-28 12:30:17 +01:00
AndreiDiaconu1
66948b4f57 Fixed PR errors 2019-08-28 12:25:14 +01:00
AndreiDiaconu1
7390606370 Tidy up + more comment
Tidied up the code for review
Added more comments
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
0c6ffc9f4d Casts and IsExpr
Fixed some inconsistencies with casts
Fixed some bugs related to which translated elements need loads
Added support for IsExpr expressions
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
c8a3f6fac8 Added cast exprs + deleted commented code 2019-08-28 12:25:14 +01:00
AndreiDiaconu1
34bafa7230 Fixed sanity checks
Fixed a bug in `TranslatedArrayExpr` that would prevent the element to produce the correct instruction result, hence creating problems with loads and stores.
`ElementsAddress` opcode now inherits from the `UnaryOpcode`, as it should.
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
23694bdd14 Work on classes + refactor
Began working o inheritance, polymorphism and constructor init. Correct code is produced for them (though some more work is needed to accurately treat conversions between classes).
Removed commented code.
Added classes to properly deal with constructor init and modified and refactored TranslatedFunction to accomodate for the changes.
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
9018b25177 Properties
Properties and property access produce correct code.
Fixed a function qualifier bug in `TranslatedCall.qll`.
Added a new class to translate `ExprStmt`s whose expr is an `AssignExpr` whose lvalue is an accessor call: we translate only the accessor call in for the translated AST.
2019-08-28 12:25:14 +01:00
AndreiDiaconu1
1acabc7d87 Jump statements
Broke down the class `TranslatedJump` to have more control on the IR control flow.
Now GotoLabelStmt, GotoCaseStmt, GotoDefaultStmt and BreakStmt are translated separately.
This also fixes an issue when having a switch as the last statement of a void function would create an incorrect CFG.
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
2724075dec Added stmts
Added support for `ForStmt` and `DoWhileStmt`
Added test cases
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
b6287b904c Preliminary refactoring
Some preliminary refactoring of the TranslatedDeclaration.qll file
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
1e4b3fafb6 Updated expected for crement ops 2019-08-28 12:25:13 +01:00
AndreiDiaconu1
940ba694d2 Arithmetic increment and decrement expressions
Correct code is now produced for increment and decrement expressions
Modified producesExprResult() and TTranslatedLoad() so that no loads are done from outside the crement exprs and that the VariableAddress generated from the access of the operator variable is recognized as an expr that produces result.
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
3bc6456572 Work on throw statements, bug fixes, small refactor.
Throw statements now give correct code, apart from the case of rethrows: need to make explicit the fact that a finally block is executed even if stack unwinding happens.
Added 2 new classes to TranslatedStmt.qll, one for throws that have an exception, one for rethrows.
Fixed a bug in TranslatedDeclarationEntry.qll where some local declaration would be missed.
Changed toString into getQualifiedName for more clarity when generating the instructions in Instruction.qll.
Some general refactoring in TranslatedExpr.qll and TranslatedStmt.qll.
2019-08-28 12:25:13 +01:00
AndreiDiaconu1
b90bc96cb5 Objects tests and fix in PrintIR
Added tests to showcase the instructions generated for object creation and object initialization
Updated raw_ir.expected
PrintIR now uses the qualified name (with types) when printing the IR for more clarity
2019-08-28 12:25:13 +01:00
Andrei Diaconu
8661074fc3 Object creation and initialization + refactoring
Correct code is now generated from ObjectCreation exprs and ObjectInitializer exprs.
Removed TranslatedFieldInitialization and its subclasses and further refactored TranslatedInitialization
2019-08-28 12:25:13 +01:00