[C++] Replace clang_include_to_override with regex

Reviewed By: jvillard

Differential Revision: D4905823

fbshipit-source-id: 1a73822
master
Andrzej Kotulski 8 years ago committed by Facebook Github Bot
parent 2e3b9a30ab
commit 6d360fb84a

@ -641,11 +641,13 @@ and clang_frontend_action =
"Specify whether the clang frontend should capture or lint or both." "Specify whether the clang frontend should capture or lint or both."
~symbols:clang_frontend_action_symbols ~symbols:clang_frontend_action_symbols
and clang_include_to_override = and clang_include_to_override_regex =
CLOpt.mk_string_opt ~long:"clang-include-to-override" ~meta:"dir" CLOpt.mk_string_opt ~long:"clang-include-to-override-regex"
~deprecated:["-clang-include-to-override"]
~meta:"dir OCaml regex"
"Use this option in the uncommon case where the normal compilation process overrides the \ "Use this option in the uncommon case where the normal compilation process overrides the \
location of internal compiler headers. This option should specify the path to those headers \ location of internal compiler headers. This option should specify regular expression with \
so that infer can use its own clang internal headers instead." the path to those headers so that infer can use its own clang internal headers instead."
and classpath = and classpath =
CLOpt.mk_string_opt ~long:"classpath" CLOpt.mk_string_opt ~long:"classpath"
@ -1625,7 +1627,7 @@ and dump_duplicate_symbols = !dump_duplicate_symbols
and checkers = !checkers and checkers = !checkers
and checkers_repeated_calls = !checkers_repeated_calls and checkers_repeated_calls = !checkers_repeated_calls
and clang_biniou_file = !clang_biniou_file and clang_biniou_file = !clang_biniou_file
and clang_include_to_override = !clang_include_to_override and clang_include_to_override_regex = !clang_include_to_override_regex
and classpath = !classpath and classpath = !classpath
and cluster_cmdline = !cluster and cluster_cmdline = !cluster
and compute_analytics = !compute_analytics and compute_analytics = !compute_analytics

@ -197,7 +197,7 @@ val clang_biniou_file : string option
val clang_frontend_action_string : string val clang_frontend_action_string : string
val clang_frontend_do_capture : bool val clang_frontend_do_capture : bool
val clang_frontend_do_lint : bool val clang_frontend_do_lint : bool
val clang_include_to_override : string option val clang_include_to_override_regex : string option
val cluster_cmdline : string option val cluster_cmdline : string option
val compute_analytics : bool val compute_analytics : bool
val continue_capture : bool val continue_capture : bool

@ -81,6 +81,8 @@ let file_arg_cmd_sanitizer cmd => {
{...cmd, argv: [Format.sprintf "@%s" file]} {...cmd, argv: [Format.sprintf "@%s" file]}
}; };
let include_override_regex = Option.map f::Str.regexp Config.clang_include_to_override_regex;
/* Work around various path or library issues occurring when one tries to substitute Apple's version /* Work around various path or library issues occurring when one tries to substitute Apple's version
of clang with a different version. Also mitigate version discrepancies in clang's of clang with a different version. Also mitigate version discrepancies in clang's
fatal warnings. */ fatal warnings. */
@ -105,8 +107,8 @@ let clang_cc1_cmd_sanitizer cmd => {
} else if ( } else if (
String.equal option "-isystem" String.equal option "-isystem"
) { ) {
switch Config.clang_include_to_override { switch include_override_regex {
| Some to_replace when String.equal arg to_replace => | Some regexp when Str.string_match regexp arg 0 =>
fcp_dir ^\/ "clang" ^\/ "install" ^\/ "lib" ^\/ "clang" ^\/ "4.0.0" ^\/ "include" fcp_dir ^\/ "clang" ^\/ "install" ^\/ "lib" ^\/ "clang" ^\/ "4.0.0" ^\/ "include"
| _ => arg | _ => arg
} }

Loading…
Cancel
Save