Commit Graph

345 Commits

Author SHA1 Message Date
Mathias Vorreiter Pedersen
4f23c3546f C++: Don't generate WriteSideEffect instructions for const parameter indirections. 2021-02-19 15:15:51 +01:00
Mathias Vorreiter Pedersen
24f76f9a17 C++: Accept test changes. 2021-01-27 21:57:12 +01:00
Mathias Vorreiter Pedersen
4c3a26fea8 Revert "Merge pull request #4558 from rdmarsh2/rdmarsh2/cpp/remove-initialize-nonlocal"
This reverts commit 08efd7fbd9, reversing
changes made to cb8c5e8cca.
2020-11-25 15:51:52 +01:00
Robert Marsh
14f1fa50f1 Merge branch 'main' into rdmarsh2/cpp/remove-initialize-nonlocal
Accept test changes from IR temporaries and block ordering
2020-11-10 11:14:26 -08:00
Robert Marsh
c00587d2cb C++/C#: Conflated memory as IR dump annotation
Removes the IR consistency checks for conflated memory and marks
instructions that have a conflated result with a percent sign (%)
instead. This avoids reimplementing part of the alias analysis logic
in the consistency check.
2020-11-09 14:55:47 -08:00
Cornelius Riemenschneider
78d885ee7d C++: Accept test output. 2020-11-04 16:45:07 +01:00
Dave Bartolomeo
f0b9794907 Merge remote-tracking branch 'upstream/main' into work 2020-11-03 11:33:44 -05:00
Mathias Vorreiter Pedersen
ed9ad8b5e3 Merge branch 'main' into better-syntax-for-false-positives-and-negatives-inline-expectation 2020-10-31 16:52:16 +01:00
Dave Bartolomeo
69dee154f3 Fix PR feedback 2020-10-31 09:03:51 -04:00
Dave Bartolomeo
be180aac25 Fixup after merge 2020-10-30 12:52:58 -04:00
Dave Bartolomeo
ec398b2a67 Merge remote-tracking branch 'upstream/main' into work 2020-10-30 12:36:33 -04:00
Dave Bartolomeo
42373417e2 Merge from main 2020-10-30 12:02:56 -04:00
Cornelius Riemenschneider
84fe7ba199 C++: Add support for StmtExpr to Print AST. 2020-10-30 15:53:54 +01:00
Cornelius Riemenschneider
ab42ddb0dc C++: Adjust code for the conversions PR, provide correct childIndexes for the new nodes. 2020-10-30 12:48:53 +01:00
Mathias Vorreiter Pedersen
b5234f9245 C++: Update IR inline-expectation tests 2020-10-29 19:11:54 +01:00
Cornelius Riemenschneider
4276d1f3e5 C++: Add missing comment and update test results. 2020-10-29 14:49:06 +01:00
Cornelius Riemenschneider
8c925a20a7 C++: Provide the predicates that can be used to traverse the AST as metadata. 2020-10-29 14:48:47 +01:00
Cornelius Riemenschneider
59dd892748 C++: Address review, fix bug related to Conversions. 2020-10-29 11:40:31 +01:00
Robert Marsh
7d7b0eaa7b C++: accept test changes
The conflation-related changes result from aliased accesses for which a
precise Phi node is generated.
2020-10-27 09:33:28 -07:00
Cornelius Riemenschneider
447ba205b4 C++: Move Conversions in PrintAST to the side. 2020-10-26 13:49:02 +01:00
Dave Bartolomeo
bace0dca6d Handle more cases that require synthesizing temporary objects
- Parens around qualifier expressions
- Inheritance conversions involving class prvalues
2020-10-23 12:04:09 -04:00
Robert Marsh
1a365d2098 C++: remove InitializeNonLocalInstruction from IR
Instead, have AliasedDefinition initialize read-only nonlocal memory
2020-10-21 12:12:38 -07:00
Dave Bartolomeo
ee18db7b36 Fix IR for member accesses on prvalues
This fixes the IR generation for member accesses where the qualifier is a prvalue that is _not_ the load of a `TemporaryObjectExpr`. We synthesize a temporary variable during IR generation instead. It fits into the IR construction code at the same spot as `TranslatedLoad`, since it's basically the opposite of `TranslatedLoad` (prvalue->glvalue instead of vice versa). Note that array prvalues require special treatment.

