Commit 9559834a authored by Alexey Bataev's avatar Alexey Bataev
Browse files

[OPENMP50]Add support for 'release' clause.

Added full support for 'release' clause in flush|atomic directives.
parent 4687822b
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -1955,6 +1955,46 @@ public:
  }
};

/// This represents 'release' clause in the '#pragma omp atomic|flush'
/// directives.
///
/// \code
/// #pragma omp flush release
/// \endcode
/// In this example directive '#pragma omp flush' has 'release' clause.
class OMPReleaseClause final : public OMPClause {
public:
  /// Build 'release' clause.
  ///
  /// \param StartLoc Starting location of the clause.
  /// \param EndLoc Ending location of the clause.
  OMPReleaseClause(SourceLocation StartLoc, SourceLocation EndLoc)
      : OMPClause(OMPC_release, StartLoc, EndLoc) {}

  /// Build an empty clause.
  OMPReleaseClause()
      : OMPClause(OMPC_release, 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_release;
  }
};

/// This represents clause 'private' in the '#pragma omp ...' directives.
///
/// \code
+5 −0
Original line number Diff line number Diff line
@@ -3131,6 +3131,11 @@ bool RecursiveASTVisitor<Derived>::VisitOMPAcquireClause(OMPAcquireClause *) {
  return true;
}

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

template <typename Derived>
bool RecursiveASTVisitor<Derived>::VisitOMPThreadsClause(OMPThreadsClause *) {
  return true;
+1 −1
Original line number Diff line number Diff line
@@ -9696,7 +9696,7 @@ def note_omp_atomic_capture: Note<
def err_omp_atomic_several_clauses : Error<
  "directive '#pragma omp atomic' cannot contain more than one 'read', 'write', 'update' or 'capture' clause">;
def err_omp_several_mem_order_clauses : Error<
  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', |}1'acq_rel' or 'acquire' clause">;
  "directive '#pragma omp %0' cannot contain more than one %select{'seq_cst', |}1'acq_rel', 'acquire' or 'release' clause">;
def note_omp_previous_mem_order_clause : Note<
  "'%0' clause used here">;
def err_omp_target_contains_not_only_teams : Error<
+3 −0
Original line number Diff line number Diff line
@@ -259,6 +259,7 @@ OPENMP_CLAUSE(capture, OMPCaptureClause)
OPENMP_CLAUSE(seq_cst, OMPSeqCstClause)
OPENMP_CLAUSE(acq_rel, OMPAcqRelClause)
OPENMP_CLAUSE(acquire, OMPAcquireClause)
OPENMP_CLAUSE(release, OMPReleaseClause)
OPENMP_CLAUSE(depend, OMPDependClause)
OPENMP_CLAUSE(device, OMPDeviceClause)
OPENMP_CLAUSE(threads, OMPThreadsClause)
@@ -493,6 +494,7 @@ OPENMP_ATOMIC_CLAUSE(capture)
OPENMP_ATOMIC_CLAUSE(seq_cst)
OPENMP_ATOMIC_CLAUSE(acq_rel)
OPENMP_ATOMIC_CLAUSE(acquire)
OPENMP_ATOMIC_CLAUSE(release)

// Clauses allowed for OpenMP directive 'target'.
OPENMP_TARGET_CLAUSE(if)
@@ -1092,6 +1094,7 @@ OPENMP_ORDER_KIND(concurrent)
// Clauses allowed for OpenMP directive 'flush'.
OPENMP_FLUSH_CLAUSE(acq_rel)
OPENMP_FLUSH_CLAUSE(acquire)
OPENMP_FLUSH_CLAUSE(release)

#undef OPENMP_FLUSH_CLAUSE
#undef OPENMP_ORDER_KIND
+3 −0
Original line number Diff line number Diff line
@@ -10334,6 +10334,9 @@ public:
  /// Called on well-formed 'acquire' clause.
  OMPClause *ActOnOpenMPAcquireClause(SourceLocation StartLoc,
                                      SourceLocation EndLoc);
  /// Called on well-formed 'release' clause.
  OMPClause *ActOnOpenMPReleaseClause(SourceLocation StartLoc,
                                      SourceLocation EndLoc);
  /// Called on well-formed 'threads' clause.
  OMPClause *ActOnOpenMPThreadsClause(SourceLocation StartLoc,
                                      SourceLocation EndLoc);
Loading