This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Allow evaluating standalone complex expressions
ClosedPublic

Authored by tbaeder on May 16 2023, 4:45 AM.

Details

Summary
We reach visitExpr() when evaluating standalone expressions. However,
the RetValue() code path was unused before, because we never reach it,
even with structs or arrays.

RetValue expects a pointer on the stack it can take apart to return an
APValue, so provide it with one.

Diff Detail

Event Timeline

tbaeder created this revision.May 16 2023, 4:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 4:45 AM
tbaeder requested review of this revision.May 16 2023, 4:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 16 2023, 4:45 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tbaeder updated this revision to Diff 522563.May 16 2023, 5:52 AM
tbaeder added inline comments.
clang/lib/AST/Interp/ByteCodeExprGen.cpp
2280

I added these changes to make the test work, but they are thematically different from the purpose of this patch. However, without them, the test doesn't work.

aaron.ballman accepted this revision.Jun 9 2023, 7:17 AM

LGTM, but you should change the summary to Allow evaluating standalone complex expressions when landing.

This revision is now accepted and ready to land.Jun 9 2023, 7:17 AM
tbaeder retitled this revision from [clang][Interp] Allow evaluating standalone composite expressions to [clang][Interp] Allow evaluating standalone complex expressions.Aug 1 2023, 3:25 AM
This revision was landed with ongoing or failed builds.Thu, Dec 14, 5:57 PM
This revision was automatically updated to reflect the committed changes.