[all-commits] [llvm/llvm-project] c79635: [NFC] [Serialization] Add static assert for the si...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Wed Jan 18 18:21:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c79635cce845d66897970cd7f8d7c77b0a3c0286
      https://github.com/llvm/llvm-project/commit/c79635cce845d66897970cd7f8d7c77b0a3c0286
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2023-01-19 (Thu, 19 Jan 2023)

  Changed paths:
    M clang/include/clang/AST/DeclBase.h
    M clang/lib/Serialization/ASTWriter.cpp
    M clang/lib/Serialization/ASTWriterDecl.cpp

  Log Message:
  -----------
  [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

It is easy for the developers to forget to touch the serializer after
they add new field to decls. Then if the existing tests fail to catch
such cases, it may be a bug report from users some day. And it is
time-consuming to solve such bugs.

To mitigate the problem, I add the static_asserts in the serializer. So
that the developers can understand they need to modify the serializer
after they saw the static assertion failure. Although this can't solve
all the problems, I feel the current status can be much better.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D141992




More information about the All-commits mailing list