This is an archive of the discontinued LLVM Phabricator instance.

[Sema] Mark virtual method declaration in union as invalid
ClosedPublic

Authored by ychen on Nov 3 2021, 2:32 PM.

Details

Summary

Currently, this is only diagnosed but the decl is not marked invalid. This may hit assertions down the path.

This also reverts the fix for PR49534 since it is not needed anymore.

Diff Detail

Event Timeline

ychen requested review of this revision.Nov 3 2021, 2:32 PM
ychen created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptNov 3 2021, 2:32 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ychen edited the summary of this revision. (Show Details)Nov 4 2021, 11:35 AM

@ychen, an alternative fix would be to avoid getting asking for the layout for a broken union like this. Would it be appropriate to mark the RecordDecl in Sema such that isInvalidDecl returns true? Is that already happening?

ychen added a comment.Nov 4 2021, 10:29 PM

Yeah, that would be better. I just realized it earlier today. I'll attempt that instead. Thanks for the suggestion.

ychen retitled this revision from Remove two sema checkings as assertions introduced by D79719. to Mark virtual method declaration in union as invalid.Nov 5 2021, 12:09 AM
ychen edited the summary of this revision. (Show Details)
ychen updated this revision to Diff 384975.Nov 5 2021, 12:10 AM
  • Mark virtual function in union invalid.
ychen retitled this revision from Mark virtual method declaration in union as invalid to [Sema] Mark virtual method declaration in union as invalid.Nov 5 2021, 12:16 AM

LGTM; thanks! fyi, I'll be on vacation for the next three weeks. I've added some additional reviewers to the patch based on prior reviews.

This revision is now accepted and ready to land.Nov 5 2021, 1:25 PM