[flang-commits] [flang] [Flang] Fix -Wopen-mp-* and -Wopen-acc-* flag spellings (PR #188434)

via flang-commits flang-commits at lists.llvm.org
Wed Mar 25 01:50:58 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 cpp,h -- flang/include/flang/Support/Fortran-features.h flang/lib/Frontend/CompilerInvocation.cpp flang/lib/Support/Fortran-features.cpp flang/unittests/Common/FortranFeaturesTest.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/Frontend/CompilerInvocation.cpp b/flang/lib/Frontend/CompilerInvocation.cpp
index 5462289b3..f0bc61bf0 100644
--- a/flang/lib/Frontend/CompilerInvocation.cpp
+++ b/flang/lib/Frontend/CompilerInvocation.cpp
@@ -1051,13 +1051,12 @@ static bool parseDiagArgs(CompilerInvocation &res, llvm::opt::ArgList &args,
       } else {
         if (auto canonical{features.GetCanonicalSpelling(wArg)}) {
           std::string suggestion{*canonical};
-          if (wArg.size() > 3 &&
-              wArg.substr(0, 3) == "no-") {
+          if (wArg.size() > 3 && wArg.substr(0, 3) == "no-") {
             suggestion = "no-" + suggestion;
           }
-          const unsigned diagID = diags.getCustomDiagID(
-              clang::DiagnosticsEngine::Warning,
-              "-W%0 is deprecated; use -W%1 instead");
+          const unsigned diagID =
+              diags.getCustomDiagID(clang::DiagnosticsEngine::Warning,
+                                    "-W%0 is deprecated; use -W%1 instead");
           diags.Report(diagID) << wArg << suggestion;
         }
       }
diff --git a/flang/lib/Support/Fortran-features.cpp b/flang/lib/Support/Fortran-features.cpp
index 18616fdb2..0207db7a1 100644
--- a/flang/lib/Support/Fortran-features.cpp
+++ b/flang/lib/Support/Fortran-features.cpp
@@ -10,8 +10,8 @@
 #include "flang/Common/idioms.h"
 #include "flang/Parser/characters.h"
 #include "flang/Support/Fortran.h"
-#include <string>
 #include <cstring>
+#include <string>
 #include <string_view>
 
 namespace Fortran::common {
@@ -102,8 +102,7 @@ LanguageFeatureControl::LanguageFeatureControl() {
     bool replaced{false};
     for (auto [deprecatedForm, canonicalForm] : compoundNameFixups) {
       // Reverse direction: canonical -> deprecated.
-      for (auto pos{deprecated.find(canonicalForm)};
-          pos != std::string::npos;
+      for (auto pos{deprecated.find(canonicalForm)}; pos != std::string::npos;
           pos = deprecated.find(canonicalForm, pos + deprecatedForm.size())) {
         deprecated.replace(pos, canonicalForm.size(), deprecatedForm);
         replaced = true;

``````````

</details>


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


More information about the flang-commits mailing list