This is an archive of the discontinued LLVM Phabricator instance.

[clang][Sema] Fix crash on invalid base destructor
ClosedPublic

Authored by kadircet on Oct 5 2022, 3:27 AM.

Details

Summary

LookupSpecialMember might fail, so changes the cast to cast_or_null.
Inside Sema, skip a particular base, similar to other cases, rather than
asserting on dtor showing up.

Other option would be to mark classes with invalid destructors as invalid, but
that seems like a lot more invasive and we do lose lots of diagnostics that
currently work on classes with broken members.

Diff Detail

Event Timeline

kadircet created this revision.Oct 5 2022, 3:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2022, 3:27 AM
kadircet requested review of this revision.Oct 5 2022, 3:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 5 2022, 3:27 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
hokein accepted this revision.Oct 5 2022, 6:10 AM

looks good, Sema::LookupDefaultConstructor already does the similar thing as well.

clang/lib/Sema/SemaDeclCXX.cpp
5702–5704

I think we should do similar change on L5699, L5736 as well.

clang/lib/Sema/SemaLookup.cpp
3620–3623

nit: the prefix llvm:: can be eliminated.

This revision is now accepted and ready to land.Oct 5 2022, 6:10 AM
kadircet updated this revision to Diff 465365.Oct 5 2022, 6:22 AM
kadircet marked 2 inline comments as done.

-address comments

This revision was landed with ongoing or failed builds.Oct 5 2022, 6:23 AM
This revision was automatically updated to reflect the committed changes.