Commit Graph

2360 Commits

Author SHA1 Message Date
Tamas Vajk
7cb4d6d7a0 C#: Fix type mentions for stackalloc arrays 2020-10-20 08:23:56 +02:00
Tamas Vajk
ca6ecb3f1e C#: Extract type mention for array creation 2020-10-20 08:23:56 +02:00
Tamas Vajk
7066568813 C#: Change type access and expression order in casts for AST printing 2020-10-20 08:23:56 +02:00
Tamas Vajk
6c48eb8c12 C#: Add type mentions to AST 2020-10-20 08:23:56 +02:00
Dave Bartolomeo
b73cb3a4ce Accept C# IR diffs 2020-10-18 11:11:05 -04:00
Dave Bartolomeo
40cd96eb1d Merge from main 2020-10-17 15:14:26 -04:00
Dave Bartolomeo
4e0afb0dc3 Print targets of Load and Store instructions in IR dump 2020-10-17 15:01:45 -04:00
Dave Bartolomeo
a80c6fbf97 C++: Print target variable name for Load and Store, if known
Now that we've started printing the targets of `Call` instructions in the IR dumps, I figured I might as well print the names of the variable being loaded or stored as well. We could potentially extend this to match fields, array elements, etc., but that's quite a bit more work.
2020-10-17 14:21:27 -04:00
Dave Bartolomeo
6a9ecf7ba2 Dump static call target for Call instructions 2020-10-16 12:55:30 -04:00
Dave Bartolomeo
6a6eadcf50 C++: Print static call target for Call instruction in dumps 2020-10-16 11:53:27 -04:00
Anders Schack-Mulligen
b352605d12 Dataflow: Code review fixes. 2020-10-16 13:45:51 +02:00
Anders Schack-Mulligen
664f04020f Revert "Dataflow: Count callables instead of nodes for fieldFlowBranchLimit."
This reverts commit 1501a40de8.
2020-10-16 12:51:50 +02:00
Anders Schack-Mulligen
1501a40de8 Dataflow: Count callables instead of nodes for fieldFlowBranchLimit. 2020-10-16 12:51:17 +02:00
Anders Schack-Mulligen
6aae51fa4f Dataflow: Sync. 2020-10-16 12:51:17 +02:00
Tamas Vajk
52bdd8bf99 C#: Add support for custom assert methods ([DoesNotReturnIf(true/false)]) 2020-10-16 12:25:03 +02:00
Tamas Vajk
ffc2a64750 C#: do not discard duplicate trapfiles for compilation parameter extraction 2020-10-16 09:52:21 +02:00
Tom Hvitved
5f01fda1ef Data flow: Sync files 2020-10-16 09:05:02 +02:00
Tom Hvitved
82e56d4ebb Data flow: Simplify pathStep and pathIntoCallable 2020-10-16 09:05:02 +02:00
Anders Schack-Mulligen
94f110f739 Sync. 2020-10-16 09:05:01 +02:00
Tom Hvitved
d48a6a5555 C#: Update expected test output 2020-10-16 09:04:58 +02:00
Tom Hvitved
d608138c0c Data flow: Sync files 2020-10-16 09:03:13 +02:00
Tom Hvitved
a35a178080 Data flow: Precise access paths 2020-10-16 09:03:13 +02:00
Tom Hvitved
0dc066c515 Data flow: Rename AccessPath to AccessPathApprox 2020-10-16 09:03:13 +02:00
Mathias Vorreiter Pedersen
da9e33a72c Merge pull request #4477 from dbartol/dbartol/PrintIRLocalFlow
C++: Add ability to dump local dataflow info in IR dumps
2020-10-15 17:38:16 +02:00
Dave Bartolomeo
f32a7be874 Fix formatting 2020-10-15 10:16:13 -04:00
Tamás Vajk
e62c9b1382 Merge pull request #4472 from tamasvajk/feature/cleanup-3
C#: Change public fields to properties
2020-10-15 12:16:53 +02:00
Tom Hvitved
8728017328 C#: Increase fieldFlowBranchLimit in test
68014fd3bf means that more accessors are properly
extracted, and consequently the calls to `get_Item` in the test have more dispatch
targets. Increasing `fieldFlowBranchLimit` makes the test pass again.
2020-10-15 10:40:19 +02:00
Dave Bartolomeo
dfb687fd47 C++: Add ability to dump local dataflow info in IR dumps
This change adds a new module, `PrintIRLocalFlow.qll`, which can be imported into any query that uses both `PrintIR.qll` and the IR dataflow library. The IR dump printed by `PrintIR.qll` will be annotated with information about how each operand and instruction participates in dataflow.

For each operand and instruction, the following propeties are displayed:
- `flow`: Which local operands/instructions have flow to this node, and which local operands/instruction this node has flow to.
- `source`: `true` if this node is a source
- `sink`: `true` if this node is a sink
- `barrier`: Lists which kinds of barrier this node is. Can be zero or more of `full`, `in`, `out`, and `guard`. If the node is a guard barrier, the IR of the guarding instruction is also printed.

We already had a way to print additional properties for instructions and blocks, but not for operands. I added support for operand properties to `IRPropertyProvider`. These are now printed in a curly-brace-enclosed list immediately after the corresponding operand.

