diff options
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 5f8b42b3f9644..493e2cd41226b 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 *>());  }  | 
