-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Emit InitializeDynamicAllocation instructions for NewExpr and NewArrayExpr #3171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll
Outdated
Show resolved
Hide resolved
cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll
Outdated
Show resolved
Hide resolved
It looks like the IR generation problems for placement |
cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedCall.qll
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment. Also, there's now a conflict with Geoffrey's PR. When resolving that, will you now be able to revert 119d4a4?
cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/TranslatedElement.qll
Show resolved
Hide resolved
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
InitializeDynamicAllocation
instruction for calls tomalloc
style allocation, but did not do so fornew
ornew[]
. This PR fixes this.The implementation ended up being quite a lot of refactoring because the class emitting the
InitializeDynamicAllocation
instruction was attached to an ASTCall
object, whichnew
is not part of. So I refactoredTranslatedSideEffects
into an allocation side effect translation (TranslatedAllocationSideEffects
) and call side effect translation (TranslatedCallSideEffects
).