[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
Chuanqi Xu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 18 18:41:33 PST 2023
ChuanqiXu 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 "
----------------
thakis wrote:
> 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.
You're right that I forgot the case for 32-bit machine. I've reverted the patch. And I need to look for better solutions.
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