C++: Emit InitializeDynamicAllocation instructions for NewExpr and NewArrayExpr#3171
Conversation
|
I'd like to understand how this PR overlaps with or complements the forthcoming PR from @geoffw0 where |
|
Geoffrey's PR is #3173 |
|
My PR is #3173. Happy to make any changes that will make things easier here. |
| # 960| r960_2(unsigned long) = Constant[40] : | ||
| # 960| r960_3(void *) = Call : func:r960_1, 0:r960_2 | ||
| # 960| mu960_4(unknown) = ^CallSideEffect : ~mu959_4 | ||
| # 960| mu960_5(unknown) = ^InitializeDynamicAllocation : &:r960_3 |
There was a problem hiding this comment.
I don't know why whitespace changed for this output. I recommend hiding whitespace changes when reviewing these changes.
There was a problem hiding this comment.
The whitespace between the result+type and the = is based on the longest result+type, which got longer by moving from r966_9 to r966_10
|
Currently, this PR generates incorrect IR for placement |
It looks like the IR generation problems for placement |
Yes. The resolution is to revert it, which I have done locally. I'm running the |
|
This is probably going to give us some CPP-Differences results to look at, so let's bump the submodule pointer tomorrow, as soon as we've got an email with the nightly CPP-Differences caused by #3173. |
The gist of the PR is pretty simple: #2797 only added support for the new
InitializeDynamicAllocationinstruction for calls tomallocstyle allocation, but did not do so fornewornew[]. This PR fixes this.The implementation ended up being quite a lot of refactoring because the class emitting the
InitializeDynamicAllocationinstruction was attached to an ASTCallobject, whichnewis not part of. So I refactoredTranslatedSideEffectsinto an allocation side effect translation (TranslatedAllocationSideEffects) and call side effect translation (TranslatedCallSideEffects).