This fixes some consistency errors in the `syntax-zoo`. It introduces three new ones in `dataflow-ir-consistency.expected`, but those are along the same lines as tons of existing failures.
2020-10-21 13:32:15 -04:00
Dave Bartolomeo
98e0ae4865 Add tests for member accesses on temporary objects 2020-10-20 17:35:12 -04:00
Dave Bartolomeo
4ba281731c Fix IR generation for member access with a prvalue on the RHS
For historical reasons, the extractor marks the temporary object expression used as the qualifier of a member access as a prvalue(load), even though the current C++ standard says that the temporary object materialization results in a glvalue. Added some special handling to ignore the load for both field accesses and member function calls.

This fixes all of the consistency failures in our regular tests, and all of the related failures in `syntax-zoo` other than the ones that deal with pointers-to-member, which aren't really supported yet anyway.
2020-10-20 12:53:47 -04:00
Dave Bartolomeo
735c657326 IR consistency checks for FieldAddress and this arguments that are not actually addresses.
Exposes failures in existing tests. Also added a small test case for `FieldAddress` on a prvalue.
2020-10-20 10:32:28 -04:00
Dave Bartolomeo
7de6415d00 Accept test diffs after merge 2020-10-20 07:40:44 -04:00
Dave Bartolomeo
d0b93df4ec Merge from main 2020-10-19 15:17:19 -04:00
Ian Lynagh
987c16ed53 Merge remote-tracking branch 'upstream/main' into igfoo/unnamed 2020-10-19 19:09:41 +01:00
Dave Bartolomeo
5f6ae32f1c Accept test output after merge 2020-10-17 18:16:21 -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
Ian Lynagh
9e518d2555 C++: Accept test change for p#n -> (unnamed parameter n) 2020-10-14 12:59:47 +01:00
Ian Lynagh
7680080701 C++: Accept unnamed-function changes to tests 2020-10-13 23:52:33 +01:00
Dave Bartolomeo
80b832eb49 Fix test expectations 2020-10-06 18:27:33 -04:00
Dave Bartolomeo
badb11750a AST and IR support for TemporaryObjectExpr 2020-10-05 17:53:35 -04:00
Jonas Jensen
ab90f06ddf C++: Rename Block -> BlockStmt 2020-09-08 08:40:20 +02:00
Nick Rolfe
d7849bc13f C++: fix compilation errors in ssa.cpp 2020-08-18 18:39:00 +01:00
Dave Bartolomeo
5f290520ab C++: Accept test diffs due to opcode rename 2020-06-26 13:45:41 -04:00
Robert Marsh
1c9b6f0a48 Merge branch 'master' into ir-this-parameter-2
Accept test changes - dataflow changes are all positive
2020-06-16 11:28:49 -07:00
Dave Bartolomeo
8cbc7e8654 C++/C#: Improve consistency failure result messages
Some of our IR consistency failure query predicates already produced results in the schema as an `@kind problem` query, including `$@` replacements for the enclosing `IRFunction` to make it easier to figure out which function to dump when debugging. This change moves the rest of the query predicates in `IRConsistency.qll` to do the same. In addition, it wraps each call to `getEnclosingIRFunction()` to return an `OptionalIRFunction`, which can be either a real `IRFunction` or a placeholder in case `getEnclosingIRFunction()` returned no results. This exposes a couple new consistency failures in `syntax-zoo`, which will be fixed in a subsequent commit.

This change also deals with consistency failures when the enclosing `IRFunction` has more than one `Function` or `Location`. For multiple `Function`s, we concatenate the function names. For multiple `Location`s, we pick the first one in lexicographical order. This changes the number of results produced in the existing tests, but does't change the actual number of problems.
2020-06-15 10:46:46 -04:00
Robert Marsh
0d2f8f3825 Merge branch 'master' into ir-this-parameter-2 2020-06-05 13:52:56 -07:00
Mathias Vorreiter Pedersen
cd574e8569 Merge pull request #3589 from rdmarsh2/ir-placement-new-consistency
C++: fix IR control flow for cast in placement new
2020-05-30 13:27:34 +02:00
Robert Marsh
5ee37bcd5a Merge branch 'master' into ir-this-parameter-2
Bring in fix for duplicate virtual variables for parameter indirections
2020-05-29 14:40:45 -07:00
Jonas Jensen
7d4d435f25 Merge remote-tracking branch 'upstream/master' into Expr-location-workaround
Conflicts:
	cpp/ql/test/library-tests/dataflow/fields/dataflow-ir-consistency.expected
2020-05-29 10:04:12 +02:00
Jonas Jensen
9813258a3e Merge remote-tracking branch 'upstream/master' into Expr-location-workaround
Conflicts and semantic conflicts in `library-tests/dataflow/fields` and
`library-tests/ir/ir`.
2020-05-29 08:44:37 +02:00
Robert Marsh
f82c97b84a C++: fix IR control flow for cast in placement new 2020-05-28 16:53:21 -07:00