diff options
author | James Y Knight <jyknight@google.com> | 2015-07-17 18:21:37 +0000 |
---|---|---|
committer | James Y Knight <jyknight@google.com> | 2015-07-17 18:21:37 +0000 |
commit | f9ae22bbac6c066418741e45afc8ea217aab952e (patch) | |
tree | da0adc3b9bc7c43d76a875d1757825097d1ed98a /lib/AST/Stmt.cpp | |
parent | d6a363a733682e145306fc1e42152e8519166b48 (diff) |
Fix alignment issues in Clang.
Some const-correctness changes snuck in here too, since they were in the
area of code I was modifying.
This seems to make Clang actually work without Bus Error on
32bit-sparc.
Follow-up patches will factor out a trailing-object helper class, to
make classes using the idiom of appending objects to other objects
easier to understand, and to ensure (with static_assert) that required
alignment guarantees continue to hold.
Differential Revision: http://reviews.llvm.org/D10272
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@242554 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Stmt.cpp')
-rw-r--r-- | lib/AST/Stmt.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp index c0aab4c4db..80b6be88a3 100644 --- a/lib/AST/Stmt.cpp +++ b/lib/AST/Stmt.cpp @@ -822,7 +822,7 @@ SourceLocation ObjCAtTryStmt::getLocEnd() const { CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, SourceLocation tryLoc, Stmt *tryBlock, ArrayRef<Stmt*> handlers) { std::size_t Size = sizeof(CXXTryStmt); - Size += ((handlers.size() + 1) * sizeof(Stmt)); + Size += ((handlers.size() + 1) * sizeof(Stmt *)); void *Mem = C.Allocate(Size, llvm::alignOf<CXXTryStmt>()); return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers); @@ -831,7 +831,7 @@ CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, SourceLocation tryLoc, CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, EmptyShell Empty, unsigned numHandlers) { std::size_t Size = sizeof(CXXTryStmt); - Size += ((numHandlers + 1) * sizeof(Stmt)); + Size += ((numHandlers + 1) * sizeof(Stmt *)); void *Mem = C.Allocate(Size, llvm::alignOf<CXXTryStmt>()); return new (Mem) CXXTryStmt(Empty, numHandlers); @@ -2250,4 +2250,3 @@ OMPTeamsDirective *OMPTeamsDirective::CreateEmpty(const ASTContext &C, C.Allocate(Size + sizeof(OMPClause *) * NumClauses + sizeof(Stmt *)); return new (Mem) OMPTeamsDirective(NumClauses); } - |