[clang] [clang][NFC] Increase NumStmtBits by 2 as we are approaching the limit (PR #120341)
Jon Roelofs via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 18 08:35:56 PST 2024
jroelofs wrote:
> > > Let's just increase to 9 bits.
> > > Have you checked whether the size of `Stmt` or `Expr` changes when you do this?
> >
> >
> > I have these concerns as well, this ends up affecting the size of a lot of things....
> > That said, StmtNodes.td already has 267 items in it (as far as I can tell, just a wc -l on appearances of 'def'). So I don't know how we're getting away with this already.
> > Can you confirm how many are present currently?
> > I also think 9 should be plenty, 512 should cover us for many many years.
>
> I THINK I just tracked down that our current max is ~249, and I intend to add a few more for OpenACC, so this would cause us to exceed the limit, even without a downstream.
quick way to find those cases:
```
diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h
index 59c3284b422b..fb3862d42d04 100644
--- a/clang/include/clang/AST/Stmt.h
+++ b/clang/include/clang/AST/Stmt.h
@@ -1440,6 +1440,7 @@ public:
"changing bitfields changed sizeof(Stmt)");
static_assert(sizeof(*this) % alignof(void *) == 0,
"Insufficient alignment!");
+ assert(llvm::isInt<NumStmtBits>(SC));
StmtBits.sClass = SC;
if (StatisticsEnabled) Stmt::addStmtClass(SC);
}
```
https://github.com/llvm/llvm-project/pull/120341
More information about the cfe-commits
mailing list