summaryrefslogtreecommitdiff
path: root/lib/AST/DeclOpenMP.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-01-19 10:04:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-01-19 10:04:05 +0000
commit676fbe8105eeb6ff4bb2ed261cb212fcfdbe7b63 (patch)
tree02a1ac369cb734d0abfa5000dd86e5b7797e6a74 /lib/AST/DeclOpenMP.cpp
parentc7e70c433efc6953dc3888b9fbf9f3512d7da2b0 (diff)
Diffstat (limited to 'lib/AST/DeclOpenMP.cpp')
-rw-r--r--lib/AST/DeclOpenMP.cpp42
1 files changed, 41 insertions, 1 deletions
diff --git a/lib/AST/DeclOpenMP.cpp b/lib/AST/DeclOpenMP.cpp
index f5c3599ef6c62..b77a67cbf38da 100644
--- a/lib/AST/DeclOpenMP.cpp
+++ b/lib/AST/DeclOpenMP.cpp
@@ -54,9 +54,49 @@ void OMPThreadPrivateDecl::setVars(ArrayRef<Expr *> VL) {
}
//===----------------------------------------------------------------------===//
+// OMPRequiresDecl Implementation.
+//===----------------------------------------------------------------------===//
+
+void OMPRequiresDecl::anchor() {}
+
+OMPRequiresDecl *OMPRequiresDecl::Create(ASTContext &C, DeclContext *DC,
+ SourceLocation L,
+ ArrayRef<OMPClause *> CL) {
+ OMPRequiresDecl *D =
+ new (C, DC, additionalSizeToAlloc<OMPClause *>(CL.size()))
+ OMPRequiresDecl(OMPRequires, DC, L);
+ D->NumClauses = CL.size();
+ D->setClauses(CL);
+ return D;
+}
+
+OMPRequiresDecl *OMPRequiresDecl::CreateDeserialized(ASTContext &C, unsigned ID,
+ unsigned N) {
+ OMPRequiresDecl *D = new (C, ID, additionalSizeToAlloc<OMPClause *>(N))
+ OMPRequiresDecl(OMPRequires, nullptr, SourceLocation());
+ D->NumClauses = N;
+ return D;
+}
+
+void OMPRequiresDecl::setClauses(ArrayRef<OMPClause *> CL) {
+ assert(CL.size() == NumClauses &&
+ "Number of clauses is not the same as the preallocated buffer");
+ std::uninitialized_copy(CL.begin(), CL.end(),
+ getTrailingObjects<OMPClause *>());
+}
+
+//===----------------------------------------------------------------------===//
// OMPDeclareReductionDecl Implementation.
//===----------------------------------------------------------------------===//
+OMPDeclareReductionDecl::OMPDeclareReductionDecl(
+ Kind DK, DeclContext *DC, SourceLocation L, DeclarationName Name,
+ QualType Ty, OMPDeclareReductionDecl *PrevDeclInScope)
+ : ValueDecl(DK, DC, L, Name, Ty), DeclContext(DK), Combiner(nullptr),
+ PrevDeclInScope(PrevDeclInScope) {
+ setInitializer(nullptr, CallInit);
+}
+
void OMPDeclareReductionDecl::anchor() {}
OMPDeclareReductionDecl *OMPDeclareReductionDecl::Create(
@@ -104,5 +144,5 @@ OMPCapturedExprDecl *OMPCapturedExprDecl::CreateDeserialized(ASTContext &C,
SourceRange OMPCapturedExprDecl::getSourceRange() const {
assert(hasInit());
- return SourceRange(getInit()->getLocStart(), getInit()->getLocEnd());
+ return SourceRange(getInit()->getBeginLoc(), getInit()->getEndLoc());
}