[flang-commits] [flang] [Flang] Add `INLINEALWAYS` Compiler Directive (PR #192674)

via flang-commits flang-commits at lists.llvm.org
Fri Apr 17 07:50:38 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/Parser/dump-parse-tree.h flang/include/flang/Parser/parse-tree.h flang/lib/Lower/Bridge.cpp flang/lib/Parser/Fortran-parsers.cpp flang/lib/Parser/unparse.cpp flang/lib/Semantics/canonicalize-directives.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 bc4f7fd44..9c7813122 100644
--- a/flang/include/flang/Parser/parse-tree.h
+++ b/flang/include/flang/Parser/parse-tree.h
@@ -3382,8 +3382,7 @@ struct CompilerDirective {
         Prefetch, std::list<common::Indirection<Designator>>);
   };
   struct InlineAlways {
-    WRAPPER_CLASS_BOILERPLATE(
-      InlineAlways, std::optional<Name>);
+    WRAPPER_CLASS_BOILERPLATE(InlineAlways, std::optional<Name>);
   };
   EMPTY_CLASS(NoVector);
   EMPTY_CLASS(NoUnroll);
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 733e02cd5..575989e64 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -3514,15 +3514,17 @@ private:
       e->dirs.push_back(&dir);
   }
 
-  void markCurrentFuncAsAlwaysInline(const Fortran::parser::CompilerDirective::InlineAlways &dir) {
+  void markCurrentFuncAsAlwaysInline(
+      const Fortran::parser::CompilerDirective::InlineAlways &dir) {
     mlir::func::FuncOp func = builder->getFunction();
     if (currentFunctionUnit && !currentFunctionUnit->isMainProgram()) {
       const std::string symName =
           currentFunctionUnit->getSubprogramSymbol().name().ToString();
       if (!llvm::StringRef(dir.v->ToString()).equals_insensitive(symName)) {
         mlir::emitWarning(toLocation())
-            << "Directive Ignored: INLINEALWAYS directive function name '" << dir.v->ToString()
-            << "' does not match the function '" << symName << "' where this is declared.";
+            << "Directive Ignored: INLINEALWAYS directive function name '"
+            << dir.v->ToString() << "' does not match the function '" << symName
+            << "' where this is declared.";
         return;
       }
     }
@@ -3607,7 +3609,8 @@ private:
             [&](const Fortran::parser::CompilerDirective::IVDep &) {
               attachDirectiveToLoop(dir, &eval);
             },
-            [&](const Fortran::parser::CompilerDirective::InlineAlways &inlineAlways) {
+            [&](const Fortran::parser::CompilerDirective::InlineAlways
+                    &inlineAlways) {
               if (inlineAlways.v.has_value())
                 markCurrentFuncAsAlwaysInline(inlineAlways);
               else
diff --git a/flang/lib/Parser/unparse.cpp b/flang/lib/Parser/unparse.cpp
index e9ee0576e..21abd7de1 100644
--- a/flang/lib/Parser/unparse.cpp
+++ b/flang/lib/Parser/unparse.cpp
@@ -1888,9 +1888,9 @@ public:
             [&](const CompilerDirective::IVDep &) { Word("!DIR$ IVDEP"); },
             [&](const CompilerDirective::InlineAlways &InlineAlways) {
               Word("!DIR$ INLINEALWAYS");
-              if (InlineAlways.v.has_value()){
+              if (InlineAlways.v.has_value()) {
                 Word(" ");
-                Word (InlineAlways.v->ToString());
+                Word(InlineAlways.v->ToString());
               }
             },
             [&](const CompilerDirective::Unrecognized &) {

``````````

</details>


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


More information about the flang-commits mailing list