summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclCXX.cpp
diff options
context:
space:
mode:
authorJames Y Knight <jyknight@google.com>2015-12-29 22:13:13 +0000
committerJames Y Knight <jyknight@google.com>2015-12-29 22:13:13 +0000
commit967eb20ebe8b399a83ac7c24da7808bd8f9011b0 (patch)
tree1b7c83ffd077bdca30d0de1a3799fb90e406d4bf /clang/lib/AST/DeclCXX.cpp
parentac6e910c427cea30423f3c28e6912c5a7d8886bf (diff)
downloadbcm5719-llvm-967eb20ebe8b399a83ac7c24da7808bd8f9011b0.tar.gz
bcm5719-llvm-967eb20ebe8b399a83ac7c24da7808bd8f9011b0.zip
[TrailingObjects] Convert Decl* classes.
Also remove now-redundant explicit alignment specification on some of the classes converted prior to TrailingObjects automatically ensuring proper alignment. llvm-svn: 256585
Diffstat (limited to 'clang/lib/AST/DeclCXX.cpp')
-rw-r--r--clang/lib/AST/DeclCXX.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 32e64b6e4ec..71bc247a007 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -1675,8 +1675,8 @@ CXXCtorInitializer::CXXCtorInitializer(ASTContext &Context,
LParenLoc(L), RParenLoc(R), IsDelegating(false), IsVirtual(false),
IsWritten(false), SourceOrderOrNumArrayIndices(NumIndices)
{
- VarDecl **MyIndices = reinterpret_cast<VarDecl **> (this + 1);
- memcpy(MyIndices, Indices, NumIndices * sizeof(VarDecl *));
+ std::uninitialized_copy(Indices, Indices + NumIndices,
+ getTrailingObjects<VarDecl *>());
}
CXXCtorInitializer *CXXCtorInitializer::Create(ASTContext &Context,
@@ -1686,8 +1686,7 @@ CXXCtorInitializer *CXXCtorInitializer::Create(ASTContext &Context,
SourceLocation R,
VarDecl **Indices,
unsigned NumIndices) {
- void *Mem = Context.Allocate(sizeof(CXXCtorInitializer) +
- sizeof(VarDecl *) * NumIndices,
+ void *Mem = Context.Allocate(totalSizeToAlloc<VarDecl *>(NumIndices),
llvm::alignOf<CXXCtorInitializer>());
return new (Mem) CXXCtorInitializer(Context, Member, MemberLoc, L, Init, R,
Indices, NumIndices);
OpenPOWER on IntegriCloud