Author: Ziqing Luo Date: 2024-12-20T11:12:16-08:00 New Revision: 399c3a78a2577c6fc68bba7f301901a0e66e87ed
URL: https://github.com/llvm/llvm-project/commit/399c3a78a2577c6fc68bba7f301901a0e66e87ed DIFF: https://github.com/llvm/llvm-project/commit/399c3a78a2577c6fc68bba7f301901a0e66e87ed.diff LOG: [clang][NFC] Fix the static assertion in 4797437 (#120643) In the previous commit 4797437463e63ee289a1ff1904cfb7b2fe6cb4c2, 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. (rdar://141555357) Added: Modified: clang/include/clang/AST/Stmt.h Removed: ################################################################################ diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h index 07cb63956aed0d..f188bd47f5c0aa 100644 --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -114,10 +114,9 @@ class alignas(void *) Stmt { #define STMT(CLASS, PARENT) #define STMT_RANGE(BASE, FIRST, LAST) #define LAST_STMT_RANGE(BASE, FIRST, LAST) \ - static_assert( \ - llvm::isInt<NumStmtBits>(StmtClass::LAST##Class), \ - "The number of 'StmtClass'es is strictly bounded under two to " \ - "the power of 'NumStmtBits'"); + static_assert(llvm::isUInt<NumStmtBits>(StmtClass::LAST##Class), \ + "The number of 'StmtClass'es is strictly bound " \ + "by a bitfield of width NumStmtBits"); #define ABSTRACT_STMT(STMT) #include "clang/AST/StmtNodes.inc" _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits