When there is unknown type in a struct in code compiled with -Wcast-align, the compiler crashes due to clang::ASTContext::getASTRecordLayout() failing an assert.
repro.c:1:21: error: unknown type name 'doesnotexist' struct { int hello; doesnotexist world; } foo; ^ clang: /root/llvm-project/clang/lib/AST/RecordLayoutBuilder.cpp:3230: const clang::ASTRecordLayout& clang::ASTContext::getASTRecordLayout(const clang::RecordDecl*) const: Assertion `!D->isInvalidDecl() && "Cannot get layout of invalid decl!"' failed.
Added check that the RecordDecl is valid before calling getASTRecordLayout()