Skip to content

Commit 6cb8ccb

Browse files
committed
[clang] Increase NumStmtBits by 2 as we are approaching the limit
We have already hit the limit of NumStmtBits downstream after 010d011, which adds 4 new StmtNodes.
1 parent f3a8f87 commit 6cb8ccb

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

clang/include/clang/AST/Stmt.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,16 +109,27 @@ class alignas(void *) Stmt {
109109

110110
//===--- Statement bitfields classes ---===//
111111

112+
enum { NumStmtBits = 10 };
113+
114+
#define STMT(CLASS, PARENT)
115+
#define STMT_RANGE(BASE, FIRST, LAST)
116+
#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
117+
static_assert( \
118+
StmtClass::LAST##Class < (1 << NumStmtBits), \
119+
"The number of 'StmtClass'es is strictly bounded under two to " \
120+
"the power of 'NumStmtBits'");
121+
#define ABSTRACT_STMT(STMT)
122+
#include "clang/AST/StmtNodes.inc"
123+
112124
class StmtBitfields {
113125
friend class ASTStmtReader;
114126
friend class ASTStmtWriter;
115127
friend class Stmt;
116128

117129
/// The statement class.
118130
LLVM_PREFERRED_TYPE(StmtClass)
119-
unsigned sClass : 8;
131+
unsigned sClass : NumStmtBits;
120132
};
121-
enum { NumStmtBits = 8 };
122133

123134
class NullStmtBitfields {
124135
friend class ASTStmtReader;
@@ -564,8 +575,8 @@ class alignas(void *) Stmt {
564575
/// True if the call expression is a must-elide call to a coroutine.
565576
unsigned IsCoroElideSafe : 1;
566577

567-
/// Padding used to align OffsetToTrailingObjects to a byte multiple.
568-
unsigned : 24 - 4 - NumExprBits;
578+
static_assert(NumExprBits == 20,
579+
"No extra padding needed when NumExprBits is exactly 20.");
569580

570581
/// The offset in bytes from the this pointer to the start of the
571582
/// trailing objects belonging to CallExpr. Intentionally byte sized

0 commit comments

Comments
 (0)