We were not handling correctly rebuilding of parameter and were not creating copies for them.
Now we will always rebuild parameter moves in TreeTransform's TransformCoroutineBodyStmt.
Details
Diff Detail
Event Timeline
test/CodeGenCoroutines/coro-params.cpp | ||
---|---|---|
103 | use %[[x_copy]] instead of %x1 here |
@GorNishanov I think we should be transforming the move parameters, instead of re-building them entirely. I'll put together a different set of changes.
lib/Sema/SemaCoroutine.cpp | ||
---|---|---|
1285 | We could wire through a flag to tell AddInitializerToDecl to build the InitializationSequence but not Perform it, but I don't think it's worth the effort. In fact, I'd prefer that we store the copy statement in the AST regardless, and make the choice to elide the copy from within CodeGen. (Sema shouldn't be dropping parts of the AST just because CodeGen doesn't need them; for example, a tool that wants to identify all potential callers of the move constructor should be able to find this call.) I think we should also disable elision of parameter copies under -fno-elide-constructors. |
lib/Sema/SemaCoroutine.cpp | ||
---|---|---|
1285 | Makes sense that we shouldn't drop this from the AST. I'll fix that. |
@rsmith Is there a better way to check if the move would be valid for unnamed parameters without building up these expressions?