[clang] [clang][NFC] Increase NumStmtBits by 2 as we are approaching the limit (PR #120341)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 18 12:39:17 PST 2024


erichkeane wrote:

> > > > Let's just increase to 9 bits.
> > > > Have you checked whether the size of `Stmt` or `Expr` changes when you do this?
> > > 
> > > 
> > > @rjmccall I've changed it to 9 bits and checked that `Stmt` and `Expr` are still 8 bytes and 16 bytes resp..
> > 
> > 
> > I think checking just those two isn't sufficient, as this is used as a 'base' type for a few other types. We probably need to ensure that other types that use bitfields don't have this problem as well. Basically any of the other bitfield types here that implicitly use `StmtBitfields` in the mask. `NullStmt`, `CompoundStmt`, and `LabelStmt`, (and every other use of `NumStmtBits`) are all ones that need checking.
> 
> The way this works is that all of these class-specific bitfields are union'ed into a single field in `Stmt`, so actually the layout of the subclasses won't change as long as the size of `Stmt` doesn't.

OH! I see!  I misremembered how this works.  Disregard the above then.

https://github.com/llvm/llvm-project/pull/120341


More information about the cfe-commits mailing list