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

Eugene Epshteyn via flang-commits flang-commits at lists.llvm.org
Fri Apr 24 11:58:32 PDT 2026


================
@@ -10495,6 +10495,21 @@ void ResolveNamesVisitor::Post(const parser::CompilerDirective &x) {
         }
       }
     }
+  } else if (const auto *inlineAlways{
+                 std::get_if<parser::CompilerDirective::InlineAlways>(&x.u)}) {
+    if (!inlineAlways->v.has_value()) {
+      return;
+    }
+
+    Symbol *sym{currScope().symbol()};
+    if (!sym || !sym->has<SubprogramDetails>()) {
+      Say(x.source,
+          "!DIR$ INLINEALWAYS directive with name must appear in a subroutine or function"_err_en_US);
+    }
+    if (inlineAlways->v->ToString() != sym->name().ToString()) {
+      context().Warn(common::UsageWarning::IgnoredDirective, x.source,
+          "INLINEALWAYS name does not match the subroutine or function name"_warn_en_US);
----------------
eugeneepshteyn wrote:

Consider improving the message to indicate what name doesn't match what:
```
"INLINEALWAYS name '%s' does not match subprogram name '%s'"_warn_en_US,
    inlineAlways->v->ToString(), sym->name().ToString()
```

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


More information about the flang-commits mailing list