[clang] [Clang][Sema] set declaration invalid earlier to prevent crash in calculating record layout (PR #87173)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 1 11:00:54 PDT 2024
================
@@ -3899,6 +3899,9 @@ static QualType GetDeclSpecTypeForDeclarator(TypeProcessingState &state,
SemaRef.Diag(OwnedTagDecl->getLocation(), DiagID)
<< SemaRef.Context.getTypeDeclType(OwnedTagDecl);
D.setInvalidType(true);
+ OwnedTagDecl->setCompleteDefinition(false);
+ OwnedTagDecl->setInvalidDecl();
+ OwnedTagDecl->setCompleteDefinition();
----------------
erichkeane wrote:
Are we sure the `OwnedTagDecl` is ALWAYS a complete definition here? Should we cache the existing value before 3902 and restore that rather than always setting it complete?
https://github.com/llvm/llvm-project/pull/87173
More information about the cfe-commits
mailing list