Commit 375437ab authored by Alexey Bataev's avatar Alexey Bataev
Browse files

[OPENMP50]Support 'destroy' clause on 'depobj' directives.

Added basic support (parsing/sema/serialization) for 'destroy' clause in
depobj directives.
parent 63776766
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -6693,6 +6693,46 @@ public:
  }
};

/// 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>
+5 −0
Original line number Diff line number Diff line
@@ -3159,6 +3159,11 @@ bool RecursiveASTVisitor<Derived>::VisitOMPNogroupClause(OMPNogroupClause *) {
  return true;
}

template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPDestroyClause(OMPDestroyClause *) {
  return true;
}

template <typename Derived>
template <typename T>
bool RecursiveASTVisitor<Derived>::VisitOMPClauseList(T *Node) {
+2 −0
Original line number Diff line number Diff line
@@ -276,6 +276,7 @@ OPENMP_CLAUSE(allocate, OMPAllocateClause)
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)
@@ -1084,6 +1085,7 @@ OPENMP_FLUSH_CLAUSE(release)

// Clauses allowed for OpenMP directive 'depobj'.
OPENMP_DEPOBJ_CLAUSE(depend)
OPENMP_DEPOBJ_CLAUSE(destroy)

#undef OPENMP_DEPOBJ_CLAUSE
#undef OPENMP_FLUSH_CLAUSE
+3 −0
Original line number Diff line number Diff line
@@ -10344,6 +10344,9 @@ public:
  /// 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);
+6 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ const OMPClauseWithPreInit *OMPClauseWithPreInit::get(const OMPClause *C) {
  case OMPC_match:
  case OMPC_nontemporal:
  case OMPC_order:
  case OMPC_destroy:
    break;
  }

@@ -228,6 +229,7 @@ const OMPClauseWithPostUpdate *OMPClauseWithPostUpdate::get(const OMPClause *C)
  case OMPC_match:
  case OMPC_nontemporal:
  case OMPC_order:
  case OMPC_destroy:
    break;
  }

@@ -1423,6 +1425,10 @@ void OMPClausePrinter::VisitOMPHintClause(OMPHintClause *Node) {
  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(),
Loading