This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Implement record instance functions and returning struct types
ClosedPublic

Authored by tbaeder on Sep 19 2022, 4:26 AM.

Details

Summary

Continuation of https://reviews.llvm.org/D134057. Implement passing a This pointer to instance functions as well as handling the RVO pointer. For the latter, I'm sure there are a lot of details left, but for now this works pretty well.

Diff Detail

Event Timeline

tbaeder created this revision.Sep 19 2022, 4:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 4:26 AM
tbaeder requested review of this revision.Sep 19 2022, 4:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 19 2022, 4:26 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tbaeder updated this revision to Diff 461205.Sep 19 2022, 7:44 AM

Generally looks reasonable to me.

clang/test/AST/Interp/records.cpp
47–50

Can you think of a reasonable way for us to test that you're handling the RVO pointer properly?

tbaeder added inline comments.Sep 28 2022, 6:20 AM
clang/test/AST/Interp/records.cpp
47–50

I think this is tested already by any function returning a non-primitive value, i.e. a struct or an array, e.g. getInts() above.

aaron.ballman accepted this revision.Sep 28 2022, 6:21 AM

LGTM!

clang/test/AST/Interp/records.cpp
47–50

Oh derp, you're right!

This revision is now accepted and ready to land.Sep 28 2022, 6:21 AM
This revision was landed with ongoing or failed builds.Oct 14 2022, 1:22 AM
This revision was automatically updated to reflect the committed changes.