This is an archive of the discontinued LLVM Phabricator instance.

[AST] Dont invalidate a ref-type var decl if it has no initializer.
ClosedPublic

Authored by hokein on Apr 1 2022, 12:52 PM.

Details

Summary

This would allow more AST nodes being preserved for broken code, and
have a more consistent valid bit for ref-type var decl (currently, a
ref-type var decl with a broken initializer is valid).

Per https://reviews.llvm.org/D76831#1973053, the initializer of a variable
should play no part in its "invalid" bit.

Diff Detail

Event Timeline

hokein created this revision.Apr 1 2022, 12:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2022, 12:52 PM
hokein requested review of this revision.Apr 1 2022, 12:52 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2022, 12:52 PM
sammccall accepted this revision.Apr 4 2022, 7:25 AM

I'd be surprised if this *doesn't* break some fragile assumption somewhere, but it's a good change.

For the record, the setInvalid was added in e6565625f456123ad6eb33c84c8100d8f9411192. The other setInvalids from that patch:

So this feels like tying up a loose end consistent with prior work 👍

This revision is now accepted and ready to land.Apr 4 2022, 7:25 AM