[PATCH] D114256: [clang-tidy] Fix crashing altera-struct-pack-align on invalid RecordDecls
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 23 09:03:08 PST 2021
steakhal added a comment.
In D114256#3149009 <https://reviews.llvm.org/D114256#3149009>, @martong wrote:
> What happens if this checker runs on a forward declared class?
The matcher `recordDecl(isStruct(), **isDefinition()**, unless(isExpansionInSystemHeader()))` filters that case.
Thanks for the review @martong!
================
Comment at: clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp:54
+ // Ignore invalid decls to prevent crashing on calling `getASTRecordLayout`.
+ if (Struct->isInvalidDecl())
----------------
martong wrote:
> I'd mention first that packing and alignment info are meaningless for invalid declarations.
Makes sense.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114256/new/
https://reviews.llvm.org/D114256
More information about the cfe-commits
mailing list