[PATCH] D12903: Allow the -load option in the driver and pass it through to -cc1

John Brawn via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 17 04:06:04 PDT 2015


john.brawn updated this revision to Diff 34977.
john.brawn added a comment.

Add a test.


Repository:
  rL LLVM

http://reviews.llvm.org/D12903

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

Index: test/Driver/load.c
===================================================================
--- /dev/null
+++ test/Driver/load.c
@@ -0,0 +1,7 @@
+// Check that all -load arguments are passed through to the -cc1 command
+
+// RUN: %clang -c %s -load foo.so -### 2>&1              | FileCheck %s --check-prefix=CHECK1
+// RUN: %clang -c %s -load foo.so -load 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
@@ -5035,6 +5035,8 @@
   Args.AddAllArgs(CmdArgs, options::OPT_fcomment_block_commands);
   // Forward -fparse-all-comments to -cc1.
   Args.AddAllArgs(CmdArgs, options::OPT_fparse_all_comments);
+  // Forward -load to -cc1
+  Args.AddAllArgs(CmdArgs, options::OPT_load);
 
   // Forward -Xclang arguments to -cc1, and -mllvm arguments to the LLVM option
   // parser.
Index: include/clang/Driver/Options.td
===================================================================
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -1192,6 +1192,8 @@
 def l : JoinedOrSeparate<["-"], "l">, Flags<[LinkerInput, RenderJoined]>;
 def lazy__framework : Separate<["-"], "lazy_framework">, Flags<[LinkerInput]>;
 def lazy__library : Separate<["-"], "lazy_library">, Flags<[LinkerInput]>;
+def load : Separate<["-"], "load">, Flags<[DriverOption,CC1Option]>, MetaVarName<"<dsopath>">,
+  HelpText<"Load the named plugin (dynamic shared object)">;
 def mlittle_endian : Flag<["-"], "mlittle-endian">, Flags<[DriverOption]>;
 def EL : Flag<["-"], "EL">, Alias<mlittle_endian>;
 def mbig_endian : Flag<["-"], "mbig-endian">, Flags<[DriverOption]>;
Index: include/clang/Driver/CC1Options.td
===================================================================
--- include/clang/Driver/CC1Options.td
+++ include/clang/Driver/CC1Options.td
@@ -343,8 +343,6 @@
   HelpText<"Include brief documentation comments in code-completion results.">;
 def disable_free : Flag<["-"], "disable-free">,
   HelpText<"Disable freeing of memory on exit">;
-def load : Separate<["-"], "load">, MetaVarName<"<dsopath>">,
-  HelpText<"Load the named plugin (dynamic shared object)">;
 def plugin : Separate<["-"], "plugin">, MetaVarName<"<name>">,
   HelpText<"Use the named plugin action instead of the default action (use \"help\" to list available options)">;
 def plugin_arg : JoinedAndSeparate<["-"], "plugin-arg-">,


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


More information about the cfe-commits mailing list