From 61b2c9105bdde4614065fdda6c604858fcf2474b Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 26 Oct 2017 03:29:18 -0700 Subject: [PATCH] [cli] crash if capture happens with conflicting C++ header models Summary: You really shouldn't do that. Reviewed By: mbouaziz Differential Revision: D6147564 fbshipit-source-id: 05b092d --- infer/src/clang/ClangCommand.ml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/infer/src/clang/ClangCommand.ml b/infer/src/clang/ClangCommand.ml index 451451c3a..f2adddb8f 100644 --- a/infer/src/clang/ClangCommand.ml +++ b/infer/src/clang/ClangCommand.ml @@ -23,9 +23,6 @@ let plugin_path = fcp_dir ^/ "libtooling" ^/ "build" ^/ "FacebookClangPlugin.dyl (** name of the plugin to use *) let plugin_name = "BiniouASTExporter" -(** whether to amend include search path with C++ model headers *) -let infer_cxx_models = Config.cxx_infer_headers - let value_of_argv_option argv opt_name = List.fold ~f:(fun (prev_arg, result) arg -> @@ -156,13 +153,17 @@ let command_to_run cmd = let with_exec exec args = {args with exec} let with_plugin_args args = + if Config.cxx_infer_headers && Config.biabduction && Config.bufferoverrun then + L.(die UserError) + "The biabduction and bufferoverrun analyses have conflicting header models for C++. Either disable infer's custom C++ headers (--no-cxx-infer-headers), the biabduction analysis (--no-biabduction), or the bufferoverrun analysis (--no-bufferoverrun)." ; let plugin_arg_flag = "-plugin-arg-" ^ plugin_name in let args_before_rev = [] |> (* -cc1 has to be the first argument or clang will think it runs in driver mode *) argv_cons "-cc1" |> (* It's important to place this option before other -isystem options. *) - argv_do_if infer_cxx_models (List.rev_append ["-isystem"; Config.cpp_extra_include_dir]) + argv_do_if Config.cxx_infer_headers + (List.rev_append ["-isystem"; Config.cpp_extra_include_dir]) |> List.rev_append [ "-load" ; plugin_path