diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-07 17:54:44 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-07 17:54:44 +0000 |
commit | 25ed0c07c1ce7835c2bca9d72e34aefda5294f40 (patch) | |
tree | 7a233e3c43b8603425fc3ab4694c8e0d78b37ee6 /clang/lib/AST/DeclOpenMP.cpp | |
parent | 6ca0985aa572f25635f28ce8385dba112d56b6e9 (diff) | |
download | bcm5719-llvm-25ed0c07c1ce7835c2bca9d72e34aefda5294f40.tar.gz bcm5719-llvm-25ed0c07c1ce7835c2bca9d72e34aefda5294f40.zip |
[OPENMP 5.0]Add initial support for 'allocate' directive.
Added parsing/sema analysis/serialization/deserialization support for
'allocate' directive.
llvm-svn: 355614
Diffstat (limited to 'clang/lib/AST/DeclOpenMP.cpp')
-rw-r--r-- | clang/lib/AST/DeclOpenMP.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/clang/lib/AST/DeclOpenMP.cpp b/clang/lib/AST/DeclOpenMP.cpp index 39cb46705e5..f50775bced2 100644 --- a/clang/lib/AST/DeclOpenMP.cpp +++ b/clang/lib/AST/DeclOpenMP.cpp @@ -53,6 +53,36 @@ void OMPThreadPrivateDecl::setVars(ArrayRef<Expr *> VL) { } //===----------------------------------------------------------------------===// +// OMPAllocateDecl Implementation. +//===----------------------------------------------------------------------===// + +void OMPAllocateDecl::anchor() { } + +OMPAllocateDecl *OMPAllocateDecl::Create(ASTContext &C, DeclContext *DC, + SourceLocation L, + ArrayRef<Expr *> VL) { + OMPAllocateDecl *D = new (C, DC, additionalSizeToAlloc<Expr *>(VL.size())) + OMPAllocateDecl(OMPAllocate, DC, L); + D->NumVars = VL.size(); + D->setVars(VL); + return D; +} + +OMPAllocateDecl *OMPAllocateDecl::CreateDeserialized(ASTContext &C, unsigned ID, + unsigned N) { + OMPAllocateDecl *D = new (C, ID, additionalSizeToAlloc<Expr *>(N)) + OMPAllocateDecl(OMPAllocate, nullptr, SourceLocation()); + D->NumVars = N; + return D; +} + +void OMPAllocateDecl::setVars(ArrayRef<Expr *> VL) { + assert(VL.size() == NumVars && + "Number of variables is not the same as the preallocated buffer"); + std::uninitialized_copy(VL.begin(), VL.end(), getTrailingObjects<Expr *>()); +} + +//===----------------------------------------------------------------------===// // OMPRequiresDecl Implementation. //===----------------------------------------------------------------------===// |