summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/DeclOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-03-07 17:54:44 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-03-07 17:54:44 +0000
commit25ed0c07c1ce7835c2bca9d72e34aefda5294f40 (patch)
tree7a233e3c43b8603425fc3ab4694c8e0d78b37ee6 /clang/lib/AST/DeclOpenMP.cpp
parent6ca0985aa572f25635f28ce8385dba112d56b6e9 (diff)
downloadbcm5719-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.cpp30
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.
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud