diff options
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
| -rw-r--r-- | clang/lib/AST/Stmt.cpp | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index be19d3b2cce2..8eae04d0d9fd 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -361,12 +361,14 @@ int64_t Stmt::getID(const ASTContext &Context) const { return Context.getAllocator().identifyKnownAlignedObject<Stmt>(this); } -CompoundStmt::CompoundStmt(ArrayRef<Stmt *> Stmts, SourceLocation LB, - SourceLocation RB) - : Stmt(CompoundStmtClass), RBraceLoc(RB) { +CompoundStmt::CompoundStmt(ArrayRef<Stmt *> Stmts, FPOptionsOverride FPFeatures, + SourceLocation LB, SourceLocation RB) + : Stmt(CompoundStmtClass), LBraceLoc(LB), RBraceLoc(RB) { CompoundStmtBits.NumStmts = Stmts.size(); + CompoundStmtBits.HasFPFeatures = FPFeatures.requiresTrailingStorage(); setStmts(Stmts); - CompoundStmtBits.LBraceLoc = LB; + if (hasStoredFPFeatures()) + setStoredFPFeatures(FPFeatures); } void CompoundStmt::setStmts(ArrayRef<Stmt *> Stmts) { @@ -377,18 +379,23 @@ void CompoundStmt::setStmts(ArrayRef<Stmt *> Stmts) { } CompoundStmt *CompoundStmt::Create(const ASTContext &C, ArrayRef<Stmt *> Stmts, + FPOptionsOverride FPFeatures, SourceLocation LB, SourceLocation RB) { void *Mem = - C.Allocate(totalSizeToAlloc<Stmt *>(Stmts.size()), alignof(CompoundStmt)); - return new (Mem) CompoundStmt(Stmts, LB, RB); + C.Allocate(totalSizeToAlloc<Stmt *, FPOptionsOverride>( + Stmts.size(), FPFeatures.requiresTrailingStorage()), + alignof(CompoundStmt)); + return new (Mem) CompoundStmt(Stmts, FPFeatures, LB, RB); } -CompoundStmt *CompoundStmt::CreateEmpty(const ASTContext &C, - unsigned NumStmts) { - void *Mem = - C.Allocate(totalSizeToAlloc<Stmt *>(NumStmts), alignof(CompoundStmt)); +CompoundStmt *CompoundStmt::CreateEmpty(const ASTContext &C, unsigned NumStmts, + bool HasFPFeatures) { + void *Mem = C.Allocate( + totalSizeToAlloc<Stmt *, FPOptionsOverride>(NumStmts, HasFPFeatures), + alignof(CompoundStmt)); CompoundStmt *New = new (Mem) CompoundStmt(EmptyShell()); New->CompoundStmtBits.NumStmts = NumStmts; + New->CompoundStmtBits.HasFPFeatures = HasFPFeatures; return New; } |
