The getASTRecordLayout method requires a valid decl.
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/AST/ASTContext.cpp | ||
---|---|---|
2463 | 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). |
clang/lib/AST/ASTContext.cpp | ||
---|---|---|
2463 | I think this is fine though it could be clearer/more explicit about how the special case is handled. if (RT->getDecl()->isInvalidDecl()) return ABIAlign; |
Comment Actions
Richard fixed this in https://github.com/llvm/llvm-project/commit/269bc3f5df6c3b75de515a48063c6941ef8fbbe6 last night.
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).