hokein added inline comments.
================ Comment at: clang/lib/AST/ASTContext.cpp:2463 - unsigned PreferredAlign = static_cast<unsigned>( - toBits(getASTRecordLayout(RT->getDecl()).PreferredAlignment)); - assert(PreferredAlign >= ABIAlign && - "PreferredAlign should be at least as large as ABIAlign."); - return PreferredAlign; + if (!RT->getDecl()->isInvalidDecl()) { + unsigned PreferredAlign = static_cast<unsigned>( ---------------- another proper fix might be change the `getPreferredTypeAlign` signature to support error handling (e.g. return a bool), but that would require a large invasive change for its callers, not sure it is worth. I think the current implementation is OK, as the result doesn't really matter for an invalid RecordDecl, and we do similar thing int `getTypeInfoImpl` (returning a fake `Align`/`Width` for invalid decl). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D85834/new/ https://reviews.llvm.org/D85834 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits