diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 11:49:41 +0000 |
commit | 3176e97f130184ece0e1a21352c8124cc83ff24a (patch) | |
tree | 0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /lib/AST/DeclOpenMP.cpp | |
parent | 1e9b8d38881c3213d1e67b0c47ab9b2c00721a5c (diff) | |
download | FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.zip FreeBSD-src-3176e97f130184ece0e1a21352c8124cc83ff24a.tar.gz |
Vendor import of clang trunk r256633:
https://llvm.org/svn/llvm-project/cfe/trunk@256633
Diffstat (limited to 'lib/AST/DeclOpenMP.cpp')
-rw-r--r-- | lib/AST/DeclOpenMP.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/AST/DeclOpenMP.cpp b/lib/AST/DeclOpenMP.cpp index 5f8b42b..493e2cd 100644 --- a/lib/AST/DeclOpenMP.cpp +++ b/lib/AST/DeclOpenMP.cpp @@ -29,8 +29,9 @@ OMPThreadPrivateDecl *OMPThreadPrivateDecl::Create(ASTContext &C, DeclContext *DC, SourceLocation L, ArrayRef<Expr *> VL) { - OMPThreadPrivateDecl *D = new (C, DC, VL.size() * sizeof(Expr *)) - OMPThreadPrivateDecl(OMPThreadPrivate, DC, L); + OMPThreadPrivateDecl *D = + new (C, DC, additionalSizeToAlloc<Expr *>(VL.size())) + OMPThreadPrivateDecl(OMPThreadPrivate, DC, L); D->NumVars = VL.size(); D->setVars(VL); return D; @@ -39,7 +40,7 @@ OMPThreadPrivateDecl *OMPThreadPrivateDecl::Create(ASTContext &C, OMPThreadPrivateDecl *OMPThreadPrivateDecl::CreateDeserialized(ASTContext &C, unsigned ID, unsigned N) { - OMPThreadPrivateDecl *D = new (C, ID, N * sizeof(Expr *)) + OMPThreadPrivateDecl *D = new (C, ID, additionalSizeToAlloc<Expr *>(N)) OMPThreadPrivateDecl(OMPThreadPrivate, nullptr, SourceLocation()); D->NumVars = N; return D; @@ -48,7 +49,6 @@ OMPThreadPrivateDecl *OMPThreadPrivateDecl::CreateDeserialized(ASTContext &C, void OMPThreadPrivateDecl::setVars(ArrayRef<Expr *> VL) { assert(VL.size() == NumVars && "Number of variables is not the same as the preallocated buffer"); - Expr **Vars = reinterpret_cast<Expr **>(this + 1); - std::copy(VL.begin(), VL.end(), Vars); + std::uninitialized_copy(VL.begin(), VL.end(), getTrailingObjects<Expr *>()); } |