65 Commits
Author SHA1 Message Date
Siegfried Pammer 7b1f8a305c Implemented support for string concatenation compound assignments involving ReadOnlySpan<char>. 2024-07-21 11:18:13 +02:00
Siegfried Pammer d5cec0ab37 Fix #3103: unaligned.stobj cannot be transformed into inline assignment 2023-10-17 22:15:45 +02:00
Daniel Grunwald b80d20b15d Add support for calling operator checked. 2023-06-03 18:37:15 +02:00
Daniel Grunwald 3c46271a11 Add support for unsigned right shift.
Only for user-defined operators so far; builtin right shifts still cast to the appropriate type.
2023-06-02 21:37:42 +02:00
Daniel Grunwald f04acbdd74 Simplify IsImplicitTruncation by using an enum with 3 options instead of a pair of bools.
This also fixes the logic for combining the results for BinaryNumericInstruction/IfInstruction.
2023-05-28 13:52:07 +02:00
ElektroKill ea1f6e7c25 Fixed compound assignment and post/pre increment for pointer dereference 2023-05-19 20:59:16 +02:00
ElektroKill 25873a68e0 Improve support for post-increment/decrement on pointers 2022-12-03 18:26:30 +01:00
Siegfried Pammer c5ff0cafc5 TransformInlineAssignmentStObjOrCall: Make sure no dead store is produced by the transform. 2022-07-17 09:13:05 +02:00
Daniel Grunwald bd9aabeae2 Update to dotnet-format 5.1.225507.
This makes the formatting expected by our CI consistent with that generated by VS2019.9.
2021-05-07 22:23:09 +02:00
Siegfried Pammer d2fc380e0e Fix #2349: Use proper ExpressionType with DynamicCompoundAssign. 2021-03-22 19:19:50 +01:00
dotnet format 0d9f871a4f #2128: Reformat the whole code base. 2020-08-28 01:05:38 +02:00
Daniel Grunwald 1d684102ac Support compound assignment for native integers. 2020-07-14 00:44:35 +02:00
Daniel Grunwald 93806b46fa Fix compound assignments with type bool.
This required removing the "Replace bit.and with logic.and" transform, as it interfered with the compound assignment transform.
2019-11-30 23:19:18 +01:00
Chicken-Bones 661acdfc08 Transform post-increment on float/double. Fixes #1764 2019-10-30 20:46:33 +10:00
Daniel Grunwald 752f0de978 Further adjustments to transforms now that copy propagation no longer runs. 2019-07-27 22:17:15 +02:00
Daniel Grunwald 97d490a3df Slightly generalize the post-increment transform so that it no longer depends on copy propagation. 2019-07-27 17:53:29 +02:00
Daniel Grunwald 539e3a906d Fix #1552: user-defined and decimal increments
For user-defined increments, there were problems with Roslyn was optimizing out one of the stores.
The new transform FixRemainingIncrements now takes increments/decrements that were not detected by TransformAssignment and introduces a temporary variable that can be incremented.
This sometimes requires un-inlining via the new ILInstruction.Extract() operation.
Extract() is not supported in all possible contexts, so it is possible but unlikely that some op_Increment calls remain.

