[PATCH] D113250: [clang][driver] Add -fplugin-arg- to pass arguments to plugins

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 19 09:44:09 PST 2021


MaskRay added inline comments.


================
Comment at: clang/docs/ClangPlugins.rst:131
+
+The clang compiler driver accepts the `fplugin` option to load a plugin.
+Clang plugins can receive arguments from the compiler driver command
----------------



================
Comment at: clang/docs/ClangPlugins.rst:141
+  $ export BD=/path/to/build/directory
+  $ (cd $BD && make CallSuperAttr )
+  $ clang++ -fplugin=$BD/lib/CallSuperAttr.so \
----------------



================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6676
+    if (FirstDashIndex == StringRef::npos)
+      continue;
+
----------------
This probably should be an error. See elsewhere in the file for error reporting.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6679
+    auto Arg = ArgValue.substr(FirstDashIndex + 1);
+    auto PluginName = ArgValue.substr(0, FirstDashIndex);
+
----------------



================
Comment at: clang/test/Driver/plugin-driver-args.cpp:5
+// CHECK: "-load"
+// CHECK: CallSuperAttr
+// CHECK: "-plugin-arg-call_super_plugin"
----------------
CHECK-SAME


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D113250/new/

https://reviews.llvm.org/D113250



More information about the cfe-commits mailing list