When printing flow, instructions are identified by their result ID (e.g., `m128`). Operands are identified by both the result ID of their instruction and their kind (e.g., `r145.left`). For flow from an operand to its use instruction, it just prints `result` at the operand, and prints only the operand kind on the instruction.

Example output:
```
#  344|     m344_34(vector<int, allocator<int>>)                                               = Chi                             : total:m344_20{flow:def->@, @->result}, partial:m344_33{flow:def->@, @->result}
#  344|         flow = total->@, partial->@, +m344_33->@, @->+r347_3, @->v347_7.side_effect, @->m347_9.total, @->m344_20.1
```
The `+` annotations indicate when the flow came from `isAdditionalFlowStep()`, rather than built-in local flow.
2020-10-14 18:09:54 -04:00
Dave Bartolomeo
794a6729bc C++: Add ability to dump local dataflow info in IR dumps
This change adds a new module, `PrintIRLocalFlow.qll`, which can be imported into any query that uses both `PrintIR.qll` and the IR dataflow library. The IR dump printed by `PrintIR.qll` will be annotated with information about how each operand and instruction participates in dataflow.

For each operand and instruction, the following propeties are displayed:
- `flow`: Which local operands/instructions have flow to this node, and which local operands/instruction this node has flow to.
- `source`: `true` if this node is a source
- `sink`: `true` if this node is a sink
- `barrier`: Lists which kinds of barrier this node is. Can be zero or more of `full`, `in`, `out`, and `guard`. If the node is a guard barrier, the IR of the guarding instruction is also printed.

We already had a way to print additional properties for instructions and blocks, but not for operands. I added support for operand properties to `IRPropertyProvider`. These are now printed in a curly-brace-enclosed list immediately after the corresponding operand.

When printing flow, instructions are identified by their result ID (e.g., `m128`). Operands are identified by both the result ID of their instruction and their kind (e.g., `r145.left`). For flow from an operand to its use instruction, it just prints `result` at the operand, and prints only the operand kind on the instruction.

Example output:
```
#  344|     m344_34(vector<int, allocator<int>>)                                               = Chi                             : total:m344_20{flow:def->@, @->result}, partial:m344_33{flow:def->@, @->result}
#  344|         flow = total->@, partial->@, +m344_33->@, @->+r347_3, @->v347_7.side_effect, @->m347_9.total, @->m344_20.1
```
The `+` annotations indicate when the flow came from `isAdditionalFlowStep()`, rather than built-in local flow.
2020-10-14 18:02:45 -04:00
Tamas Vajk
5a91736b7a C#: Change public fields to properties 2020-10-14 14:44:01 +02:00
Tom Hvitved
91806da2fa C#: Address review comments 2020-10-14 14:15:34 +02:00
Tom Hvitved
5d1a5920c7 C#: Reimplement flow-summary compilation 2020-10-14 14:15:34 +02:00
Tom Hvitved
444e607338 C#: Add missing flow through library code using params arguments 2020-10-14 14:15:34 +02:00
Tom Hvitved
f2dc2d912a C#: Add inter-procedural data-flow test for StringBuilder 2020-10-14 14:15:34 +02:00
Tom Hvitved
2af7e1c213 C#: Use CFG nodes instead of AST nodes in sign/modulus analysis 2020-10-14 13:39:44 +02:00
Tamas Vajk
1094d192ab C#: Change extraction of NamespaceDeclarations to have ID based on the location 2020-10-14 13:26:01 +02:00
Tamas Vajk
5fae440a58 C#: Reverse assignment child nodes in AST 2020-10-14 12:49:08 +02:00
Tamas Vajk
ee9a40e16d C#: Remove location from base types in the AST 2020-10-14 12:49:08 +02:00
Tom Hvitved
952b2da7d4 C#: Add copy of ControlFlowReachability.qll to be used by sign/modulus analysis 2020-10-14 10:28:08 +02:00
Tom Hvitved
c32242ed50 C#: Simplify ControlFlowReachability.qll 2020-10-14 10:28:07 +02:00
Tamas Vajk
ce9624e61d C#: Remove unneeded vscode settings from settings.json 2020-10-13 14:50:46 +02:00
Tamas Vajk
ce793c357f C#: Adjust parameters of DefinitionField ctor 2020-10-13 14:45:38 +02:00
Tamas Vajk
ea53ea0994 C#: Prefer keywords over type names 2020-10-13 14:45:38 +02:00
Tamas Vajk
8afac25120 C#: Add params modifier on override 2020-10-13 14:45:38 +02:00
Tamas Vajk
63e173198d C#: Make static member on generic class private 2020-10-13 14:45:38 +02:00
Tamas Vajk
6cf20d569d C#: Remove overrides that do nothing 2020-10-13 14:45:38 +02:00
Tamas Vajk
9b349eb844 C#: Use Contains instead of IndexOf 2020-10-13 14:45:38 +02:00
Tamas Vajk
5b33f43b78 C#: Use nameof 2020-10-13 14:45:38 +02:00
Tamas Vajk
f84669904b C#: Fix typo 2020-10-13 14:45:38 +02:00
Tamas Vajk
7075c6f8ca C#: Fix public property naming 2020-10-13 14:45:38 +02:00