For decimals, the situation is different: legacy csc actually was optimizing "d + 1m" to "op_Increment(d)", so we can get rid of any left-over increments by undoing this optimization. This now happens in ReplaceMethodCallsWithOperators.
2019-07-24 17:55:28 +02:00
Daniel Grunwald 33c7425fa2 Fix several bugs with compound assignments on indexers.
Closes #1580.
2019-07-18 20:42:01 +02:00
Daniel Grunwald b32cae412a Eliminate BlockKind.PostfixOperator.
We can now represent all compound assignments using the CompoundAssignInstruction, including those on local variables.
Closes #1583.
2019-07-17 00:33:42 +02:00
Daniel Grunwald f2151972a0 Redesign CompoundAssignmentInstruction to support an 'Address' mode where we don't implicitly turn an LdObj into an StObj, but instead directly operate on an address.
This means we can get rid of the special case in TransformDisplayClassUsage, as compound.assign can now also be used with the address of a local variable.
2019-07-16 00:11:08 +02:00
Daniel Grunwald a6def4cdf5 Fix incorrect type for numeric.compound.assign when the pointer type is incompatible with the store type.
Closes #1511, #1530, #1533.
2019-07-13 23:08:30 +02:00
Siegfried Pammer 00d6c6175a #1049: Check decompiler settings in TransformAssignment.HandleCompoundAssign as well. 2019-02-17 00:14:08 +01:00
Siegfried Pammer 087cb2489d Fix #1049: Unimplemented decompiler settings 2019-02-16 23:37:57 +01:00
Siegfried Pammer c1fca21e8a Make ILRange field private - introduce public API for IL range manipulation. 2019-02-16 20:36:17 +01:00
Siegfried Pammer 667e04462a Fix #1325: Do not perform inline assignment transform on setter calls, that belong to parameterized properties. 2018-12-18 20:56:32 +01:00
Daniel Grunwald 12e74daf48 Handle Comp in InferType(). 2018-10-14 18:09:28 +02:00
Daniel Grunwald ba0a3af3c4 #1195: Fix several issues decompiling SharpSvn.dll (C++/CLI) 2018-07-28 23:04:01 +02:00
Daniel Grunwald 066da1ea16 Fix #1200: assertion in TransformInlineAssignmentLocal when reconstructed stack slot (after async-await transform) has small integer type.
The assertion was unnecessary, because we already check 'IsImplicitTruncation(inst.Value, inst.Variable.Type)'.
2018-07-28 23:04:01 +02:00
Daniel Grunwald 4580eab7ab Disable ref inline assignments.
This increases the chances that we'll avoid CS8174: A declaration of a by-reference variable must have an initializer.
2018-07-14 01:09:22 +02:00
Daniel Grunwald 33ef82f75c Fix #1082: Add support for compound assignment with string.Concat().
Currently only supports the binary overloads of string.Concat().
2018-07-13 21:12:16 +02:00
Siegfried Pammer c4f41f459f Add support for more dynamic binary operators. 2018-06-04 22:14:29 +02:00
Siegfried Pammer 273a1c24ff Add dynamic compound assignment transforms 2018-06-01 20:15:03 +02:00
Daniel Grunwald f021ec4383 NumericCompoundAssign: implement ILiftableInstruction 2018-05-10 16:39:29 +02:00
Daniel Grunwald 3956fa685d Refactor TransformAssignment to reduce code duplication. 2018-05-10 16:19:06 +02:00
Siegfried Pammer 9ebfbe57dd Add transforms for userdef compound assignment
fix bugs in other transforms
2018-05-09 21:33:44 +02:00
Daniel Grunwald 25706f2a39 Support logic.and/etc. in IsImplicitTruncation(). 2018-05-05 23:47:52 +02:00
Daniel Grunwald 75a627d40b Don't use compound assignment when the RHS value does not fit into the LHS type. 2018-05-05 23:40:12 +02:00
Daniel Grunwald 0a1921ff67 Fix #1007: post-increment transform incorrect due to variable splitting. 2017-12-10 18:48:13 +01:00
Siegfried Pammer 349183544a Rename BlockType to BlockKind 2017-11-04 22:53:34 +01:00
Daniel Grunwald a82430fc78 Add missing safety checks to inline assignment transforms. 2017-11-01 19:07:58 +01:00
Daniel Grunwald 11631d6cf0 Remove redundant code from TransformAssignment. 2017-11-01 17:57:15 +01:00
Daniel Grunwald 7847a69d69 Fix compound assignment and post-increment. 2017-11-01 17:53:54 +01:00
Daniel Grunwald 4c5f0b7e9c Convert TransformAssignment into a statement transform and add support for inline property assignments. 2017-11-01 16:31:59 +01:00
Daniel Grunwald 40a4f08a8d Add support for compound assignment of short integers. 2017-11-01 13:49:55 +01:00
Daniel Grunwald 248a9ad76f Fix #954: don't use invalid compound assignments on enums 2017-11-01 03:31:19 +01:00
Daniel Grunwald b0bf6326ad Allow inline assignments to short integers when we can tell that there's no truncation. 2017-11-01 02:51:23 +01:00
Daniel Grunwald c7e60a9b3c Avoid using inline assignments if they truncate the input value. 2017-11-01 02:01:06 +01:00
Daniel Grunwald 385005b2e5 More strictly test the inline assignment pattern. 2017-11-01 00:35:09 +01:00
Siegfried Pammer ab1598c547 Fix bug in TransformRoslynPostIncDecOperatorOnAddress;
Add DelegateConstruction tests
2017-10-10 00:50:23 +02:00
Siegfried Pammer cf8d4936e6 Fix regression in TransformPostIncDecOperatorOnAddress;
Add pattern for Roslyn inc/dec operator on addresses
2017-10-10 00:20:34 +02:00