[PATCH] D12903: Add -fplugin=name.so option to the driver

John Brawn via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 10:18:07 PDT 2015


john.brawn retitled this revision from "Allow the -load option in the driver and pass it through to -cc1" to "Add -fplugin=name.so option to the driver".
john.brawn updated the summary for this revision.
john.brawn updated this revision to Diff 35014.
john.brawn added a comment.

Rename option from -load to -fplugin.


Repository:
  rL LLVM

http://reviews.llvm.org/D12903

Files:
  include/clang/Driver/Options.td
  lib/Driver/Tools.cpp
  test/Driver/fplugin.c

Index: test/Driver/fplugin.c
===================================================================
--- /dev/null
+++ test/Driver/fplugin.c
@@ -0,0 +1,7 @@
+// Check that all -fplugin arguments are converted to -load
+
+// RUN: %clang -c %s -fplugin=foo.so -### 2>&1                 | FileCheck %s --check-prefix=CHECK1
+// RUN: %clang -c %s -fplugin=foo.so -fplugin=bar.so -### 2>&1 | FileCheck %s --check-prefix=CHECK2
+
+// CHECK1: "-load" "foo.so"
+// CHECK2: "-load" "foo.so" "-load" "bar.so"
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -5036,6 +5036,13 @@
   // Forward -fparse-all-comments to -cc1.
   Args.AddAllArgs(CmdArgs, options::OPT_fparse_all_comments);
 
+  // Turn -fplugin=name.so into -load name.so
+  for (const Arg *A : Args.filtered(options::OPT_fplugin)) {
+    CmdArgs.push_back("-load");
+    CmdArgs.push_back(A->getValue());
+    A->claim();
+  }
+
   // Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option
   // parser.
   Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -949,6 +949,8 @@
 def fno_pic : Flag<["-"], "fno-pic">, Group<f_Group>;
 def fpie : Flag<["-"], "fpie">, Group<f_Group>;
 def fno_pie : Flag<["-"], "fno-pie">, Group<f_Group>;
+def fplugin : Joined<["-"], "fplugin=">, Group<f_Group>, Flags<[DriverOption]>, MetaVarName<"<dsopath>">,
+  HelpText<"Load the named plugin (dynamic shared object)">;
 def fprofile_arcs : Flag<["-"], "fprofile-arcs">, Group<f_Group>;
 def fno_profile_arcs : Flag<["-"], "fno-profile-arcs">, Group<f_Group>;
 def framework : Separate<["-"], "framework">, Flags<[LinkerInput]>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D12903.35014.patch
Type: text/x-patch
Size: 1864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150917/fa079d0f/attachment.bin>


More information about the cfe-commits mailing list