[clang] write clang arguments into a file

Summary: This avoids issues where the command-line may get too large.

Reviewed By: jberdine

Differential Revision: D4008328

fbshipit-source-id: c1558b9
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 9535c4d89e
commit 36a5dc33ee

@ -81,9 +81,9 @@ let value_of_argv_option argv opt_name =>
("", None) ("", None)
argv |> snd; argv |> snd;
let value_of_option {argv} => value_of_argv_option argv; let value_of_option {orig_argv} => value_of_argv_option orig_argv;
let has_flag {argv} flag => IList.exists (string_equal flag) argv; let has_flag {orig_argv} flag => IList.exists (string_equal flag) orig_argv;
let quote quoting_style => let quote quoting_style =>
switch quoting_style { switch quoting_style {
@ -134,7 +134,12 @@ let mk_clang_compat_args args => {
filter_unsupported_args_and_swap_includes (arg, res') tl filter_unsupported_args_and_swap_includes (arg, res') tl
}; };
let clang_arguments = filter_unsupported_args_and_swap_includes ("", []) args.argv; let clang_arguments = filter_unsupported_args_and_swap_includes ("", []) args.argv;
{...args, argv: clang_arguments} let file = Filename.temp_file "clang_args_" ".txt";
let write_args outc =>
output_string outc (IList.map (quote args.quoting_style) clang_arguments |> String.concat " ");
with_file file f::write_args |> ignore;
Logging.out "Clang options stored in file %s@\n" file;
{...args, argv: [Format.sprintf "@%s" file]}
}; };
let mk quoting_style argv => { let mk quoting_style argv => {

Loading…
Cancel
Save