Skip to content

[clang][NFC] Increase NumStmtBits by 2 as we are approaching the limit #120341

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions clang/include/clang/AST/Stmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,27 @@ class alignas(void *) Stmt {

//===--- Statement bitfields classes ---===//

enum { NumStmtBits = 9 };

#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'");
#define ABSTRACT_STMT(STMT)
#include "clang/AST/StmtNodes.inc"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure how much of the (clang bootstrap) build time overhead comes from this, but this seems like the kind of assertion that should be in a source file, not a header.


class StmtBitfields {
friend class ASTStmtReader;
friend class ASTStmtWriter;
friend class Stmt;

/// The statement class.
LLVM_PREFERRED_TYPE(StmtClass)
unsigned sClass : 8;
unsigned sClass : NumStmtBits;
};
enum { NumStmtBits = 8 };

class NullStmtBitfields {
friend class ASTStmtReader;
Expand Down
Loading