This is an archive of the discontinued LLVM Phabricator instance.

[clang][Interp] Fix return statements with expresssion in void functions
ClosedPublic

Authored by tbaeder on Jun 23 2023, 10:48 AM.

Details

Summary
If the return type of a function is void, ReturnType is not set, but we
used to emit a RVOPtr instruction, which doesn't make sense for a
function returning void.

Diff Detail

Event Timeline

tbaeder created this revision.Jun 23 2023, 10:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2023, 10:48 AM
tbaeder requested review of this revision.Jun 23 2023, 10:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 23 2023, 10:48 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tbaeder updated this revision to Diff 534021.Jun 23 2023, 11:02 AM
shafik added inline comments.Jun 26 2023, 10:36 AM
clang/lib/AST/Interp/ByteCodeStmtGen.cpp
312

You could also guard the cleanup and emitRet above w/ this check, so as to avoid code repetition.

shafik accepted this revision.Jun 26 2023, 10:36 AM
This revision is now accepted and ready to land.Jun 26 2023, 10:36 AM
This revision was landed with ongoing or failed builds.Jul 26 2023, 2:54 AM
This revision was automatically updated to reflect the committed changes.