[flang-commits] [clang] [flang] [llvm] [polly] [Plugins] Pass arguments to a pass plugin with -plugin-arg (PR #226773)

Alexis Engelke via flang-commits flang-commits at lists.llvm.org
Tue Sep 29 05:39:09 PDT 2026


================
@@ -443,20 +453,24 @@ optMain(int argc, char **argv,
   initializeReplaceWithVeclibLegacyPass(Registry);
   initializeJMCInstrumenterPass(Registry);
 
-  SmallVector<PassPlugin, 1> PluginList;
-  PassPlugins.setCallback([&](const std::string &PluginPath) {
-    auto Plugin = PassPlugin::Load(PluginPath);
-    if (!Plugin)
-      reportFatalUsageError(Plugin.takeError());
-    PluginList.emplace_back(Plugin.get());
-  });
-
   // Register the Target and CPU printer for --version.
   cl::AddExtraVersionPrinter(sys::printDefaultTargetAndDetectedCPU);
 
   cl::ParseCommandLineOptions(
       argc, argv, "llvm .bc -> .bc modular optimizer and analysis printer\n");
 
+  SmallVector<PassPluginLibraryInfo, 0> Extensions;
+  for (const std::string &Path : PassPlugins) {
+    auto Plugin = PassPlugin::load(Path);
+    if (!Plugin)
+      reportFatalUsageError(Plugin.takeError());
+    Extensions.push_back(Plugin->getInfo());
+  }
+#define HANDLE_EXTENSION(Ext) Extensions.push_back(get##Ext##PluginInfo());
+#include "llvm/Support/Extension.def"
----------------
aengelke wrote:

Actually, maybe this should be some helper function in Extensions/? The plugin handling code is very similar everywhere and the linked-in plugins are easy to forget (e.g. in llc here).

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


More information about the flang-commits mailing list