[PATCH] D141992: [NFC] [Serialization] Add static assert for the size of the decls to mention developers to remember to touch the serializer after them modified the field of decls

Nico Weber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 18 18:32:56 PST 2023


thakis added inline comments.


================
Comment at: clang/lib/Serialization/ASTWriterDecl.cpp:2313
 void ASTDeclWriter::VisitOMPDeclareMapperDecl(OMPDeclareMapperDecl *D) {
+  static_assert(sizeof(OMPDeclareMapperDecl) == 120,
+                "You need to update the serializer after you change the fields "
----------------
How can this work? This includes an ArrayRef (http://llvm-cs.pcc.me.uk/tools/clang/include/clang/AST/DeclOpenMP.h#221) which contains a pointer and a size_t. That alone will be 16 bytes on 64-bit builds and 8 bytes on 32-bit builds.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141992



More information about the cfe-commits mailing list