}
};
+/// This represents 'destroy' clause in the '#pragma omp depobj'
+/// directive.
+///
+/// \code
+/// #pragma omp depobj(a) destroy
+/// \endcode
+/// In this example directive '#pragma omp depobj' has 'destroy' clause.
+class OMPDestroyClause final : public OMPClause {
+public:
+ /// Build 'destroy' clause.
+ ///
+ /// \param StartLoc Starting location of the clause.
+ /// \param EndLoc Ending location of the clause.
+ OMPDestroyClause(SourceLocation StartLoc, SourceLocation EndLoc)
+ : OMPClause(OMPC_destroy, StartLoc, EndLoc) {}
+
+ /// Build an empty clause.
+ OMPDestroyClause()
+ : OMPClause(OMPC_destroy, SourceLocation(), SourceLocation()) {}
+
+ child_range children() {
+ return child_range(child_iterator(), child_iterator());
+ }
+
+ const_child_range children() const {
+ return const_child_range(const_child_iterator(), const_child_iterator());
+ }
+
+ child_range used_children() {
+ return child_range(child_iterator(), child_iterator());
+ }
+ const_child_range used_children() const {
+ return const_child_range(const_child_iterator(), const_child_iterator());
+ }
+
+ static bool classof(const OMPClause *T) {
+ return T->getClauseKind() == OMPC_destroy;
+ }
+};
+
/// This class implements a simple visitor for OMPClause
/// subclasses.
template<class ImplClass, template <typename> class Ptr, typename RetTy>
}
template <typename Derived>
+bool RecursiveASTVisitor<Derived>::VisitOMPDestroyClause(OMPDestroyClause *) {
+ return true;
+}
+
+template <typename Derived>
template <typename T>
bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
for (auto *E : Node->varlists()) {
OPENMP_CLAUSE(nontemporal, OMPNontemporalClause)
OPENMP_CLAUSE(order, OMPOrderClause)
OPENMP_CLAUSE(depobj, OMPDepobjClause)
+OPENMP_CLAUSE(destroy, OMPDestroyClause)
// Clauses allowed for OpenMP directive 'parallel'.
OPENMP_PARALLEL_CLAUSE(if)
// Clauses allowed for OpenMP directive 'depobj'.
OPENMP_DEPOBJ_CLAUSE(depend)
+OPENMP_DEPOBJ_CLAUSE(destroy)
#undef OPENMP_DEPOBJ_CLAUSE
#undef OPENMP_FLUSH_CLAUSE
/// Called on well-formed 'relaxed' clause.
OMPClause *ActOnOpenMPRelaxedClause(SourceLocation StartLoc,
SourceLocation EndLoc);
+ /// Called on well-formed 'destroy' clause.
+ OMPClause *ActOnOpenMPDestroyClause(SourceLocation StartLoc,
+ SourceLocation EndLoc);
/// Called on well-formed 'threads' clause.
OMPClause *ActOnOpenMPThreadsClause(SourceLocation StartLoc,
SourceLocation EndLoc);
case OMPC_match:
case OMPC_nontemporal:
case OMPC_order:
+ case OMPC_destroy:
break;
}
case OMPC_match:
case OMPC_nontemporal:
case OMPC_order:
+ case OMPC_destroy:
break;
}
OS << ")";
}
+void OMPClausePrinter::VisitOMPDestroyClause(OMPDestroyClause *) {
+ OS << "destroy";
+}
+
template<typename T>
void OMPClausePrinter::VisitOMPClauseList(T *Node, char StartSym) {
for (typename T::varlist_iterator I = Node->varlist_begin(),
void OMPClauseProfiler::VisitOMPNogroupClause(const OMPNogroupClause *) {}
+void OMPClauseProfiler::VisitOMPDestroyClause(const OMPDestroyClause *) {}
+
template<typename T>
void OMPClauseProfiler::VisitOMPClauseList(T *Node) {
for (auto *E : Node->varlists()) {
case OMPC_dynamic_allocators:
case OMPC_match:
case OMPC_nontemporal:
+ case OMPC_destroy:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
case OMPC_dynamic_allocators:
case OMPC_match:
case OMPC_nontemporal:
+ case OMPC_destroy:
break;
}
llvm_unreachable("Invalid OpenMP simple clause kind");
case OMPC_match:
case OMPC_nontemporal:
case OMPC_order:
+ case OMPC_destroy:
llvm_unreachable("Clause is not allowed in 'omp atomic'.");
}
}
/// from-clause | is_device_ptr-clause | task_reduction-clause |
/// in_reduction-clause | allocator-clause | allocate-clause |
/// acq_rel-clause | acquire-clause | release-clause | relaxed-clause |
-/// depobj-clause
+/// depobj-clause | destroy-clause
///
OMPClause *Parser::ParseOpenMPClause(OpenMPDirectiveKind DKind,
OpenMPClauseKind CKind, bool FirstClause) {
case OMPC_unified_shared_memory:
case OMPC_reverse_offload:
case OMPC_dynamic_allocators:
+ case OMPC_destroy:
// OpenMP [2.7.1, Restrictions, p. 9]
// Only one ordered clause can appear on a loop directive.
// OpenMP [2.7.1, Restrictions, C/C++, p. 4]
case OMPC_is_device_ptr:
case OMPC_nontemporal:
case OMPC_order:
+ case OMPC_destroy:
continue;
case OMPC_allocator:
case OMPC_flush:
case OMPC_match:
case OMPC_nontemporal:
case OMPC_order:
+ case OMPC_destroy:
llvm_unreachable("Clause is not allowed.");
}
return Res;
case OMPC_match:
case OMPC_nontemporal:
case OMPC_order:
+ case OMPC_destroy:
llvm_unreachable("Unexpected OpenMP clause.");
}
return CaptureRegion;
case OMPC_device_type:
case OMPC_match:
case OMPC_nontemporal:
+ case OMPC_destroy:
llvm_unreachable("Clause is not allowed.");
}
return Res;
case OMPC_match:
case OMPC_nontemporal:
case OMPC_order:
+ case OMPC_destroy:
llvm_unreachable("Clause is not allowed.");
}
return Res;
case OMPC_dynamic_allocators:
Res = ActOnOpenMPDynamicAllocatorsClause(StartLoc, EndLoc);
break;
+ case OMPC_destroy:
+ Res = ActOnOpenMPDestroyClause(StartLoc, EndLoc);
+ break;
case OMPC_if:
case OMPC_final:
case OMPC_num_threads:
return new (Context) OMPDynamicAllocatorsClause(StartLoc, EndLoc);
}
+OMPClause *Sema::ActOnOpenMPDestroyClause(SourceLocation StartLoc,
+ SourceLocation EndLoc) {
+ return new (Context) OMPDestroyClause(StartLoc, EndLoc);
+}
+
OMPClause *Sema::ActOnOpenMPVarListClause(
OpenMPClauseKind Kind, ArrayRef<Expr *> VarList, Expr *TailExpr,
const OMPVarListLocTy &Locs, SourceLocation ColonLoc,
case OMPC_device_type:
case OMPC_match:
case OMPC_order:
+ case OMPC_destroy:
llvm_unreachable("Clause is not allowed.");
}
return Res;
}
template <typename Derived>
+OMPClause *
+TreeTransform<Derived>::TransformOMPDestroyClause(OMPDestroyClause *C) {
+ // No need to rebuild this clause, no template-dependent parameters.
+ return C;
+}
+
+template <typename Derived>
OMPClause *TreeTransform<Derived>::TransformOMPUnifiedAddressClause(
OMPUnifiedAddressClause *C) {
llvm_unreachable("unified_address clause cannot appear in dependent context");
case OMPC_order:
C = new (Context) OMPOrderClause();
break;
+ case OMPC_destroy:
+ C = new (Context) OMPDestroyClause();
+ break;
}
assert(C && "Unknown OMPClause type");
void OMPClauseReader::VisitOMPNogroupClause(OMPNogroupClause *) {}
+void OMPClauseReader::VisitOMPDestroyClause(OMPDestroyClause *) {}
+
void OMPClauseReader::VisitOMPUnifiedAddressClause(OMPUnifiedAddressClause *) {}
void OMPClauseReader::VisitOMPUnifiedSharedMemoryClause(
void OMPClauseWriter::VisitOMPNogroupClause(OMPNogroupClause *) {}
+void OMPClauseWriter::VisitOMPDestroyClause(OMPDestroyClause *) {}
+
void OMPClauseWriter::VisitOMPPrivateClause(OMPPrivateClause *C) {
Record.push_back(C->varlist_size());
Record.AddSourceLocation(C->getLParenLoc());
T tmain(T argc) {
static T a;
#pragma omp depobj(a) depend(in:argc)
+#pragma omp depobj(argc) destroy
return argc;
}
// CHECK: static T a;
// CHECK-NEXT: #pragma omp depobj (a) depend(in : argc){{$}}
+// CHECK-NEXT: #pragma omp depobj (argc) destroy{{$}}
// CHECK: static void *a;
// CHECK-NEXT: #pragma omp depobj (a) depend(in : argc){{$}}
+// CHECK-NEXT: #pragma omp depobj (argc) destroy{{$}}
int main(int argc, char **argv) {
static omp_depend_t a;
// CHECK: static omp_depend_t a;
// CHECK-NEXT: omp_depend_t b;
#pragma omp depobj(a) depend(out:argc, argv)
+#pragma omp depobj(b) destroy
// CHECK-NEXT: #pragma omp depobj (a) depend(out : argc,argv)
+// CHECK-NEXT: #pragma omp depobj (b) destroy
(void)tmain(a), tmain(b);
return 0;
}
#pragma omp depobj(x) untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp depobj'}}
#pragma omp depobj(x) unknown // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
if (argc)
-#pragma omp depobj(x) depend(in:s) // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
+#pragma omp depobj(x) destroy // expected-error {{'#pragma omp depobj' cannot be an immediate substatement}}
if (argc) {
#pragma omp depobj(x) depend(in:s)
}
;
#pragma omp depobj(x) seq_cst // expected-error {{unexpected OpenMP clause 'seq_cst' in directive '#pragma omp depobj'}}
#pragma omp depobj(x) depend(in: x)
+#pragma omp depobj(x) destroy destroy // expected-error {{directive '#pragma omp depobj' cannot contain more than one 'destroy' clause}}
+#pragma omp depobj(x) depend(in: x) destroy // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
+#pragma omp depobj(x) destroy depend(in: x) // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
#pragma omp depobj(x) (x) depend(in: x) // expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
#pragma omp depobj(x) depend(in: x) depend(out:x) // expected-error {{exactly one of 'depend', 'destroy', or 'update' clauses is expected}}
#pragma omp depend(out:x) depobj(x) // expected-error {{expected an OpenMP directive}}
+#pragma omp destroy depobj(x) // expected-error {{expected an OpenMP directive}}
#pragma omp depobj depend(in:x) (x) // expected-error {{expected depobj expression}} expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
+#pragma omp depobj destroy (x) // expected-error {{expected depobj expression}} expected-warning {{extra tokens at the end of '#pragma omp depobj' are ignored}}
return tmain(argc); // expected-note {{in instantiation of function template specialization 'tmain<int>' requested here}}
}
void OMPClauseEnqueue::VisitOMPNogroupClause(const OMPNogroupClause *) {}
+void OMPClauseEnqueue::VisitOMPDestroyClause(const OMPDestroyClause *) {}
+
void OMPClauseEnqueue::VisitOMPUnifiedAddressClause(
const OMPUnifiedAddressClause *) {}