[clang] [clang] Increase NumStmtBits by 2 as we are approaching the limit (PR #120341)
Ziqing Luo via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 17 17:00:13 PST 2024
https://github.com/ziqingluo-90 created https://github.com/llvm/llvm-project/pull/120341
We have already hit the limit of NumStmtBits downstream after 010d0115fc8e3834fc6f747f0841f3b1e467c4da, which adds 4 new StmtNodes.
>From 6cb8ccb8005342c74018508e7e4d267bd6f44e4c Mon Sep 17 00:00:00 2001
From: Ziqing Luo <ziqing at udel.edu>
Date: Tue, 17 Dec 2024 16:52:08 -0800
Subject: [PATCH] [clang] Increase NumStmtBits by 2 as we are approaching the
limit
We have already hit the limit of NumStmtBits downstream after
010d0115fc8e3834fc6f747f0841f3b1e467c4da, which adds 4 new StmtNodes.
---
clang/include/clang/AST/Stmt.h | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h
index 83fafbabb1d460..4d02b122c5e858 100644
--- a/clang/include/clang/AST/Stmt.h
+++ b/clang/include/clang/AST/Stmt.h
@@ -109,6 +109,18 @@ class alignas(void *) Stmt {
//===--- Statement bitfields classes ---===//
+ enum { NumStmtBits = 10 };
+
+#define STMT(CLASS, PARENT)
+#define STMT_RANGE(BASE, FIRST, LAST)
+#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
+ static_assert( \
+ StmtClass::LAST##Class < (1 << NumStmtBits), \
+ "The number of 'StmtClass'es is strictly bounded under two to " \
+ "the power of 'NumStmtBits'");
+#define ABSTRACT_STMT(STMT)
+#include "clang/AST/StmtNodes.inc"
+
class StmtBitfields {
friend class ASTStmtReader;
friend class ASTStmtWriter;
@@ -116,9 +128,8 @@ class alignas(void *) Stmt {
/// The statement class.
LLVM_PREFERRED_TYPE(StmtClass)
- unsigned sClass : 8;
+ unsigned sClass : NumStmtBits;
};
- enum { NumStmtBits = 8 };
class NullStmtBitfields {
friend class ASTStmtReader;
@@ -564,8 +575,8 @@ class alignas(void *) Stmt {
/// True if the call expression is a must-elide call to a coroutine.
unsigned IsCoroElideSafe : 1;
- /// Padding used to align OffsetToTrailingObjects to a byte multiple.
- unsigned : 24 - 4 - NumExprBits;
+ static_assert(NumExprBits == 20,
+ "No extra padding needed when NumExprBits is exactly 20.");
/// The offset in bytes from the this pointer to the start of the
/// trailing objects belonging to CallExpr. Intentionally byte sized
More information about the cfe-commits
mailing list