-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Handle block assignments #10031
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
These can under some circumstances be generated by the frontend as part of compiler generated copy constructors and assignment operators.
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.
LGTM! I only have a small comment nitpick. Feel free to fix that up in a later PR to avoid an unnecessary submodule dance.
} | ||
|
||
final override Instruction getFirstInstruction() { | ||
// The operand evaluation order should since block assignments behave like memcpy. |
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.
This comment reads a bit weird. Did you mean "[...] should be left-to-right [...]"?
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.
Woops:
// The operand evaluation order should since block assignments behave like memcpy. | |
// The operand evaluation order should not matter since block assignments behave like memcpy. |
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.
Does that make more sense?
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.
That makes a lot of sense, yes!
@@ -1450,8 +1450,6 @@ class TranslatedAssignExpr extends TranslatedNonConstantExpr { | |||
result = this.getLeftOperand().getResult() | |||
} | |||
|
|||
abstract Instruction getStoredValue(); |
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.
Wat. This was just an unused abstract member predicate lying around? Well spotted!
Block assignments may occur as part of default copy/move constructors and assignment operators that are generated by the frontend. The assignments operate like
memcpy
, where the type of the source is used determine the size of what needs to be copied.