[flang-commits] [flang] OpenMP stylized expressions (PR #164984)

via flang-commits flang-commits at lists.llvm.org
Fri Oct 24 06:54:33 PDT 2025


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/openmp-utils.h flang/include/flang/Parser/parse-tree.h flang/lib/Parser/openmp-parsers.cpp flang/lib/Parser/openmp-utils.cpp flang/lib/Parser/parse-tree.cpp flang/lib/Parser/unparse.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/include/flang/Parser/parse-tree.h b/flang/include/flang/Parser/parse-tree.h
index 61a516f3b..c2aa2605b 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3546,8 +3546,7 @@ struct OmpStylizedDeclaration {
 struct OmpStylizedInstance {
   struct Instance {
     UNION_CLASS_BOILERPLATE(Instance);
-    std::variant<AssignmentStmt, CallStmt, common::Indirection<Expr>>
-        u;
+    std::variant<AssignmentStmt, CallStmt, common::Indirection<Expr>> u;
   };
   TUPLE_CLASS_BOILERPLATE(OmpStylizedInstance);
   std::tuple<std::list<OmpStylizedDeclaration>, Instance> t;
diff --git a/flang/lib/Parser/parse-tree.cpp b/flang/lib/Parser/parse-tree.cpp
index d418a73a0..ad0016e14 100644
--- a/flang/lib/Parser/parse-tree.cpp
+++ b/flang/lib/Parser/parse-tree.cpp
@@ -443,7 +443,7 @@ static bool InitCharBlocksFromStrings(llvm::MutableArrayRef<CharBlock> blocks,
 // The names should have static storage duration. Keep these names
 // in a sigle place.
 llvm::ArrayRef<CharBlock> OmpCombinerExpression::Variables() {
-  static std::string names[] {"omp_in", "omp_out"};
+  static std::string names[]{"omp_in", "omp_out"};
   static CharBlock vars[std::size(names)];
 
   [[maybe_unused]] static bool init = InitCharBlocksFromStrings(vars, names);
@@ -451,7 +451,7 @@ llvm::ArrayRef<CharBlock> OmpCombinerExpression::Variables() {
 }
 
 llvm::ArrayRef<CharBlock> OmpInitializerExpression::Variables() {
-  static std::string names[] {"omp_orig", "omp_priv"};
+  static std::string names[]{"omp_orig", "omp_priv"};
   static CharBlock vars[std::size(names)];
 
   [[maybe_unused]] static bool init = InitCharBlocksFromStrings(vars, names);
diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index 6e6d6a6fa..7963aef7b 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -2196,9 +2196,7 @@ public:
   void Unparse(const OmpStylizedDeclaration &x) {
     // empty
   }
-  void Unparse(const OmpStylizedExpression &x) {
-    Put(x.source.ToString());
-  }
+  void Unparse(const OmpStylizedExpression &x) { Put(x.source.ToString()); }
   void Unparse(const OmpStylizedInstance &x) {
     // empty
   }
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 6dc8bd347..60a5b71d1 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -1844,18 +1844,14 @@ bool OmpVisitor::Pre(const parser::OmpStylizedDeclaration &x) {
   return true;
 }
 
-void OmpVisitor::Post(const parser::OmpStylizedDeclaration &x) {
-  EndDecl();
-}
+void OmpVisitor::Post(const parser::OmpStylizedDeclaration &x) { EndDecl(); }
 
 bool OmpVisitor::Pre(const parser::OmpStylizedInstance &x) {
   PushScope(Scope::Kind::OtherConstruct, nullptr);
   return true;
 }
 
-void OmpVisitor::Post(const parser::OmpStylizedInstance &x) {
-  PopScope();
-}
+void OmpVisitor::Post(const parser::OmpStylizedInstance &x) { PopScope(); }
 
 bool OmpVisitor::Pre(const parser::OmpMapClause &x) {
   auto &mods{OmpGetModifiers(x)};

``````````

</details>


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


More information about the flang-commits mailing list