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-">,
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-">,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits