rjmccall added inline comments.

================
Comment at: clang/include/clang/AST/Stmt.h:1104
+    static_assert(sizeof(*this) <= 16,
                   "changing bitfields changed sizeof(Stmt)");
     static_assert(sizeof(*this) % alignof(void *) == 0,
----------------
mibintc wrote:
> rjmccall wrote:
> > What's happening here is exactly what this assertion is supposed to 
> > prevent.   If you need more bits in one of these classes (I assume it's 
> > `CXXOperatorCallExpr`), you need to either make a field in the actual class 
> > or investigate more arcane mechanisms like  trailing storage to reduce the 
> > normal impact.  The latter is probably unnecessary for 
> > `CXXOperatorCallExpr`.
> @rjmccall The reason i changed the assertion is because FPOptions is now 
> wider, so I had to change the assertion.  See line 609 above. Is there 
> something I need to do differently? 
Because `Stmt` is a common base class for so much of the AST but only needs to 
store a small amount of state itself, we have a complicated system for 
optimizing space usage in subclasses by allocating bit-fields into `Stmt`.  
Letting an individual subclass's bit-field usage run over the expected size and 
therefore inflate `Stmt` for all subclasses would be counter-productive, hence 
the `static_assert` and why it shouldn't be changed.  You need to move the 
storage of `FPOptions` into the appropriate subclass wherever it would cause 
the `static_assert` to fail.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D72841



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to