[PATCH] D114256: [clang-tidy] Fix crashing altera-struct-pack-align on invalid RecordDecls

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 23 08:38:55 PST 2021


martong added a comment.

What happens if this checker runs on a forward declared class?

  struct Foo;

I'd expect the pack/alignment info is missing also in that case.



================
Comment at: clang-tools-extra/clang-tidy/altera/StructPackAlignCheck.cpp:54
 
+  // Ignore invalid decls to prevent crashing on calling `getASTRecordLayout`.
+  if (Struct->isInvalidDecl())
----------------
I'd mention first that packing and alignment info are meaningless for invalid declarations.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114256/new/

https://reviews.llvm.org/D114256



More information about the cfe-commits mailing list