[AST] Fix a crash on invalid bitwidth exprs when preserving the recoveryexprs.
authorHaojian Wu <hokein.wu@gmail.com>
Fri, 27 Mar 2020 20:40:30 +0000 (21:40 +0100)
committerHaojian Wu <hokein.wu@gmail.com>
Mon, 30 Mar 2020 08:52:00 +0000 (10:52 +0200)
commitf757ecbf85605735195441abefd9c291f5e317cc
tree13fe85b02a7be5bab9037dd7fe0ced3feff2aa78
parentdcc04e09cf6e36c6d2c47057a8f201f2c0784c69
[AST] Fix a crash on invalid bitwidth exprs when preserving the recoveryexprs.

Summary:
If the bitwith expr contains errors, we mark the field decl invalid.

This patch also tweaks the behavior of ObjCInterfaceDecl to be consistent with
existing RecordDecl -- getObjCLayout method is only called with valid decls.

Reviewers: sammccall

Subscribers: cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76953
clang/lib/AST/ASTContext.cpp
clang/lib/AST/RecordLayoutBuilder.cpp
clang/lib/Sema/SemaDecl.cpp
clang/test/Sema/invalid-bitwidth-expr.mm [new file with mode: 0644]