diff --git a/Makefile.config.in b/Makefile.config.in index 4c708ac34..e0db0ea58 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -7,6 +7,7 @@ @SET_MAKE@ +SHELL = bash PLATFORM = $(shell uname) ATDGEN = @ATDGEN@ diff --git a/infer/src/clang/Capture.re b/infer/src/clang/Capture.re index de74ba8f9..77248ab18 100644 --- a/infer/src/clang/Capture.re +++ b/infer/src/clang/Capture.re @@ -12,7 +12,7 @@ let module CLOpt = CommandLineOption; /** enable debug mode (to get more data saved to disk for future inspections) */ -let debug_mode = Config.debug_mode || Config.frontend_stats; +let debug_mode = Config.debug_mode || Config.frontend_stats || Config.frontend_debug; let buffer_len = 262143; @@ -120,16 +120,16 @@ let run_clang clang_command read => | _ => exit 1 }; -let run_plugin_and_frontend frontend clang_args => { +let run_plugin_and_frontend source_path frontend clang_args => { let clang_command = ClangCommand.command_to_run (ClangCommand.with_plugin_args clang_args); if debug_mode { /* -cc1 clang commands always set -o explicitly */ - let object_filename = Option.get (ClangCommand.value_of_option clang_args "-o"); + let basename = source_path ^ ".capture"; /* Emit the clang command with the extra args piped to InferClang */ - let frontend_script_fname = Printf.sprintf "%s.sh" object_filename; + let frontend_script_fname = Printf.sprintf "%s.sh" basename; let debug_script_out = open_out frontend_script_fname; let debug_script_fmt = Format.formatter_of_out_channel debug_script_out; - let biniou_fname = Printf.sprintf "%s.biniou" object_filename; + let biniou_fname = Printf.sprintf "%s.biniou" basename; Format.fprintf debug_script_fmt "%s \\@\n > %s@\n" clang_command biniou_fname; let infer_clang_options = String.concat @@ -155,7 +155,7 @@ let run_plugin_and_frontend frontend clang_args => { "bdump -x -d \"%s/clang_ast.dict\" -w '!!DUMMY!!' %s \\@\n > %s.bdump" Config.etc_dir biniou_fname - object_filename; + basename; close_out debug_script_out }; run_clang clang_command frontend @@ -177,7 +177,7 @@ let cc1_capture clang_cmd => { | Some fname => run_and_validate_clang_frontend (`File fname) | None => run_plugin_and_frontend - (fun chan_in => run_and_validate_clang_frontend (`Pipe chan_in)) clang_cmd + source_path (fun chan_in => run_and_validate_clang_frontend (`Pipe chan_in)) clang_cmd }; /* reset logging to stop capturing log output into the source file's log */ Logging.set_log_file_identifier CommandLineOption.Clang None; diff --git a/infer/tests/codetoanalyze/cpp/checkers/Makefile b/infer/tests/codetoanalyze/cpp/checkers/Makefile index 54267726c..d79c6023e 100644 --- a/infer/tests/codetoanalyze/cpp/checkers/Makefile +++ b/infer/tests/codetoanalyze/cpp/checkers/Makefile @@ -9,7 +9,8 @@ TESTS_DIR = ../../.. include $(TESTS_DIR)/clang.make ANALYZER = checkers -CLANG_OPTIONS = -x c++ -std=c++11 -isystem$(MODELS_DIR)/cpp/include -isystem$(CLANG_INCLUDES)/c++/v1/ -c +# see explanations in cpp/errors/Makefile for the custom isystem +CLANG_OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(MODELS_DIR)/cpp/include -isystem$(CLANG_INCLUDES)/c++/v1/ -c INFER_OPTIONS = --cxx --ml-buckets cpp --no-filtering --debug-exceptions INFERPRINT_OPTIONS = --issues-txt diff --git a/infer/tests/codetoanalyze/cpp/errors/Makefile b/infer/tests/codetoanalyze/cpp/errors/Makefile index c4856d6ae..3759d5d6a 100644 --- a/infer/tests/codetoanalyze/cpp/errors/Makefile +++ b/infer/tests/codetoanalyze/cpp/errors/Makefile @@ -10,8 +10,9 @@ include $(TESTS_DIR)/clang.make ANALYZER = infer -CLANG_OPTIONS = -x c++ -std=c++11 -isystem$(ROOT_DIR) -isystem$(CLANG_INCLUDES)/c++/v1/ -c - +# Use the system headers of our own clang. This way, we always use the same system headers +# regardless of the libraries installed on the machine. +CLANG_OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(ROOT_DIR) -isystem$(CLANG_INCLUDES)/c++/v1/ -c INFER_OPTIONS = --cxx --ml-buckets cpp --no-filtering --debug-exceptions SOURCES = \ diff --git a/infer/tests/codetoanalyze/cpp/frontend/Makefile b/infer/tests/codetoanalyze/cpp/frontend/Makefile index 2bf1afe66..908a21e1e 100644 --- a/infer/tests/codetoanalyze/cpp/frontend/Makefile +++ b/infer/tests/codetoanalyze/cpp/frontend/Makefile @@ -7,7 +7,8 @@ include ../../Makefile.frontend -OPTIONS = -x c++ -std=c++11 -isystem$(ROOT_DIR) -isystem$(CLANG_INCLUDES)/c++/v1/ -c +# see explanations in cpp/errors/Makefile for the custom isystem +OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(ROOT_DIR) -isystem$(CLANG_INCLUDES)/c++/v1/ -c FILES = \ */*.cpp shared/*/*.cpp \ diff --git a/infer/tests/codetoanalyze/cpp/quandary/Makefile b/infer/tests/codetoanalyze/cpp/quandary/Makefile index c2b616abd..80cbb9c03 100644 --- a/infer/tests/codetoanalyze/cpp/quandary/Makefile +++ b/infer/tests/codetoanalyze/cpp/quandary/Makefile @@ -9,7 +9,8 @@ TESTS_DIR = ../../.. include $(TESTS_DIR)/clang.make ANALYZER = quandary -CLANG_OPTIONS = -x c++ -std=c++11 -isystem$(ROOT_DIR) -isystem$(CLANG_INCLUDES)/c++/v1/ -c +# see explanations in cpp/errors/Makefile for the custom isystem +CLANG_OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(ROOT_DIR) -isystem$(CLANG_INCLUDES)/c++/v1/ -c INFER_OPTIONS = --cxx --ml-buckets cpp --no-filtering --debug-exceptions INFERPRINT_OPTIONS = --issues-txt