@@ -68,17 +68,16 @@ find_unique(Container &&container, Predicate &&pred) {
6868
6969namespace tomp {
7070
71- // ClauseType - Either instance of ClauseT, or a type derived from ClauseT.
72- //
73- // This is the clause representation in the code using this infrastructure.
74- //
75- // HelperType - A class that implements two member functions:
71+ // ClauseType: Either an instance of ClauseT, or a type derived from ClauseT.
72+ // This is the clause representation in the code using this infrastructure.
7673//
74+ // HelperType: A class that implements two member functions:
7775// // Return the base object of the given object, if any.
7876// std::optional<Object> getBaseObject(const Object &object) const
7977// // Return the iteration variable of the outermost loop associated
8078// // with the construct being worked on, if any.
8179// std::optional<Object> getLoopIterVar() const
80+
8281template <typename ClauseType, typename HelperType>
8382struct ConstructDecompositionT {
8483 using ClauseTy = ClauseType;
@@ -181,27 +180,32 @@ struct ConstructDecompositionT {
181180 std::enable_if_t <llvm::remove_cvref_t <U>::UnionTrait::value, void >
182181 addClauseSymsToMap (U &&item, const ClauseTy *);
183182
184- // Apply a clause to the only directive that allows it. If there are no
183+ // Apply the clause to the only directive that allows it. If there are no
185184 // directives that allow it, or if there is more that one, do not apply
186185 // anything and return false, otherwise return true.
187186 bool applyToUnique (const ClauseTy *node);
188187
189- // Apply a clause to the first directive in given range that allows it.
188+ // Apply the clause to the first directive in given range that allows it.
190189 // If such a directive does not exist, return false, otherwise return true.
191190 template <typename Iterator>
192191 bool applyToFirst (const ClauseTy *node, llvm::iterator_range<Iterator> range);
193192
194- // Apply a clause to the innermost directive that allows it. If such a
193+ // Apply the clause to the innermost directive that allows it. If such a
195194 // directive does not exist, return false, otherwise return true.
196195 bool applyToInnermost (const ClauseTy *node);
197196
198- // Apply a clause to the outermost directive that allows it. If such a
197+ // Apply the clause to the outermost directive that allows it. If such a
199198 // directive does not exist, return false, otherwise return true.
200199 bool applyToOutermost (const ClauseTy *node);
201200
201+ // Apply the clause to all directives that allow it, and which satisfy
202+ // the predicate: bool shouldApply(LeafReprInternal). If no such
203+ // directives exist, return false, otherwise return true.
202204 template <typename Predicate>
203205 bool applyIf (const ClauseTy *node, Predicate shouldApply);
204206
207+ // Apply the clause to all directives that allow it. If no such directives
208+ // exist, return false, otherwise return true.
205209 bool applyToAll (const ClauseTy *node);
206210
207211 template <typename Clause>
@@ -983,7 +987,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
983987 return dir == llvm::omp::Directive::OMPD_simd ||
984988 llvm::is_contained (getWorksharingLoop (), dir);
985989 case ReductionModifier::Task:
986- if (alreadyApplied)
990+ if (alreadyApplied) // Not an error
987991 return false ;
988992 // According to [5.2:135:16-18], "task" only applies to "parallel" and
989993 // worksharing constructs.
0 commit comments