Skip to content

Commit 127c759

Browse files
committed
[clang][NFC] Fix the static assertion in 4797437
In the previous commit 4797437, I used `llvm::isInt<NumStmtBits>(StmtClass::LAST##Class)` to test if `StmtClass` is strictly bounded by the an unsigned integer of 'NumStmtBits'. That is incorrect as `llvm::isInt` tests for signed integers. This commit fixes it.
1 parent d33a2c5 commit 127c759

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/include/clang/AST/Stmt.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ class alignas(void *) Stmt {
114114
#define STMT(CLASS, PARENT)
115115
#define STMT_RANGE(BASE, FIRST, LAST)
116116
#define LAST_STMT_RANGE(BASE, FIRST, LAST) \
117-
static_assert( \
118-
llvm::isInt<NumStmtBits>(StmtClass::LAST##Class), \
119-
"The number of 'StmtClass'es is strictly bounded under two to " \
120-
"the power of 'NumStmtBits'");
117+
static_assert(0 <= StmtClass::LAST##Class && \
118+
StmtClass::LAST##Class < (INT64_C(1) << NumStmtBits), \
119+
"The number of 'StmtClass'es is strictly bound by a bitfield " \
120+
"of width NumStmtBits");
121121
#define ABSTRACT_STMT(STMT)
122122
#include "clang/AST/StmtNodes.inc"
123123

0 commit comments

Comments
 (0)