This is an archive of the discontinued LLVM Phabricator instance.

[clang] fix error recovery ICE on copy elision when returing invalid variable
ClosedPublic

Authored by mizvekov on Sep 2 2021, 1:40 PM.

Details

Summary

See PR51708.

Attempting copy elision in dependent contexts with invalid variable,
such as a variable with incomplete type, would cause a crash when attempting
to calculate it's alignment.

The fix is to just skip this optimization on invalid VarDecl, as otherwise this
provides no benefit to error recovery: This functionality does not try to
diagnose anything, it only calculates a flag which will affect where the
variable will be allocated during codegen.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Diff Detail

Event Timeline

mizvekov created this revision.Sep 2 2021, 1:40 PM
mizvekov published this revision for review.Sep 2 2021, 2:39 PM
mizvekov added reviewers: rsmith, rtrieu.
Herald added a project: Restricted Project. · View Herald TranscriptSep 2 2021, 2:39 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rtrieu accepted this revision.Sep 2 2021, 8:22 PM
This revision is now accepted and ready to land.Sep 2 2021, 8:22 PM
This revision was landed with ongoing or failed builds.Sep 3 2021, 11:34 AM
This revision was automatically updated to reflect the committed changes.