From cf8d5483dba14c999a6edc6d3ed50e53ce75b92c Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Thu, 8 Jun 2017 07:54:16 -0700 Subject: [PATCH] [C++] Add option to exclude header models from compilation Summary: Can be useful in case there is compilation issue with the models Reviewed By: jvillard Differential Revision: D5208830 fbshipit-source-id: f31d84f --- infer/src/base/Config.ml | 21 ++++++++++++++++----- infer/src/base/Config.mli | 1 + infer/src/clang/ClangCommand.re | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/infer/src/base/Config.ml b/infer/src/base/Config.ml index 319899a2c..a52757772 100644 --- a/infer/src/base/Config.ml +++ b/infer/src/base/Config.ml @@ -767,11 +767,21 @@ and copy_propagation = CLOpt.mk_bool ~deprecated:["copy-propagation"] ~long:"copy-propagation" "Perform copy-propagation on the IR" -and cxx = - CLOpt.mk_bool ~deprecated:["cxx-experimental"] ~long:"cxx" - ~default:true - ~in_help:CLOpt.[Capture, manual_clang] - "Analyze C++ methods" +and cxx, cxx_infer_headers = + let cxx_infer_headers = + CLOpt.mk_bool ~long:"cxx-infer-headers" + ~default:true + ~in_help:CLOpt.[Capture, manual_clang] + "Include C++ header models during compilation, set by $(b,--cxx). Infer swaps some C++ \ + headers for its own in order to get a better model of, eg, the standard library. This \ + can sometimes cause compilation failures." in + let cxx = CLOpt.mk_bool_group ~long:"cxx" + ~default:true + ~in_help:CLOpt.[Capture, manual_clang] + "Analyze C++ methods" + [cxx_infer_headers] [] in + cxx, cxx_infer_headers + and ( bo_debug, @@ -1846,6 +1856,7 @@ and copy_propagation = !copy_propagation and crashcontext = !crashcontext and create_harness = !android_harness and cxx = !cxx +and cxx_infer_headers = !cxx_infer_headers and debug_level_analysis = !debug_level_analysis and debug_level_capture = !debug_level_capture and debug_level_linters = !debug_level_linters diff --git a/infer/src/base/Config.mli b/infer/src/base/Config.mli index 794788bf2..f6c86ea03 100644 --- a/infer/src/base/Config.mli +++ b/infer/src/base/Config.mli @@ -208,6 +208,7 @@ val copy_propagation : bool val crashcontext : bool val create_harness : bool val cxx : bool +val cxx_infer_headers : bool val debug_level_analysis : int val debug_level_capture : int val debug_level_linters : int diff --git a/infer/src/clang/ClangCommand.re b/infer/src/clang/ClangCommand.re index 7c4710e3f..81f3a53d0 100644 --- a/infer/src/clang/ClangCommand.re +++ b/infer/src/clang/ClangCommand.re @@ -31,7 +31,7 @@ let plugin_name = "BiniouASTExporter"; /** whether to amend include search path with C++ model headers */ -let infer_cxx_models = Config.cxx; +let infer_cxx_models = Config.cxx_infer_headers; let value_of_argv_option argv opt_name => List.fold