[llvm] [OpenMP] Rename some data members in ConstructDecompositionT for clar… (PR #178475)

Krzysztof Parzyszek via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 28 09:55:58 PST 2026


https://github.com/kparzysz created https://github.com/llvm/llvm-project/pull/178475

…ity, NFC

>From cc041942098ca18669b46eb868fcd8c067749196 Mon Sep 17 00:00:00 2001
From: Krzysztof Parzyszek <Krzysztof.Parzyszek at amd.com>
Date: Wed, 28 Jan 2026 11:53:39 -0600
Subject: [PATCH] [OpenMP] Rename some data members in ConstructDecompositionT
 for clarity, NFC

---
 .../Frontend/OpenMP/ConstructDecompositionT.h | 257 +++++++++---------
 1 file changed, 129 insertions(+), 128 deletions(-)

diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index ef30d8346462f..3a9690149ddde 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -100,9 +100,9 @@ struct ConstructDecompositionT {
   ConstructDecompositionT(uint32_t ver, HelperType &helper,
                           llvm::omp::Directive dir,
                           llvm::ArrayRef<ClauseTy> clauses)
-      : version(ver), construct(dir), helper(helper) {
+      : version(ver), helper(helper), inputDirective(dir) {
     for (const ClauseTy &clause : clauses)
-      nodes.push_back(&clause);
+      inputClauses.push_back(&clause);
 
     bool success = split();
     if (!success)
@@ -126,8 +126,8 @@ struct ConstructDecompositionT {
 private:
   bool split();
 
-  bool error(const ClauseTy *node, ErrorCode ec) {
-    errors.emplace_back(node, ec);
+  bool error(const ClauseTy *input, ErrorCode ec) {
+    errors.emplace_back(input, ec);
     return false;
   }
 
@@ -196,33 +196,34 @@ struct ConstructDecompositionT {
   // Apply the clause to the only directive that allows it. If there are no
   // directives that allow it, or if there is more that one, do not apply
   // anything and return false, otherwise return true.
-  bool applyToUnique(const ClauseTy *node);
+  bool applyToUnique(const ClauseTy *input);
 
   // Apply the clause to the first directive in given range that allows it.
   // If such a directive does not exist, return false, otherwise return true.
   template <typename Iterator>
-  bool applyToFirst(const ClauseTy *node, llvm::iterator_range<Iterator> range);
+  bool applyToFirst(const ClauseTy *input,
+                    llvm::iterator_range<Iterator> range);
 
   // Apply the clause to the innermost directive that allows it. If such a
   // directive does not exist, return false, otherwise return true.
-  bool applyToInnermost(const ClauseTy *node);
+  bool applyToInnermost(const ClauseTy *input);
 
   // Apply the clause to the outermost directive that allows it. If such a
   // directive does not exist, return false, otherwise return true.
-  bool applyToOutermost(const ClauseTy *node);
+  bool applyToOutermost(const ClauseTy *input);
 
   // Apply the clause to all directives that allow it, and which satisfy
   // the predicate: bool shouldApply(LeafReprInternal). If no such
   // directives exist, return false, otherwise return true.
   template <typename Predicate>
-  bool applyIf(const ClauseTy *node, Predicate shouldApply);
+  bool applyIf(const ClauseTy *input, Predicate shouldApply);
 
   // Apply the clause to all directives that allow it. If no such directives
   // exist, return false, otherwise return true.
-  bool applyToAll(const ClauseTy *node);
+  bool applyToAll(const ClauseTy *input);
 
   template <typename Clause>
-  bool applyClause(Clause &&clause, const ClauseTy *node);
+  bool applyClause(Clause &&clause, const ClauseTy *input);
 
   bool applyClause(const tomp::clause::AllocateT<TypeTy, IdTy, ExprTy> &clause,
                    const ClauseTy *);
@@ -260,10 +261,11 @@ struct ConstructDecompositionT {
               const ClauseTy *);
 
   uint32_t version;
-  llvm::omp::Directive construct;
   HelperType &helper;
+  llvm::omp::Directive inputDirective;
+  tomp::ListT<const ClauseTy *> inputClauses;
+
   ListT<LeafReprInternal> leafs;
-  tomp::ListT<const ClauseTy *> nodes;
   std::list<ClauseTy> implicit; // Container for materialized implicit clauses.
                                 // Inserting must preserve element addresses.
   std::unordered_map<IdTy, ClauseSet> syms;
@@ -278,35 +280,35 @@ ConstructDecompositionT(uint32_t, HelperType &, llvm::omp::Directive,
 
 template <typename C, typename H>
 void ConstructDecompositionT<C, H>::addClauseSymsToMap(const ObjectTy &object,
-                                                       const ClauseTy *node) {
-  syms[object.id()].insert(node);
+                                                       const ClauseTy *input) {
+  syms[object.id()].insert(input);
 }
 
 template <typename C, typename H>
 void ConstructDecompositionT<C, H>::addClauseSymsToMap(
-    const tomp::ObjectListT<IdTy, ExprTy> &objects, const ClauseTy *node) {
+    const tomp::ObjectListT<IdTy, ExprTy> &objects, const ClauseTy *input) {
   for (auto &object : objects)
-    syms[object.id()].insert(node);
+    syms[object.id()].insert(input);
 }
 
 template <typename C, typename H>
 void ConstructDecompositionT<C, H>::addClauseSymsToMap(const TypeTy &item,
-                                                       const ClauseTy *node) {
+                                                       const ClauseTy *input) {
   // Nothing to do for types.
 }
 
 template <typename C, typename H>
 void ConstructDecompositionT<C, H>::addClauseSymsToMap(const ExprTy &item,
-                                                       const ClauseTy *node) {
+                                                       const ClauseTy *input) {
   // Nothing to do for expressions.
 }
 
 template <typename C, typename H>
 void ConstructDecompositionT<C, H>::addClauseSymsToMap(
     const tomp::clause::MapT<TypeTy, IdTy, ExprTy> &item,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   auto &objects = std::get<tomp::ObjectListT<IdTy, ExprTy>>(item.t);
-  addClauseSymsToMap(objects, node);
+  addClauseSymsToMap(objects, input);
   for (auto &object : objects) {
     if (auto base = helper.getBaseObject(object))
       mapBases.insert(base->id());
@@ -316,33 +318,33 @@ void ConstructDecompositionT<C, H>::addClauseSymsToMap(
 template <typename C, typename H>
 template <typename U>
 void ConstructDecompositionT<C, H>::addClauseSymsToMap(
-    const std::optional<U> &item, const ClauseTy *node) {
+    const std::optional<U> &item, const ClauseTy *input) {
   if (item)
-    addClauseSymsToMap(*item, node);
+    addClauseSymsToMap(*item, input);
 }
 
 template <typename C, typename H>
 template <typename U>
 void ConstructDecompositionT<C, H>::addClauseSymsToMap(
-    const tomp::ListT<U> &item, const ClauseTy *node) {
+    const tomp::ListT<U> &item, const ClauseTy *input) {
   for (auto &s : item)
-    addClauseSymsToMap(s, node);
+    addClauseSymsToMap(s, input);
 }
 
 template <typename C, typename H>
 template <typename... U, size_t... Is>
 void ConstructDecompositionT<C, H>::addClauseSymsToMap(
-    const std::tuple<U...> &item, const ClauseTy *node,
+    const std::tuple<U...> &item, const ClauseTy *input,
     std::index_sequence<Is...>) {
-  (void)node; // Silence strange warning from GCC.
-  (addClauseSymsToMap(std::get<Is>(item), node), ...);
+  (void)input; // Silence strange warning from GCC.
+  (addClauseSymsToMap(std::get<Is>(item), input), ...);
 }
 
 template <typename C, typename H>
 template <typename U>
 std::enable_if_t<std::is_enum_v<llvm::remove_cvref_t<U>>, void>
 ConstructDecompositionT<C, H>::addClauseSymsToMap(U &&item,
-                                                  const ClauseTy *node) {
+                                                  const ClauseTy *input) {
   // Nothing to do for enums.
 }
 
@@ -350,7 +352,7 @@ template <typename C, typename H>
 template <typename U>
 std::enable_if_t<llvm::remove_cvref_t<U>::EmptyTrait::value, void>
 ConstructDecompositionT<C, H>::addClauseSymsToMap(U &&item,
-                                                  const ClauseTy *node) {
+                                                  const ClauseTy *input) {
   // Nothing to do for an empty class.
 }
 
@@ -358,7 +360,7 @@ template <typename C, typename H>
 template <typename U>
 std::enable_if_t<llvm::remove_cvref_t<U>::IncompleteTrait::value, void>
 ConstructDecompositionT<C, H>::addClauseSymsToMap(U &&item,
-                                                  const ClauseTy *node) {
+                                                  const ClauseTy *input) {
   // Nothing to do for an incomplete class (they're empty).
 }
 
@@ -366,39 +368,39 @@ template <typename C, typename H>
 template <typename U>
 std::enable_if_t<llvm::remove_cvref_t<U>::WrapperTrait::value, void>
 ConstructDecompositionT<C, H>::addClauseSymsToMap(U &&item,
-                                                  const ClauseTy *node) {
-  addClauseSymsToMap(item.v, node);
+                                                  const ClauseTy *input) {
+  addClauseSymsToMap(item.v, input);
 }
 
 template <typename C, typename H>
 template <typename U>
 std::enable_if_t<llvm::remove_cvref_t<U>::TupleTrait::value, void>
 ConstructDecompositionT<C, H>::addClauseSymsToMap(U &&item,
-                                                  const ClauseTy *node) {
+                                                  const ClauseTy *input) {
   constexpr size_t tuple_size =
       std::tuple_size_v<llvm::remove_cvref_t<decltype(item.t)>>;
-  addClauseSymsToMap(item.t, node, std::make_index_sequence<tuple_size>{});
+  addClauseSymsToMap(item.t, input, std::make_index_sequence<tuple_size>{});
 }
 
 template <typename C, typename H>
 template <typename U>
 std::enable_if_t<llvm::remove_cvref_t<U>::UnionTrait::value, void>
 ConstructDecompositionT<C, H>::addClauseSymsToMap(U &&item,
-                                                  const ClauseTy *node) {
-  std::visit([&](auto &&s) { addClauseSymsToMap(s, node); }, item.u);
+                                                  const ClauseTy *input) {
+  std::visit([&](auto &&s) { addClauseSymsToMap(s, input); }, item.u);
 }
 
 // Apply a clause to the only directive that allows it. If there are no
 // directives that allow it, or if there is more that one, do not apply
 // anything and return false, otherwise return true.
 template <typename C, typename H>
-bool ConstructDecompositionT<C, H>::applyToUnique(const ClauseTy *node) {
+bool ConstructDecompositionT<C, H>::applyToUnique(const ClauseTy *input) {
   auto unique = detail::find_unique(leafs, [=](const auto &leaf) {
-    return llvm::omp::isAllowedClauseForDirective(leaf.id, node->id, version);
+    return llvm::omp::isAllowedClauseForDirective(leaf.id, input->id, version);
   });
 
   if (unique != leafs.end()) {
-    unique->clauses.push_back(node);
+    unique->clauses.push_back(input);
     return true;
   }
   return false;
@@ -409,14 +411,14 @@ bool ConstructDecompositionT<C, H>::applyToUnique(const ClauseTy *node) {
 template <typename C, typename H>
 template <typename Iterator>
 bool ConstructDecompositionT<C, H>::applyToFirst(
-    const ClauseTy *node, llvm::iterator_range<Iterator> range) {
+    const ClauseTy *input, llvm::iterator_range<Iterator> range) {
   if (range.empty())
     return false;
 
   for (auto &leaf : range) {
-    if (!llvm::omp::isAllowedClauseForDirective(leaf.id, node->id, version))
+    if (!llvm::omp::isAllowedClauseForDirective(leaf.id, input->id, version))
       continue;
-    leaf.clauses.push_back(node);
+    leaf.clauses.push_back(input);
     return true;
   }
   return false;
@@ -425,28 +427,28 @@ bool ConstructDecompositionT<C, H>::applyToFirst(
 // Apply a clause to the innermost directive that allows it. If such a
 // directive does not exist, return false, otherwise return true.
 template <typename C, typename H>
-bool ConstructDecompositionT<C, H>::applyToInnermost(const ClauseTy *node) {
-  return applyToFirst(node, llvm::reverse(leafs));
+bool ConstructDecompositionT<C, H>::applyToInnermost(const ClauseTy *input) {
+  return applyToFirst(input, llvm::reverse(leafs));
 }
 
 // Apply a clause to the outermost directive that allows it. If such a
 // directive does not exist, return false, otherwise return true.
 template <typename C, typename H>
-bool ConstructDecompositionT<C, H>::applyToOutermost(const ClauseTy *node) {
-  return applyToFirst(node, llvm::iterator_range(leafs));
+bool ConstructDecompositionT<C, H>::applyToOutermost(const ClauseTy *input) {
+  return applyToFirst(input, llvm::iterator_range(leafs));
 }
 
 template <typename C, typename H>
 template <typename Predicate>
-bool ConstructDecompositionT<C, H>::applyIf(const ClauseTy *node,
+bool ConstructDecompositionT<C, H>::applyIf(const ClauseTy *input,
                                             Predicate shouldApply) {
   bool applied = false;
   for (auto &leaf : leafs) {
-    if (!llvm::omp::isAllowedClauseForDirective(leaf.id, node->id, version))
+    if (!llvm::omp::isAllowedClauseForDirective(leaf.id, input->id, version))
       continue;
     if (!shouldApply(leaf))
       continue;
-    leaf.clauses.push_back(node);
+    leaf.clauses.push_back(input);
     applied = true;
   }
 
@@ -454,14 +456,14 @@ bool ConstructDecompositionT<C, H>::applyIf(const ClauseTy *node,
 }
 
 template <typename C, typename H>
-bool ConstructDecompositionT<C, H>::applyToAll(const ClauseTy *node) {
-  return applyIf(node, [](auto) { return true; });
+bool ConstructDecompositionT<C, H>::applyToAll(const ClauseTy *input) {
+  return applyIf(input, [](auto) { return true; });
 }
 
 template <typename C, typename H>
 template <typename Specific>
 bool ConstructDecompositionT<C, H>::applyClause(Specific &&specific,
-                                                const ClauseTy *node) {
+                                                const ClauseTy *input) {
   // The default behavior is to find the unique directive to which the
   // given clause may be applied. If there are no such directives, or
   // if there are multiple ones, flag an error.
@@ -469,8 +471,8 @@ bool ConstructDecompositionT<C, H>::applyClause(Specific &&specific,
   // S Some clauses are permitted only on a single leaf construct of the
   // S combined or composite construct, in which case the effect is as if
   // S the clause is applied to that specific construct. (p339, 31-33)
-  if (!applyToUnique(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+  if (!applyToUnique(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -488,19 +490,19 @@ bool ConstructDecompositionT<C, H>::applyClause(Specific &&specific,
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::AllocateT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   // This one needs to be applied at the end, once we know which clauses are
   // assigned to which leaf constructs.
 
   // [5.2:340:33]
-  bool applied = applyIf(node, [&](const auto &leaf) {
+  bool applied = applyIf(input, [&](const auto &leaf) {
     return llvm::any_of(leaf.clauses, [&](const ClauseTy *n) {
       return llvm::omp::isPrivatizingClause(n->id);
     });
   });
 
   if (!applied)
-    return error(node, ErrorCode::NoLeafPrivatizing);
+    return error(input, ErrorCode::NoLeafPrivatizing);
   return true;
 }
 
@@ -514,9 +516,9 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::CollapseT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
-  if (!applyToInnermost(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+    const ClauseTy *input) {
+  if (!applyToInnermost(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -530,10 +532,10 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::DefaultT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   // [5.2:340:31]
-  if (!applyToAll(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+  if (!applyToAll(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -570,14 +572,14 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::FirstprivateT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   bool applied = false;
 
   // [5.2:340:3-6]
   auto dirDistribute = findDirective(llvm::omp::OMPD_distribute);
   auto dirTeams = findDirective(llvm::omp::OMPD_teams);
   if (dirDistribute != nullptr) {
-    dirDistribute->clauses.push_back(node);
+    dirDistribute->clauses.push_back(input);
     applied = true;
     // [5.2:340:17]
     if (dirTeams != nullptr) {
@@ -587,7 +589,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
       dirTeams->clauses.push_back(shared);
     }
   } else if (dirTeams != nullptr) {
-    dirTeams->clauses.push_back(node);
+    dirTeams->clauses.push_back(input);
     applied = true;
   }
 
@@ -604,14 +606,14 @@ bool ConstructDecompositionT<C, H>::applyClause(
 
   auto dirWorksharing = findWorksharing();
   if (dirWorksharing != nullptr) {
-    dirWorksharing->clauses.push_back(node);
+    dirWorksharing->clauses.push_back(input);
     applied = true;
   }
 
   // [5.2:340:9]
   auto dirTaskloop = findDirective(llvm::omp::OMPD_taskloop);
   if (dirTaskloop != nullptr) {
-    dirTaskloop->clauses.push_back(node);
+    dirTaskloop->clauses.push_back(input);
     applied = true;
   }
 
@@ -619,7 +621,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
   auto dirParallel = findDirective(llvm::omp::OMPD_parallel);
   if (dirParallel != nullptr) {
     if (dirTaskloop == nullptr && dirWorksharing == nullptr) {
-      dirParallel->clauses.push_back(node);
+      dirParallel->clauses.push_back(input);
       applied = true;
     } else {
       // [5.2:340:15]
@@ -658,12 +660,12 @@ bool ConstructDecompositionT<C, H>::applyClause(
 
   // "task" is not handled by any of the cases above.
   if (auto dirTask = findDirective(llvm::omp::OMPD_task)) {
-    dirTask->clauses.push_back(node);
+    dirTask->clauses.push_back(input);
     applied = true;
   }
 
   if (!applied)
-    return error(node, ErrorCode::NoLeafAllowing);
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -681,7 +683,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::IfT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   using DirectiveNameModifier =
       typename clause::IfT<TypeTy, IdTy, ExprTy>::DirectiveNameModifier;
   using IfExpression = typename clause::IfT<TypeTy, IdTy, ExprTy>::IfExpression;
@@ -699,11 +701,11 @@ bool ConstructDecompositionT<C, H>::applyClause(
       hasDir->clauses.push_back(unmodified);
       return true;
     }
-    return error(node, ErrorCode::InvalidDirNameMod);
+    return error(input, ErrorCode::InvalidDirNameMod);
   }
 
-  if (!applyToAll(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+  if (!applyToAll(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -729,10 +731,10 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::LastprivateT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   // [5.2:340:21]
-  if (!applyToAll(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+  if (!applyToAll(input))
+    return error(input, ErrorCode::NoLeafAllowing);
 
   auto inFirstprivate = [&](const ObjectTy &object) {
     if (ClauseSet *set = findClausesWith(object)) {
@@ -815,10 +817,10 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::LinearT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   // [5.2:341:15.1]
-  if (!applyToInnermost(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+  if (!applyToInnermost(input))
+    return error(input, ErrorCode::NoLeafAllowing);
 
   // [5.2:341:15.2], [5.2:341:19]
   auto dirSimd = findDirective(llvm::omp::Directive::OMPD_simd);
@@ -847,7 +849,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
       auto *firstp = makeClause(
           llvm::omp::Clause::OMPC_firstprivate,
           tomp::clause::FirstprivateT<TypeTy, IdTy, ExprTy>{/*List=*/first});
-      nodes.push_back(firstp); // Appending to the main clause list.
+      inputClauses.push_back(firstp); // Appending to the main clause list.
     }
   }
   if (!last.empty()) {
@@ -855,7 +857,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
         makeClause(llvm::omp::Clause::OMPC_lastprivate,
                    tomp::clause::LastprivateT<TypeTy, IdTy, ExprTy>{
                        {/*LastprivateModifier=*/std::nullopt, /*List=*/last}});
-    nodes.push_back(lastp); // Appending to the main clause list.
+    inputClauses.push_back(lastp); // Appending to the main clause list.
   }
   return true;
 }
@@ -871,9 +873,9 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::NowaitT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
-  if (!applyToOutermost(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+    const ClauseTy *input) {
+  if (!applyToOutermost(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -881,9 +883,9 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::OmpxAttributeT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
-  if (!applyToAll(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+    const ClauseTy *input) {
+  if (!applyToAll(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -891,9 +893,9 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::OmpxBareT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
-  if (!applyToOutermost(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+    const ClauseTy *input) {
+  if (!applyToOutermost(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -907,10 +909,10 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::OrderT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   // [5.2:340:31]
-  if (!applyToAll(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+  if (!applyToAll(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -925,9 +927,9 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::PrivateT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
-  if (!applyToInnermost(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+    const ClauseTy *input) {
+  if (!applyToInnermost(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -960,7 +962,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::ReductionT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   using ReductionTy = tomp::clause::ReductionT<TypeTy, IdTy, ExprTy>;
 
   // [5.2:340:36], [5.2:341:1], [5.2:341:3]
@@ -1035,7 +1037,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
   // Walk over the leaf constructs starting from the innermost, and apply
   // the clause as required by the spec.
   for (auto &leaf : llvm::reverse(leafs)) {
-    if (!llvm::omp::isAllowedClauseForDirective(leaf.id, node->id, version))
+    if (!llvm::omp::isAllowedClauseForDirective(leaf.id, input->id, version))
       continue;
     // Found a leaf that allows this clause. Keep track of this for better
     // error reporting.
@@ -1047,7 +1049,7 @@ bool ConstructDecompositionT<C, H>::applyClause(
     // Some form of the clause will be applied past this point.
     if (isValidModifier(leaf.id, effective, modifierApplied)) {
       // Apply clause with modifier.
-      leaf.clauses.push_back(node);
+      leaf.clauses.push_back(input);
       modifierApplied = true;
     } else {
       // Apply clause without modifier.
@@ -1058,9 +1060,9 @@ bool ConstructDecompositionT<C, H>::applyClause(
   }
 
   if (!allowingLeaf)
-    return error(node, ErrorCode::NoLeafAllowing);
+    return error(input, ErrorCode::NoLeafAllowing);
   if (!applied)
-    return error(node, ErrorCode::RedModNotApplied);
+    return error(input, ErrorCode::RedModNotApplied);
 
   tomp::ObjectListT<IdTy, ExprTy> sharedObjects;
   llvm::transform(objects, std::back_inserter(sharedObjects),
@@ -1123,10 +1125,10 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::SharedT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   // [5.2:340:31]
-  if (!applyToAll(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+  if (!applyToAll(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -1140,10 +1142,10 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H>
 bool ConstructDecompositionT<C, H>::applyClause(
     const tomp::clause::ThreadLimitT<TypeTy, IdTy, ExprTy> &clause,
-    const ClauseTy *node) {
+    const ClauseTy *input) {
   // [5.2:340:31]
-  if (!applyToAll(node))
-    return error(node, ErrorCode::NoLeafAllowing);
+  if (!applyToAll(input))
+    return error(input, ErrorCode::NoLeafAllowing);
   return true;
 }
 
@@ -1152,33 +1154,32 @@ bool ConstructDecompositionT<C, H>::applyClause(
 template <typename C, typename H> bool ConstructDecompositionT<C, H>::split() {
   bool success = true;
 
-  for (llvm::omp::Directive leaf :
-       llvm::omp::getLeafConstructsOrSelf(construct))
+  for (auto leaf : llvm::omp::getLeafConstructsOrSelf(inputDirective))
     leafs.push_back(LeafReprInternal{leaf, /*clauses=*/{}});
 
-  for (const ClauseTy *node : nodes)
-    addClauseSymsToMap(*node, node);
+  for (const ClauseTy *input : inputClauses)
+    addClauseSymsToMap(*input, input);
 
   // First we need to apply LINEAR, because it can generate additional
   // "firstprivate" and "lastprivate" clauses that apply to the combined/
   // composite construct.
   // Collect them separately, because they may modify the clause list.
   llvm::SmallVector<const ClauseTy *> linears;
-  for (const ClauseTy *node : nodes) {
-    if (node->id == llvm::omp::Clause::OMPC_linear)
-      linears.push_back(node);
+  for (const ClauseTy *input : inputClauses) {
+    if (input->id == llvm::omp::Clause::OMPC_linear)
+      linears.push_back(input);
   }
-  for (const auto *node : linears) {
+  for (const auto *input : linears) {
     success = success &&
               applyClause(std::get<tomp::clause::LinearT<TypeTy, IdTy, ExprTy>>(
-                              node->u),
-                          node);
+                              input->u),
+                          input);
   }
 
   // "allocate" clauses need to be applied last since they need to see
   // which directives have data-privatizing clauses.
-  auto skip = [](const ClauseTy *node) {
-    switch (node->id) {
+  auto skip = [](const ClauseTy *input) {
+    switch (input->id) {
     case llvm::omp::Clause::OMPC_allocate:
     case llvm::omp::Clause::OMPC_linear:
       return true;
@@ -1188,21 +1189,21 @@ template <typename C, typename H> bool ConstructDecompositionT<C, H>::split() {
   };
 
   // Apply (almost) all clauses.
-  for (const ClauseTy *node : nodes) {
-    if (skip(node))
+  for (const ClauseTy *input : inputClauses) {
+    if (skip(input))
       continue;
     success =
         success &&
-        std::visit([&](auto &&s) { return applyClause(s, node); }, node->u);
+        std::visit([&](auto &&s) { return applyClause(s, input); }, input->u);
   }
 
   // Apply "allocate".
-  for (const ClauseTy *node : nodes) {
-    if (node->id != llvm::omp::Clause::OMPC_allocate)
+  for (const ClauseTy *input : inputClauses) {
+    if (input->id != llvm::omp::Clause::OMPC_allocate)
       continue;
     success =
         success &&
-        std::visit([&](auto &&s) { return applyClause(s, node); }, node->u);
+        std::visit([&](auto &&s) { return applyClause(s, input); }, input->u);
   }
 
   return success;



More information about the llvm-commits mailing list