This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Explicitly handle RVO Pointer
ClosedPublic

Authored by tbaeder on Nov 3 2022, 11:50 PM.

Details

Summary
The calling convention is:

[RVO pointer]
[instance pointer]
[... args ...]

We handle the instance pointer ourselves, BUT for the RVO pointer, we
just assumed in visitReturnStmt() that it is on top of the stack. Which
isn't true if there are other args present (and a this pointer, maybe).

Fix this by recording the RVO pointer explicitly when creating an
InterpFrame, just like we do with the instance/This pointer.

There is already a "RVOAndParams()" test in test/AST/Inter/records.cpp,
that was supposed to test this, however, it didn't trigger any
problematic behavior because the parameter and the return value have the
same type.

Diff Detail

Event Timeline

tbaeder created this revision.Nov 3 2022, 11:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 3 2022, 11:50 PM
tbaeder requested review of this revision.Nov 3 2022, 11:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 3 2022, 11:50 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision is now accepted and ready to land.Nov 22 2022, 5:43 AM
This revision was landed with ongoing or failed builds.Nov 30 2022, 1:42 AM
This revision was automatically updated to reflect the committed changes.