[clang] pass -fno-cxx-modules to clang -### instead of the clang -cc1 commands

Summary: -fno-cxx-modules is only supported by the clang driver.

Reviewed By: akotulski

Differential Revision: D4124273

fbshipit-source-id: cc3de93
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 7b58886e1c
commit 8c481d2d9f

@ -100,7 +100,6 @@ let clang_cc1_cmd_sanitizer cmd => {
}; };
let post_args_rev = let post_args_rev =
[] |> IList.rev_append ["-include", Config.lib_dir /\/ "clang_wrappers" /\/ "global_defines.h"] |> [] |> IList.rev_append ["-include", Config.lib_dir /\/ "clang_wrappers" /\/ "global_defines.h"] |>
argv_do_if (has_flag cmd "-fmodules") (argv_cons "-fno-cxx-modules") |>
/* Never error on warnings. Clang is often more strict than Apple's version. These arguments /* Never error on warnings. Clang is often more strict than Apple's version. These arguments
are appended at the end to override previous opposite settings. How it's done: suppress are appended at the end to override previous opposite settings. How it's done: suppress
all the warnings, since there are no warnings, compiler can't elevate them to error all the warnings, since there are no warnings, compiler can't elevate them to error

@ -22,7 +22,18 @@ type action_item =
let normalize (args: array string) :list action_item => { let normalize (args: array string) :list action_item => {
let cmd = ClangCommand.mk ClangQuotes.SingleQuotes args; let cmd = ClangCommand.mk ClangQuotes.SingleQuotes args;
let clang_hashhashhash = let clang_hashhashhash =
Printf.sprintf "%s 2>&1" (ClangCommand.prepend_arg "-###" cmd |> ClangCommand.command_to_run); Printf.sprintf
"%s 2>&1"
(
ClangCommand.prepend_arg "-###" cmd |>
/* c++ modules are not supported, so let clang know in case it was passed
"-fmodules". Unfortunately we cannot know accurately if "-fmodules" was passed because we
don't go into argument files at this point ("clang -### ..." will do that for us), so we
also pass "-Qunused-arguments" to silence the potential warning that "-fno-cxx-modules"
was ignored. Moreover, "-fno-cxx-modules" is only accepted by the clang driver so we have
to pass it now. */
ClangCommand.append_args ["-fno-cxx-modules", "-Qunused-arguments"] |> ClangCommand.command_to_run
);
Logging.out "clang -### invocation: %s@\n" clang_hashhashhash; Logging.out "clang -### invocation: %s@\n" clang_hashhashhash;
let normalized_commands = ref []; let normalized_commands = ref [];
let one_line line => let one_line line =>

Loading…
Cancel
Save