[flang-commits] [flang] [flang][PPC] Improve vector type names in expression diagnostics (NFC) (PR #199383)

via flang-commits flang-commits at lists.llvm.org
Mon May 25 08:21:23 PDT 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 h,cpp -- flang/include/flang/Support/Fortran.h flang/lib/Evaluate/formatting.cpp flang/lib/Semantics/expression.cpp flang/lib/Semantics/type.cpp flang/lib/Support/Fortran.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/Evaluate/formatting.cpp b/flang/lib/Evaluate/formatting.cpp
index f52763aaf..d7870d78d 100644
--- a/flang/lib/Evaluate/formatting.cpp
+++ b/flang/lib/Evaluate/formatting.cpp
@@ -887,12 +887,12 @@ llvm::raw_ostream &Assignment::AsFortran(llvm::raw_ostream &o) const {
   return o;
 }
 
-
 static std::string FormatVectorType(const semantics::DerivedTypeSpec &derived) {
   int64_t vecElemKind{0};
   int64_t vecElemCategory{-1};
-  
-  if (derived.category() == semantics::DerivedTypeSpec::Category::IntrinsicVector) {
+
+  if (derived.category() ==
+      semantics::DerivedTypeSpec::Category::IntrinsicVector) {
     for (const auto &pair : derived.parameters()) {
       if (pair.first == "element_category") {
         vecElemCategory = ToInt64(pair.second.GetExplicit()).value_or(-1);
@@ -901,7 +901,7 @@ static std::string FormatVectorType(const semantics::DerivedTypeSpec &derived) {
       }
     }
   }
-  
+
   return common::FormatVectorTypeAsFortran(
       static_cast<int>(derived.category()), vecElemCategory, vecElemKind);
 }
diff --git a/flang/lib/Semantics/expression.cpp b/flang/lib/Semantics/expression.cpp
index 34810ce0e..ceca9436e 100644
--- a/flang/lib/Semantics/expression.cpp
+++ b/flang/lib/Semantics/expression.cpp
@@ -5538,8 +5538,9 @@ std::string ArgumentAnalyzer::TypeAsFortran(std::size_t i) {
         : type->IsUnlimitedPolymorphic() ? "CLASS(*)"s
         : type->IsPolymorphic()          ? type->AsFortran()
         : type->category() == TypeCategory::Derived
-        ? (type->GetDerivedTypeSpec().IsVectorType() ? type->AsFortran()
-                                                     : "TYPE("s + type->AsFortran() + ')')
+        ? (type->GetDerivedTypeSpec().IsVectorType()
+                  ? type->AsFortran()
+                  : "TYPE("s + type->AsFortran() + ')')
         : type->category() == TypeCategory::Character
         ? "CHARACTER(KIND="s + std::to_string(type->kind()) + ')'
         : ToUpperCase(type->AsFortran());
diff --git a/flang/lib/Support/Fortran.cpp b/flang/lib/Support/Fortran.cpp
index 9c86b9479..dbe320742 100644
--- a/flang/lib/Support/Fortran.cpp
+++ b/flang/lib/Support/Fortran.cpp
@@ -185,7 +185,7 @@ std::string FormatVectorTypeAsFortran(
     int category, int64_t elementCategory, int64_t elementKind) {
   std::string buf;
   llvm::raw_string_ostream ss{buf};
-  
+
   switch (category) {
   case 1: { // IntrinsicVector
     CHECK(elementCategory >= 0 && elementKind > 0);

``````````

</details>


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


More information about the flang-commits mailing list