diff --git a/clang/include/clang/AST/Stmt.h b/clang/include/clang/AST/Stmt.h --- a/clang/include/clang/AST/Stmt.h +++ b/clang/include/clang/AST/Stmt.h @@ -128,8 +128,6 @@ unsigned : NumStmtBits; - unsigned NumStmts : 32 - NumStmtBits; - /// The location of the opening "{". SourceLocation LBraceLoc; }; @@ -1406,6 +1404,8 @@ friend class ASTStmtReader; friend TrailingObjects; + unsigned NumStmts; + /// The location of the closing "}". LBraceLoc is stored in CompoundStmtBits. SourceLocation RBraceLoc; @@ -1420,16 +1420,15 @@ // Build an empty compound statement with a location. explicit CompoundStmt(SourceLocation Loc) - : Stmt(CompoundStmtClass), RBraceLoc(Loc) { - CompoundStmtBits.NumStmts = 0; + : Stmt(CompoundStmtClass), NumStmts(0), RBraceLoc(Loc) { CompoundStmtBits.LBraceLoc = Loc; } // Build an empty compound statement. static CompoundStmt *CreateEmpty(const ASTContext &C, unsigned NumStmts); - bool body_empty() const { return CompoundStmtBits.NumStmts == 0; } - unsigned size() const { return CompoundStmtBits.NumStmts; } + bool body_empty() const { return NumStmts == 0; } + unsigned size() const { return NumStmts; } using body_iterator = Stmt **; using body_range = llvm::iterator_range; diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -363,14 +363,13 @@ CompoundStmt::CompoundStmt(ArrayRef Stmts, SourceLocation LB, SourceLocation RB) - : Stmt(CompoundStmtClass), RBraceLoc(RB) { - CompoundStmtBits.NumStmts = Stmts.size(); + : Stmt(CompoundStmtClass), NumStmts(Stmts.size()), RBraceLoc(RB) { setStmts(Stmts); CompoundStmtBits.LBraceLoc = LB; } void CompoundStmt::setStmts(ArrayRef Stmts) { - assert(CompoundStmtBits.NumStmts == Stmts.size() && + assert(NumStmts == Stmts.size() && "NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!"); std::copy(Stmts.begin(), Stmts.end(), body_begin()); @@ -388,7 +387,7 @@ void *Mem = C.Allocate(totalSizeToAlloc(NumStmts), alignof(CompoundStmt)); CompoundStmt *New = new (Mem) CompoundStmt(EmptyShell()); - New->CompoundStmtBits.NumStmts = NumStmts; + New->NumStmts = NumStmts; return New; }