[flang-commits] [flang] [flang] Add traits to several AST nodes, NFC (PR #175065)

via flang-commits flang-commits at lists.llvm.org
Thu Jan 8 12:43:33 PST 2026


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- flang/include/flang/Parser/dump-parse-tree.h flang/include/flang/Parser/parse-tree-visitor.h flang/include/flang/Parser/parse-tree.h flang/lib/Lower/Bridge.cpp flang/lib/Parser/parse-tree.cpp flang/lib/Parser/unparse.cpp flang/lib/Semantics/check-case.cpp flang/lib/Semantics/expression.cpp flang/lib/Semantics/resolve-names.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/lib/Semantics/check-case.cpp b/flang/lib/Semantics/check-case.cpp
index 1b00db91b..e102257e8 100644
--- a/flang/lib/Semantics/check-case.cpp
+++ b/flang/lib/Semantics/check-case.cpp
@@ -117,27 +117,27 @@ private:
 
   using PairOfValues = std::pair<std::optional<Value>, std::optional<Value>>;
   PairOfValues ComputeBounds(const parser::CaseValueRange &range) {
-    return common::visit(
-        common::visitors{
-            [&](const parser::CaseValue &x) {
-              auto value{GetValue(x)};
-              return PairOfValues{value, value};
-            },
-            [&](const parser::CaseValueRange::Range &x) {
-              auto &[lower, upper]{x.t};
-              std::optional<Value> lo, hi;
-              if (lower) {
-                lo = GetValue(*lower);
-              }
-              if (upper) {
-                hi = GetValue(*upper);
-              }
-              if ((lower && !lo) || (upper && !hi)) {
-                return PairOfValues{}; // error case
-              }
-              return PairOfValues{std::move(lo), std::move(hi)};
-            },
-        },
+    return common::visit(common::visitors{
+                             [&](const parser::CaseValue &x) {
+                               auto value{GetValue(x)};
+                               return PairOfValues{value, value};
+                             },
+                             [&](const parser::CaseValueRange::Range &x) {
+                               auto &[lower, upper]{x.t};
+                               std::optional<Value> lo, hi;
+                               if (lower) {
+                                 lo = GetValue(*lower);
+                               }
+                               if (upper) {
+                                 hi = GetValue(*upper);
+                               }
+                               if ((lower && !lo) || (upper && !hi)) {
+                                 return PairOfValues{}; // error case
+                               }
+                               return PairOfValues{
+                                   std::move(lo), std::move(hi)};
+                             },
+                         },
         range.u);
   }
 
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 6d1f87f2e..e7f1eb1f4 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -8495,8 +8495,7 @@ public:
   }
   void Post(const parser::ImportStmt &x) {
     auto &[kind, names]{x.t};
-    if (kind == common::ImportKind::None ||
-        kind == common::ImportKind::Only) {
+    if (kind == common::ImportKind::None || kind == common::ImportKind::Only) {
       if (!nestedScopes_.front().importOnly.has_value()) {
         nestedScopes_.front().importOnly.emplace();
       }

``````````

</details>


https://github.com/llvm/llvm-project/pull/175065


More information about the flang-commits mailing list