[AST] Dont invalidate a ref-type var decl if it has no initializer.
authorHaojian Wu <hokein.wu@gmail.com>
Wed, 25 May 2022 12:58:28 +0000 (14:58 +0200)
committerHaojian Wu <hokein.wu@gmail.com>
Wed, 25 May 2022 13:14:35 +0000 (15:14 +0200)
commitc673d67bc76bfa31b78e3eee23899b9f262158ea
treed6acfaab8a1182bc0e82550c03819733b36bdc7f
parent788463e72af847d11476793fdd5d57a104b18b3d
[AST] Dont invalidate a ref-type var decl if it has no initializer.

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.

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D122935
clang/lib/Sema/SemaDecl.cpp
clang/test/AST/ast-dump-invalid-initialized.cpp