[flang-commits] [clang] [flang] [llvm] [polly] [Plugins] Pass options to a pass plugin in -load-pass-plugin (PR #226773)

via flang-commits flang-commits at lists.llvm.org
Sun Sep 27 06:00:06 PDT 2026


================
@@ -7,13 +7,19 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Plugins/PassPlugin.h"
+#include "llvm/ADT/STLExtras.h"
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/StringSaver.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include <cstdint>
 
 using namespace llvm;
 
-Expected<PassPlugin> PassPlugin::Load(const std::string &Filename) {
+Expected<PassPlugin> PassPlugin::load(StringRef Spec) {
+  SmallVector<StringRef, 0> Parts;
+  Spec.split(Parts, ',');
+  std::string Filename = Parts[0].str();
----------------
serge-sans-paille wrote:

we also have an issue if some option value accept comma etc. As a whole we probably need a smarter way to do the split, something in the spirit of [shlex.split](https://docs.python.org/3/library/shlex.html#shlex.split).
I don't know if we already have this in our support libraries.

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


More information about the flang-commits mailing list