[CLI] switch to infer-<command> (symlinks) executables

Summary:
Introduce `infer-<command>` for each command, except for internal commands
(only `infer-clang` for now) which are not exported. Install these executables
(which are just symlinks to `infer`) on `make install`. The main executable
looks at the name it was invoked with to figure out if it should behave as a
particular command.

Get rid of `InferClang`, `InferAnalyze`, and `InferPrint`. As a bonus, we now
only need to build one executable: `infer`, which should be a few seconds
faster (less link time).

`InferAnalyze` is now `infer-analyze` and `InferPrint` is `infer-print`. To run
`InferClang`, use a symlink named `clang`, `clang++`, etc. to `infer`. There
are such symlinks available in "infer/lib/wrappers/" already.

I also noticed that the scripts in xcodebuild_wrappers/ don't seem useful
anymore, so use wrappers/ instead, as for `make`.

Reviewed By: mbouaziz

Differential Revision: D5036495

fbshipit-source-id: 4a90030
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 81177dc711
commit 801c605c26

@ -4,14 +4,6 @@
*infer* : Main command to run Infer. Check out the docs for instructions on how to use it. *infer* : Main command to run Infer. Check out the docs for instructions on how to use it.
*inferTraceBugs* : Python script to explore the error traces in Infer reports *infer-<command>* : Infer subcommands. Running `infer-<command> [options]` is the same as running `infer <command> [options]`.
## Helper commands
The rest of the commands in infer/bin/ are not meant to be called directly, but are used by the top-level commands above.
*InferClang* : Binary containing the clang frontend. *inferTraceBugs* : Python script to explore the error traces in Infer reports
*InferAnalyze* : Binary containing the backend of Infer that performs the analysis.
*InferPrint* : Binary that prints reports about the analysis such as the specs of methods and a list of bugs found.

@ -350,6 +350,7 @@ test-replace: $(BUILD_SYSTEMS_TESTS:%=build_%_replace) $(DIRECT_TESTS:%=direct_%
uninstall: uninstall:
$(REMOVE_DIR) $(DESTDIR)$(libdir)/infer/ $(REMOVE_DIR) $(DESTDIR)$(libdir)/infer/
$(REMOVE) $(DESTDIR)$(bindir)/infer $(REMOVE) $(DESTDIR)$(bindir)/infer
$(REMOVE) $(foreach alias,$(INFER_COMMANDS),$(DESTDIR)$(bindir)/$(alias))
.PHONY: test_clean .PHONY: test_clean
test_clean: $(DIRECT_TESTS:%=direct_%_clean) $(BUILD_SYSTEMS_TESTS:%=build_%_clean) test_clean: $(DIRECT_TESTS:%=direct_%_clean) $(BUILD_SYSTEMS_TESTS:%=build_%_clean)
@ -380,10 +381,6 @@ endif
ifeq ($(BUILD_JAVA_ANALYZERS),yes) ifeq ($(BUILD_JAVA_ANALYZERS),yes)
test -d $(DESTDIR)$(libdir)/infer/infer/lib/java/ || \ test -d $(DESTDIR)$(libdir)/infer/infer/lib/java/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/java/ $(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/java/
endif
ifneq ($(XCODE_SELECT),no)
test -d $(DESTDIR)$(libdir)/infer/infer/lib/xcode_wrappers/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/xcode_wrappers/
endif endif
test -d $(DESTDIR)$(libdir)/infer/infer/annotations/ || \ test -d $(DESTDIR)$(libdir)/infer/infer/annotations/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/annotations/ $(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/annotations/
@ -410,12 +407,12 @@ ifeq ($(BUILD_C_ANALYZERS),yes)
$(QUIET)for i in $$(find infer/lib/clang_wrappers/*); do \ $(QUIET)for i in $$(find infer/lib/clang_wrappers/*); do \
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \ $(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done done
# only for files that point to InferClang # only for files that point to infer
(cd $(DESTDIR)$(libdir)/infer/infer/lib/wrappers/ && \ (cd $(DESTDIR)$(libdir)/infer/infer/lib/wrappers/ && \
$(foreach cc,$(shell find $(LIB_DIR)/wrappers -type l), \ $(foreach cc,$(shell find $(LIB_DIR)/wrappers -type l), \
[ $(cc) -ef $(INFERCLANG_BIN) ] && \ [ $(cc) -ef $(INFER_BIN) ] && \
$(REMOVE) $(notdir $(cc)) && \ $(REMOVE) $(notdir $(cc)) && \
$(LN_S) ../../bin/InferClang $(notdir $(cc));)) $(LN_S) ../../bin/infer $(notdir $(cc));))
$(QUIET)for i in $$(find infer/lib/specs/*); do \ $(QUIET)for i in $$(find infer/lib/specs/*); do \
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \ $(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done done
@ -424,14 +421,6 @@ ifeq ($(BUILD_C_ANALYZERS),yes)
done done
$(INSTALL_DATA) -C infer/lib/linter_rules/linters.al \ $(INSTALL_DATA) -C infer/lib/linter_rules/linters.al \
$(DESTDIR)$(libdir)/infer/infer/lib/linter_rules/linters.al $(DESTDIR)$(libdir)/infer/infer/lib/linter_rules/linters.al
$(INSTALL_PROGRAM) -C $(INFERCLANG_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
(cd $(DESTDIR)$(libdir)/infer/infer/bin/ && \
$(LN_S) -f InferClang InferClang++)
endif
ifneq ($(XCODE_SELECT),no)
$(QUIET)for i in $$(find infer/lib/xcode_wrappers/*); do \
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done
endif endif
ifeq ($(BUILD_JAVA_ANALYZERS),yes) ifeq ($(BUILD_JAVA_ANALYZERS),yes)
$(INSTALL_DATA) -C infer/annotations/annotations.jar \ $(INSTALL_DATA) -C infer/annotations/annotations.jar \
@ -452,11 +441,17 @@ endif
$(INSTALL_PROGRAM) -C infer/lib/python/report.py \ $(INSTALL_PROGRAM) -C infer/lib/python/report.py \
$(DESTDIR)$(libdir)/infer/infer/lib/python/report.py $(DESTDIR)$(libdir)/infer/infer/lib/python/report.py
$(INSTALL_PROGRAM) -C $(INFER_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/ $(INSTALL_PROGRAM) -C $(INFER_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
$(INSTALL_PROGRAM) -C $(INFERANALYZE_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
$(INSTALL_PROGRAM) -C $(INFERPRINT_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
(cd $(DESTDIR)$(bindir)/ && \ (cd $(DESTDIR)$(bindir)/ && \
$(REMOVE) infer && \ $(REMOVE) infer && \
$(LN_S) $(libdir_relative_to_bindir)/infer/infer/bin/infer infer) $(LN_S) $(libdir_relative_to_bindir)/infer/infer/bin/infer infer)
for alias in $(INFER_COMMANDS); do \
(cd $(DESTDIR)$(bindir)/ && \
$(REMOVE) $$alias && \
$(LN_S) infer $$alias); done
for alias in $(INFER_COMMANDS); do \
(cd $(DESTDIR)$(libdir)/infer/infer/bin && \
$(REMOVE) $$alias && \
$(LN_S) infer $$alias); done
(cd $(DESTDIR)$(bindir)/ && \ (cd $(DESTDIR)$(bindir)/ && \
$(REMOVE) inferTraceBugs && \ $(REMOVE) inferTraceBugs && \
$(LN_S) $(libdir_relative_to_bindir)/infer/infer/lib/python/inferTraceBugs inferTraceBugs) $(LN_S) $(libdir_relative_to_bindir)/infer/infer/lib/python/inferTraceBugs inferTraceBugs)

@ -50,12 +50,16 @@ PYTHON_DIR = $(LIB_DIR)/python
PYTHON_LIB_DIR = $(PYTHON_DIR)/inferlib PYTHON_LIB_DIR = $(PYTHON_DIR)/inferlib
CAPTURE_LIB_DIR = $(PYTHON_LIB_DIR)/capture CAPTURE_LIB_DIR = $(PYTHON_LIB_DIR)/capture
INFERANALYZE_BIN = $(BIN_DIR)/InferAnalyze
INFERCLANG_BIN = $(BIN_DIR)/InferClang
INFERCLANGXX_BIN = $(BIN_DIR)/InferClang++
INFERPRINT_BIN = $(BIN_DIR)/InferPrint
INFERUNIT_BIN = $(BIN_DIR)/InferUnit INFERUNIT_BIN = $(BIN_DIR)/InferUnit
INFER_BIN = $(BIN_DIR)/infer INFER_BIN = $(BIN_DIR)/infer
INFER_COMMANDS = \
infer-analyze \
infer-capture \
infer-compile \
infer-report \
infer-reportdiff \
infer-run \
INFERTRACEBUGS_BIN = $(BIN_DIR)/inferTraceBugs INFERTRACEBUGS_BIN = $(BIN_DIR)/inferTraceBugs
INFERTRACEBUGS_BIN_RELPATH = infer/bin/inferTraceBugs INFERTRACEBUGS_BIN_RELPATH = infer/bin/inferTraceBugs
@ -76,7 +80,7 @@ JAVA_DEPS_NO_MODELS = \
analyze.py bucklib.py config.py issues.py jwlib.py source.py utils.py) \ analyze.py bucklib.py config.py issues.py jwlib.py source.py utils.py) \
$(addprefix $(CAPTURE_LIB_DIR)/, util.py) \ $(addprefix $(CAPTURE_LIB_DIR)/, util.py) \
$(ANDROID_JAR) $(GUAVA_JAR) $(JACKSON_JAR) $(JSR_305_JAR) $(INFER_ANNOTATIONS_JAR) \ $(ANDROID_JAR) $(GUAVA_JAR) $(JACKSON_JAR) $(JSR_305_JAR) $(INFER_ANNOTATIONS_JAR) \
$(INFER_BIN) $(INFERANALYZE_BIN) $(INFERPRINT_BIN) $(INFER_BIN)
JAVA_DEPS = $(JAVA_DEPS_NO_MODELS) $(JAVA_MODELS_JAR) JAVA_DEPS = $(JAVA_DEPS_NO_MODELS) $(JAVA_MODELS_JAR)
@ -89,7 +93,7 @@ CLANG_DEPS_NO_MODELS = \
$(addprefix $(PYTHON_LIB_DIR)/, \ $(addprefix $(PYTHON_LIB_DIR)/, \
analyze.py config.py issues.py source.py utils.py) \ analyze.py config.py issues.py source.py utils.py) \
$(addprefix $(CAPTURE_LIB_DIR)/, util.py) \ $(addprefix $(CAPTURE_LIB_DIR)/, util.py) \
$(INFER_BIN) $(INFERANALYZE_BIN) $(INFERCLANG_BIN) $(INFERPRINT_BIN) $(INFER_BIN)
CLANG_DEPS = $(CLANG_DEPS_NO_MODELS) $(C_MODELS_FILE) $(CPP_MODELS_FILE) \ CLANG_DEPS = $(CLANG_DEPS_NO_MODELS) $(C_MODELS_FILE) $(CPP_MODELS_FILE) \
$(shell find $(MODELS_DIR)/cpp/include -type f) $(shell find $(MODELS_DIR)/cpp/include -type f)

@ -23,9 +23,8 @@ infer -- xcodebuild -target HelloWorldApp -sdk iphonesimulator
infer -- xcodebuild -workspace HelloWorld.xcworkspace -scheme HelloWorld''' infer -- xcodebuild -workspace HelloWorld.xcworkspace -scheme HelloWorld'''
LANG = ['clang'] LANG = ['clang']
CLANG_WRAPPER = os.path.join(config.XCODE_WRAPPERS_DIRECTORY, 'clang') CLANG_WRAPPER = os.path.join(config.WRAPPERS_DIRECTORY, 'clang')
CLANGPLUSPLUS_WRAPPER = os.path.join(config.XCODE_WRAPPERS_DIRECTORY, CLANGPLUSPLUS_WRAPPER = os.path.join(config.WRAPPERS_DIRECTORY, 'clang++')
'clang++')
def gen_instance(*args): def gen_instance(*args):

@ -35,7 +35,6 @@ BIN_DIRECTORY = os.path.join(INFER_INFER_DIRECTORY, 'bin')
JAVA_LIB_DIRECTORY = os.path.join(LIB_DIRECTORY, 'java') JAVA_LIB_DIRECTORY = os.path.join(LIB_DIRECTORY, 'java')
MODELS_JAR = os.path.join(JAVA_LIB_DIRECTORY, 'models.jar') MODELS_JAR = os.path.join(JAVA_LIB_DIRECTORY, 'models.jar')
WRAPPERS_DIRECTORY = os.path.join(LIB_DIRECTORY, 'wrappers') WRAPPERS_DIRECTORY = os.path.join(LIB_DIRECTORY, 'wrappers')
XCODE_WRAPPERS_DIRECTORY = os.path.join(LIB_DIRECTORY, 'xcode_wrappers')
DEFAULT_INFER_OUT = os.path.join(os.getcwd().decode(CODESET), 'infer-out') DEFAULT_INFER_OUT = os.path.join(os.getcwd().decode(CODESET), 'infer-out')

@ -1 +1 @@
../../bin/InferClang ../../bin/infer

@ -1 +1 @@
../../bin/InferClang ../../bin/infer

@ -1 +1 @@
../../bin/InferClang ../../bin/infer

@ -1 +1 @@
../../bin/InferClang ../../bin/infer

@ -1 +1 @@
../../bin/InferClang ../../bin/infer

@ -1 +1 @@
../../bin/InferClang ../../bin/infer

@ -1,8 +0,0 @@
#!/bin/bash
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BIN_PATH="${SCRIPT_PATH}/../../bin"
if [ "${0%++}" != "$0" ]; then XX="++"; else XX=""; fi
"${BIN_PATH}/InferClang${XX}" "$@"

@ -62,7 +62,6 @@ endif
#### Backend declarations #### #### Backend declarations ####
INFER_MAIN = backend/infer INFER_MAIN = backend/infer
INFERANALYZE_MAIN = backend/InferAnalyzeExe
#### Checkers declarations #### #### Checkers declarations ####
@ -76,8 +75,6 @@ INFERPRINT_ATDGEN_STUB_BASE = backend/jsonbug
INFERPRINT_ATDGEN_STUB_ATD = $(INFERPRINT_ATDGEN_STUB_BASE).atd INFERPRINT_ATDGEN_STUB_ATD = $(INFERPRINT_ATDGEN_STUB_BASE).atd
INFERPRINT_ATDGEN_STUBS = $(addprefix $(INFERPRINT_ATDGEN_STUB_BASE), $(ATDGEN_SUFFIXES)) INFERPRINT_ATDGEN_STUBS = $(addprefix $(INFERPRINT_ATDGEN_STUB_BASE), $(ATDGEN_SUFFIXES))
INFERPRINT_MAIN = backend/InferPrintExe
### InferUnit declarations ### ### InferUnit declarations ###
UNIT_SOURCES = unit UNIT_SOURCES = unit
@ -93,7 +90,6 @@ JAVA_SOURCES = java
#### Clang declarations #### #### Clang declarations ####
CLANG_SOURCES = clang CLANG_SOURCES = clang
INFERCLANG_MAIN = $(CLANG_SOURCES)/InferClang
FCP_CLANG_OCAML_BUILD_DIR = $(FCP_CLANG_OCAML_DIR)/build FCP_CLANG_OCAML_BUILD_DIR = $(FCP_CLANG_OCAML_DIR)/build
@ -141,18 +137,10 @@ OCAMLBUILD_BASE = \
# ocamlbuild with options necessary to build all targets at once, regardless of configure flags # ocamlbuild with options necessary to build all targets at once, regardless of configure flags
OCAMLBUILD_ALL = $(OCAMLBUILD_BASE) $(JAVA_OCAMLBUILD_OPTIONS) OCAMLBUILD_ALL = $(OCAMLBUILD_BASE) $(JAVA_OCAMLBUILD_OPTIONS)
# list of ocamlbuild targets common to all build targets -- native version
INFER_BASE_TARGETS = \
$(INFER_MAIN).native \
$(INFERANALYZE_MAIN).native \
$(INFERPRINT_MAIN).native
INFER_ALL_TARGETS = $(INFER_BASE_TARGETS) \
$(INFERCLANG_MAIN).native \
# configure-aware ocamlbuild commands and targets # configure-aware ocamlbuild commands and targets
OCAMLBUILD_CONFIG = $(OCAMLBUILD_BASE) OCAMLBUILD_CONFIG = $(OCAMLBUILD_BASE)
INFER_CONFIG_TARGETS = $(INFER_BASE_TARGETS) # list of ocamlbuild targets common to all build targets -- native version
INFER_CONFIG_TARGETS = $(INFER_MAIN).native
ifeq ($(BUILD_JAVA_ANALYZERS),yes) ifeq ($(BUILD_JAVA_ANALYZERS),yes)
OCAMLBUILD_CONFIG += $(JAVA_OCAMLBUILD_OPTIONS) OCAMLBUILD_CONFIG += $(JAVA_OCAMLBUILD_OPTIONS)
@ -161,7 +149,6 @@ else
DEPENDENCIES += java_stubs DEPENDENCIES += java_stubs
endif endif
ifeq ($(BUILD_C_ANALYZERS),yes) ifeq ($(BUILD_C_ANALYZERS),yes)
INFER_CONFIG_TARGETS += $(INFERCLANG_MAIN).native
DEPENDENCIES += clang unit/clang DEPENDENCIES += clang unit/clang
else else
DEPENDENCIES += clang_stubs unit/clang_stubs DEPENDENCIES += clang_stubs unit/clang_stubs
@ -193,20 +180,18 @@ $(INFER_BUILD_DIR)/$(INFER_MAIN).native: base/Version.ml $(OCAML_CONFIG_SOURCES)
$(MKDIR_P) $(BASE_BUILD_DIR) $(MKDIR_P) $(BASE_BUILD_DIR)
$(OCAMLBUILD_CONFIG) -build-dir $(INFER_BUILD_DIR) \ $(OCAMLBUILD_CONFIG) -build-dir $(INFER_BUILD_DIR) \
$(INFER_CONFIG_TARGETS) $(INFER_CONFIG_TARGETS)
# let make know that the target is up-to-date even if ocamlbuild cached it # let make know that the target is up-to-date even if ocamlbuild cached it
$(QUIET)touch $@ $(QUIET)touch $@
$(BIN_DIR): Makefile INFER_BIN_ALIASES = $(foreach alias,$(INFER_COMMANDS),$(BIN_DIR)/$(alias))
$(MKDIR_P) $@
$(INFER_BIN_ALIASES): Makefile
# make sure the bin directory exists
$(QUIET)$(MKDIR_P) $(@D)
$(QUIET)cd $(@D) && $(LN_S) -f infer $(@F)
$(QUIET)touch $@ $(QUIET)touch $@
$(INFER_BIN).native: $(INFER_BUILD_DIR)/$(INFER_MAIN).native $(BIN_DIR) $(INFER_BIN).native: $(INFER_BUILD_DIR)/$(INFER_MAIN).native $(INFER_BIN_ALIASES)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERANALYZE_MAIN).native $(INFERANALYZE_BIN)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERPRINT_MAIN).native $(INFERPRINT_BIN)
ifeq ($(BUILD_C_ANALYZERS),yes)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERCLANG_MAIN).native $(INFERCLANG_BIN)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERCLANG_MAIN).native $(INFERCLANGXX_BIN)
endif
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFER_MAIN).native $(INFER_BIN) $(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFER_MAIN).native $(INFER_BIN)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFER_MAIN).native $(INFER_BIN).native $(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFER_MAIN).native $(INFER_BIN).native
@ -217,22 +202,19 @@ ifeq ($(BUILD_C_ANALYZERS),yes)
infer: $(CLANG_BINIOU_DICT) infer: $(CLANG_BINIOU_DICT)
endif endif
$(INFER_BUILD_DIR)/$(INFER_MAIN).byte: base/Version.ml $(OCAML_CONFIG_SOURCES) $(INFER_BUILD_DIR)/$(INFER_MAIN).byte: base/Version.ml $(OCAML_CONFIG_SOURCES) \
$(MAKEFILE_LIST)
$(MKDIR_P) $(BASE_BUILD_DIR) $(MKDIR_P) $(BASE_BUILD_DIR)
$(OCAMLBUILD_CONFIG) -build-dir $(INFER_BUILD_DIR) \ $(OCAMLBUILD_CONFIG) -build-dir $(INFER_BUILD_DIR) \
$(INFER_CONFIG_TARGETS:.native=.byte) $(INFERUNIT_MAIN).byte $(INFER_CONFIG_TARGETS:.native=.byte)
$(QUIET)touch $@ $(QUIET)touch $@
$(INFER_BIN).byte: $(INFER_BUILD_DIR)/$(INFER_MAIN).byte $(BIN_DIR) $(INFER_BIN).byte: $(INFER_BUILD_DIR)/$(INFER_MAIN).byte $(INFER_BIN_ALIASES)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERANALYZE_MAIN).byte $(INFERANALYZE_BIN)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERPRINT_MAIN).byte $(INFERPRINT_BIN)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERUNIT_MAIN).byte $(INFERUNIT_BIN)
ifeq ($(BUILD_C_ANALYZERS),yes)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERCLANG_MAIN).byte $(INFERCLANG_BIN)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERCLANG_MAIN).byte $(INFERCLANGXX_BIN)
endif
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFER_MAIN).byte $(INFER_BIN) $(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFER_MAIN).byte $(INFER_BIN)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFER_MAIN).byte $(INFER_BIN).byte $(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFER_MAIN).byte $(INFER_BIN).byte
ifeq ($(TEST),1)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERUNIT_MAIN).byte $(INFERUNIT_BIN)
endif
.PHONY: byte .PHONY: byte
byte: $(INFER_BIN).byte byte: $(INFER_BIN).byte
@ -269,7 +251,7 @@ rei:
%.rei : %.mli %.rei : %.mli
$(SCRIPT_DIR)/refmt.sh -parse ml -print re $< > $*.rei $(SCRIPT_DIR)/refmt.sh -parse ml -print re $< > $*.rei
roots:=Infer InferAnalyzeExe InferClang InferPrintExe StatsAggregator roots:=Infer StatsAggregator
clusters:=base clang java IR clusters:=base clang java IR
ml_src_files:=$(shell find $(DEPENDENCIES) -regex '.*\.ml\(i\)*') ml_src_files:=$(shell find $(DEPENDENCIES) -regex '.*\.ml\(i\)*')
@ -401,7 +383,7 @@ base/Version.ml: base/Version.ml.in $(MAKEFILE_LIST)
.PHONY: clean .PHONY: clean
clean: clean:
$(REMOVE) $(INFER_ALL_TARGETS) $(REMOVE) $(INFER_TARGET)
$(REMOVE) toplevel.mlpack $(REMOVE) toplevel.mlpack
$(REMOVE_DIR) $(BUILD_DIR) $(REMOVE_DIR) $(BUILD_DIR)
$(REMOVE) $(ETC_DIR)/clang_ast.dict $(REMOVE) $(ETC_DIR)/clang_ast.dict
@ -409,8 +391,7 @@ clean:
$(REMOVE) base/Version.ml.tmp.* $(REMOVE) base/Version.ml.tmp.*
$(REMOVE) backend/jsonbug_{j,t}.ml{,i} $(REMOVE) backend/jsonbug_{j,t}.ml{,i}
$(REMOVE) checkers/stacktree_{j,t}.ml{,i} $(REMOVE) checkers/stacktree_{j,t}.ml{,i}
$(REMOVE) $(INFER_BIN){,.byte,.native} $(INFERCLANG_BIN) $(INFERCLANGXX_BIN) $(REMOVE) $(INFER_BIN){,.byte,.native} $(INFER_BIN_ALIASES)
$(REMOVE) $(INFERANALYZE_BIN) $(INFERPRINT_BIN)
$(REMOVE) $(INFERUNIT_BIN) $(CHECKCOPYRIGHT_BIN) $(REMOVE) $(INFERUNIT_BIN) $(CHECKCOPYRIGHT_BIN)
$(REMOVE) $(CLANG_ATDGEN_STUBS) $(REMOVE) $(CLANG_ATDGEN_STUBS)
$(REMOVE) $(INFER_CLANG_FCP_MIRRORED_FILES) $(REMOVE) $(INFER_CLANG_FCP_MIRRORED_FILES)

@ -182,3 +182,17 @@ let main makefile => {
output_json_makefile_stats clusters_to_analyze output_json_makefile_stats clusters_to_analyze
} }
}; };
let register_perf_stats_report () => {
let stats_dir = Filename.concat Config.results_dir Config.backend_stats_dir_name;
let cluster =
switch Config.cluster_cmdline {
| Some cl => "_" ^ cl
| None => ""
};
let stats_base = Config.perf_stats_prefix ^ Filename.basename cluster ^ ".json";
let stats_file = Filename.concat stats_dir stats_base;
Utils.create_dir Config.results_dir;
Utils.create_dir stats_dir;
PerfStats.register_report_at_exit stats_file
};

@ -14,3 +14,5 @@ open! IStd;
/** Given a name of the Makefile to use for multicore analysis, analyze the captured code */ /** Given a name of the Makefile to use for multicore analysis, analyze the captured code */
let main: string => unit; let main: string => unit;
let register_perf_stats_report: unit => unit;

@ -1,41 +0,0 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
open! IStd;
/** Main module for the analysis after the capture phase */
module L = Logging;
let register_perf_stats_report () => {
let stats_dir = Filename.concat Config.results_dir Config.backend_stats_dir_name;
let cluster =
switch Config.cluster_cmdline {
| Some cl => "_" ^ cl
| None => ""
};
let stats_base = Config.perf_stats_prefix ^ Filename.basename cluster ^ ".json";
let stats_file = Filename.concat stats_dir stats_base;
Utils.create_dir Config.results_dir;
Utils.create_dir stats_dir;
PerfStats.register_report_at_exit stats_file
};
let () = {
Logging.set_log_file_identifier
CommandLineOption.Analyze (Option.map f::Filename.basename Config.cluster_cmdline);
if Config.print_builtins {
Builtin.print_and_exit ()
};
if (Sys.file_exists Config.results_dir != `Yes) {
L.err "ERROR: results directory %s does not exist@.@." Config.results_dir;
Config.print_usage_exit ()
};
register_perf_stats_report ();
InferAnalyze.main Config.makefile_cmdline
};

@ -1,10 +0,0 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
open! IStd;
/** Main module for the analysis after the capture phase */

@ -1,11 +0,0 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
open! IStd;
let () = InferPrint.main_from_config ();

@ -1,9 +0,0 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
open! IStd;

@ -2,7 +2,6 @@
The back end is responsible for the analysis of a project starting from an intermediate representation stored in the results directory, typically `infer-out`. The back end is responsible for the analysis of a project starting from an intermediate representation stored in the results directory, typically `infer-out`.
The main entry point is module [InferAnalyze](InferAnalyze.re) which produces the back-end executable `InferAnalyze`. The main entry point is module [InferAnalyze](InferAnalyze.re).
Module [InferPrint](InferPrint.re) produces the executable `InferPrint`, which is used to export analysis results.
Module [InferPrint](InferPrint.re) is used to export the analysis results.

@ -25,7 +25,7 @@ let pp_prolog fmt clusters =
List.map ~f:infer_flag_of_compilation_db !Config.clang_compilation_dbs List.map ~f:infer_flag_of_compilation_db !Config.clang_compilation_dbs
|> String.concat ~sep:" " |> escape in |> String.concat ~sep:" " |> escape in
F.fprintf fmt "INFERANALYZE = '%s' --results-dir '%s' %s@\n@\n" F.fprintf fmt "INFERANALYZE = '%s' --results-dir '%s' %s@\n@\n"
(Config.(bin_dir ^/ infer_analyze_exe_name)) (Config.bin_dir ^/ CommandDoc.exe_name_of_command CLOpt.Analyze)
(escape Config.results_dir) (escape Config.results_dir)
compilation_dbs_cmd; compilation_dbs_cmd;
F.fprintf fmt "CLUSTERS="; F.fprintf fmt "CLUSTERS=";

@ -546,6 +546,21 @@ let differential_mode () =
let () = let () =
match Config.command with match Config.command with
| Analyze ->
Logging.set_log_file_identifier
CommandLineOption.Analyze (Option.map ~f:Filename.basename Config.cluster_cmdline);
if Config.print_builtins then Builtin.print_and_exit ();
if Sys.file_exists Config.results_dir <> `Yes then (
L.err "ERROR: results directory %s does not exist@.@." Config.results_dir;
Config.print_usage_exit ()
);
InferAnalyze.register_perf_stats_report ();
InferAnalyze.main Config.makefile_cmdline
| Clang ->
let prog, args = match Array.to_list Sys.argv with
| prog::args -> prog, args
| [] -> assert false (* Sys.argv is never empty *) in
ClangWrapper.exe ~prog ~args
| Report -> InferPrint.main_from_config () | Report -> InferPrint.main_from_config ()
| ReportDiff -> differential_mode () | ReportDiff -> differential_mode ()
| _ -> infer_mode () | Capture | Compile | Run -> infer_mode ()

@ -14,22 +14,29 @@ type data = { long: string; command_doc: CLOpt.command_doc }
let inferconfig_env_var = "INFERCONFIG" let inferconfig_env_var = "INFERCONFIG"
let infer_exe_name = "infer"
(** Name of the infer configuration file *) (** Name of the infer configuration file *)
let inferconfig_file = ".inferconfig" let inferconfig_file = ".inferconfig"
let command_to_long = CLOpt.[ let command_to_long = CLOpt.[
Analyze, "analyze"; Capture, "capture"; Clang, "clang"; Compile, "compile"; Report, "report"; Analyze, "analyze"; Capture, "capture"; Compile, "compile"; Report, "report";
ReportDiff, "reportdiff"; Run, "run"; ReportDiff, "reportdiff"; Run, "run";
] ]
let long_of_command = let long_of_command =
List.Assoc.find_exn ~equal:CLOpt.equal_command command_to_long List.Assoc.find_exn ~equal:CLOpt.equal_command command_to_long
let exe_name_of_long long =
Printf.sprintf "%s-%s" infer_exe_name long
let exe_name_of_command cmd = let exe_name_of_command cmd =
let long = long_of_command cmd in long_of_command cmd |> exe_name_of_long
(* InferClang is special because it's not really a user-facing executable *)
if CLOpt.equal_command cmd CLOpt.Clang then "InferClang" let command_of_exe_name exe_name =
else "infer-" ^ long List.find_map command_to_long ~f:(fun (cmd, long) ->
if String.equal exe_name (exe_name_of_long long) then Some cmd
else None)
let mk_command_doc ~see_also:see_also_commands ?and_also ?environment:environment_opt let mk_command_doc ~see_also:see_also_commands ?and_also ?environment:environment_opt
?files:files_opt ~synopsis = ?files:files_opt ~synopsis =
@ -88,17 +95,6 @@ let capture =
] ]
~see_also:CLOpt.[Analyze;Compile;Run] ~see_also:CLOpt.[Analyze;Compile;Run]
let clang =
mk_command_doc ~title:"Infer Clang Capture"
~short_description:"internal tool to capture clang commands"
~synopsis:"$(b,InferClang) $(i,[clang options])"
~description:[`P "This is used internally by other infer commands. You shouldn't need to call \
this directly."]
~options:(`Replace
[`P "Accepts the same command line options as $(b,clang)(1) (but still reads infer \
options from the environment)."])
~see_also:CLOpt.[Capture]
let compile = let compile =
mk_command_doc ~title:"Infer Project Compilation" mk_command_doc ~title:"Infer Project Compilation"
~short_description:"compile project from within the infer environment" ~short_description:"compile project from within the infer environment"
@ -271,7 +267,7 @@ let command_to_data =
let long = long_of_command cmd in let long = long_of_command cmd in
let command_doc = mk_doc (exe_name_of_command cmd) in let command_doc = mk_doc (exe_name_of_command cmd) in
cmd, { long; command_doc } in cmd, { long; command_doc } in
CLOpt.[mk Analyze analyze; mk Capture capture; mk Clang clang; mk Compile compile; CLOpt.[mk Analyze analyze; mk Capture capture; mk Compile compile;
mk Report report; mk ReportDiff reportdiff; mk Run run] mk Report report; mk ReportDiff reportdiff; mk Run run]
let data_of_command command = let data_of_command command =

@ -12,8 +12,13 @@ module CLOpt = CommandLineOption
type data = { long: string; command_doc: CLOpt.command_doc } type data = { long: string; command_doc: CLOpt.command_doc }
val infer_exe_name : string
val inferconfig_env_var : string val inferconfig_env_var : string
val inferconfig_file : string val inferconfig_file : string
val long_of_command : CLOpt.command -> string
val exe_name_of_command : CLOpt.command -> string
val command_of_exe_name : string -> CLOpt.command option
val infer : CLOpt.command_doc val infer : CLOpt.command_doc
val data_of_command : CLOpt.command -> data val data_of_command : CLOpt.command -> data

@ -834,8 +834,11 @@ let show_manual ?internal_section format default_doc command_opt =
| None -> | None ->
default_doc default_doc
| Some command -> | Some command ->
let (command_doc, _, _) = List.Assoc.find_exn !subcommands command in match List.Assoc.find_exn !subcommands command with
command_doc in | (Some command_doc, _, _) ->
command_doc
| (None, _, _) ->
invalid_argf "No manual for internal command %s" (string_of_command command) in
let pp_meta f meta = match meta with let pp_meta f meta = match meta with
| "" -> () | "" -> ()
| meta -> F.fprintf f " $(i,%s)" (Cmdliner.Manpage.escape meta) in | meta -> F.fprintf f " $(i,%s)" (Cmdliner.Manpage.escape meta) in

@ -189,11 +189,12 @@ val mk_command_doc : title:string -> section:int -> version:string -> date:strin
(** [mk_subcommand command ~long command_doc] defines the subcommand [command]. A subcommand is (** [mk_subcommand command ~long command_doc] defines the subcommand [command]. A subcommand is
activated by passing [--long], [name], or any [-key] for [key] in [deprecated] on the command activated by passing [--long], [name], or any [-key] for [key] in [deprecated] on the command
line. [name] defaults to [long]. A man page is automatically generated for [command] based on line. [name] defaults to [long]. A man page is automatically generated for [command] based on
the information in [command_doc]. [on_unknown_arg] is the action taken on unknown anonymous the information in [command_doc], if available (otherwise the command is considered internal).
arguments; it is `Reject by default. *) [on_unknown_arg] is the action taken on unknown anonymous arguments; it is `Reject by default.
*)
val mk_subcommand : command -> ?on_unknown_arg:[`Add | `Skip | `Reject] -> val mk_subcommand : command -> ?on_unknown_arg:[`Add | `Skip | `Reject] ->
?deprecated:string list -> long:string -> ?name:string -> ?deprecated:string list -> long:string -> ?name:string ->
?parse_mode:parse_mode -> ?in_help:(command * string) list -> command_doc -> unit ?parse_mode:parse_mode -> ?in_help:(command * string) list -> command_doc option -> unit
(** environment variable use to pass arguments from parent to child processes *) (** environment variable use to pass arguments from parent to child processes *)
val args_env_var : string val args_env_var : string

@ -17,26 +17,6 @@ open! PVariant
module CLOpt = CommandLineOption module CLOpt = CommandLineOption
module F = Format module F = Format
type exe = Analyze | Clang | Driver | Print [@@deriving compare]
let equal_exe = [%compare.equal : exe]
(* TODO(16551801) better place to declare analyzers *)
let infer_exe_name = "infer"
let infer_analyze_exe_name = "InferAnalyze"
(** Association list of executable (base)names to their [exe]s. *)
let exes = [
(infer_analyze_exe_name, Analyze);
("InferClang", Clang);
(infer_exe_name, Driver);
("InferPrint", Print);
]
let exe_name =
let exe_to_name = List.map ~f:(fun (n,a) -> (a,n)) exes in
fun exe -> List.Assoc.find_exn ~equal:equal_exe exe_to_name exe
type analyzer = type analyzer =
| BiAbduction | CaptureOnly | CompileOnly | Eradicate | Checkers | Tracing | Crashcontext | BiAbduction | CaptureOnly | CompileOnly | Eradicate | Checkers | Tracing | Crashcontext
| Linters | Linters
@ -288,23 +268,23 @@ let version_string =
Unix.time *) Unix.time *)
let initial_analysis_time = Unix.time () let initial_analysis_time = Unix.time ()
(* Resolve symlinks to get to the real executable. The real executable is located in [bin_dir] let clang_exe_aliases = [
below, which allows us to find [lib_dir], [models_dir], etc., relative to it. *) (* this must be kept in sync with the clang-like symlinks in [wrappers_dir] (see below) *)
let real_exe_name = "c++"; "cc"; "clang"; "clang++"; "g++"; "gcc";
Utils.realpath Sys.executable_name ]
let current_exe =
List.Assoc.find ~equal:String.equal exes (Filename.basename real_exe_name) |>
Option.value ~default:Driver
let initial_command = match current_exe with let initial_command =
| Analyze -> Some CLOpt.Analyze (* Sys.executable_name tries to do clever things which we must avoid, use argv[0] instead *)
| Clang -> Some CLOpt.Clang let exe_basename = Filename.basename Sys.argv.(0) in
| Driver -> None let is_clang = List.mem ~equal:String.equal clang_exe_aliases in
| Print -> Some CLOpt.Report match CommandDoc.command_of_exe_name exe_basename with
| Some _ as command -> command
| None when is_clang exe_basename -> Some CLOpt.Clang
| None -> None
let bin_dir = let bin_dir =
Filename.dirname real_exe_name (* Resolve symlinks to get to the real executable, which is located in [bin_dir]. *)
Filename.dirname (Utils.realpath Sys.executable_name)
let lib_dir = let lib_dir =
bin_dir ^/ Filename.parent_dir_name ^/ "lib" bin_dir ^/ Filename.parent_dir_name ^/ "lib"
@ -369,20 +349,20 @@ let startup_action =
let open CLOpt in let open CLOpt in
if infer_is_javac then Javac if infer_is_javac then Javac
else if !Sys.interactive then NoParse else if !Sys.interactive then NoParse
else match current_exe with else match initial_command with
| Analyze | Driver | Print -> InferCommand | Some Clang ->
| Clang -> NoParse NoParse
| None | Some (Analyze | Capture | Compile | Report | ReportDiff | Run) ->
InferCommand
let exe_usage = let exe_usage =
let exe_command = match current_exe with let exe_command_name = match initial_command with
| Analyze -> Some "analyze" | Some CLOpt.Clang -> None (* users cannot see this *)
| Clang -> Some "clang" | Some command -> Some (CommandDoc.long_of_command command)
| Print -> Some "report" | None -> None in
| Driver -> None in
Printf.sprintf "%s\nUsage: infer %s [options]\nSee `infer%s --help` for more information." Printf.sprintf "%s\nUsage: infer %s [options]\nSee `infer%s --help` for more information."
version_string (Option.value ~default:"command" exe_command) version_string (Option.value ~default:"command" exe_command_name)
(Option.value_map ~default:"" ~f:((^) " ") exe_command) (Option.value_map ~default:"" ~f:((^) " ") exe_command_name)
(** Command Line options *) (** Command Line options *)
@ -416,17 +396,21 @@ let anon_args = CLOpt.mk_anon ()
let () = let () =
let on_unknown_arg_from_command (cmd: CLOpt.command) = match cmd with let on_unknown_arg_from_command (cmd: CLOpt.command) = match cmd with
| Clang -> `Skip | Clang -> assert false (* filtered out *)
| Report -> `Add | Report -> `Add
| Analyze | Capture | Compile | ReportDiff | Run -> `Reject in | Analyze | Capture | Compile | ReportDiff | Run -> `Reject in
let command_deprecated = let command_deprecated =
List.Assoc.find ~equal:CLOpt.equal_command CLOpt.[ReportDiff, ["-diff"]] in List.Assoc.find ~equal:CLOpt.equal_command CLOpt.[ReportDiff, ["-diff"]] in
(* make sure we generate doc for all the commands we know about *) (* make sure we generate doc for all the commands we know about *)
List.iter CLOpt.all_commands ~f:(fun cmd -> List.filter ~f:(Fn.non (CLOpt.(equal_command Clang))) CLOpt.all_commands
|> List.iter ~f:(fun cmd ->
let { CommandDoc.long; command_doc } = CommandDoc.data_of_command cmd in let { CommandDoc.long; command_doc } = CommandDoc.data_of_command cmd in
let on_unknown_arg = on_unknown_arg_from_command cmd in let on_unknown_arg = on_unknown_arg_from_command cmd in
let deprecated = command_deprecated cmd in let deprecated = command_deprecated cmd in
CLOpt.mk_subcommand cmd ~long ~on_unknown_arg ?deprecated command_doc) CLOpt.mk_subcommand cmd ~long ~on_unknown_arg ?deprecated (Some command_doc))
let () =
CLOpt.mk_subcommand CLOpt.Clang ~long:"" ~on_unknown_arg:`Skip None
let abs_struct = let abs_struct =
CLOpt.mk_int ~deprecated:["absstruct"] ~long:"abs-struct" ~default:1 CLOpt.mk_int ~deprecated:["absstruct"] ~long:"abs-struct" ~default:1
@ -738,7 +722,7 @@ and (
and developer_mode = and developer_mode =
CLOpt.mk_bool ~long:"developer-mode" CLOpt.mk_bool ~long:"developer-mode"
~default:(equal_exe current_exe Print) ~default:(Option.value_map ~default:false ~f:(CLOpt.(equal_command Report)) initial_command)
"Show internal exceptions" "Show internal exceptions"
and filtering = and filtering =
@ -953,7 +937,7 @@ and frontend_debug =
CLOpt.mk_bool ~deprecated:["fd"] ~deprecated_no:["nfd"] ~long:"frontend-debug" CLOpt.mk_bool ~deprecated:["fd"] ~deprecated_no:["nfd"] ~long:"frontend-debug"
~in_help:CLOpt.[Capture, manual_clang] ~in_help:CLOpt.[Capture, manual_clang]
"Emit debug info to *.o.astlog and a script *.o.sh that replays the command used to run clang \ "Emit debug info to *.o.astlog and a script *.o.sh that replays the command used to run clang \
with the plugin attached, piped to the InferClang frontend command" with the plugin attached, piped to the infer frontend"
and frontend_stats = and frontend_stats =
CLOpt.mk_bool ~deprecated:["fs"] ~deprecated_no:["nfs"] ~long:"frontend-stats" CLOpt.mk_bool ~deprecated:["fs"] ~deprecated_no:["nfs"] ~long:"frontend-stats"
@ -1614,7 +1598,13 @@ let post_parsing_initialization command_opt =
| Some Crashcontext -> checkers := true; crashcontext := true | Some Crashcontext -> checkers := true; crashcontext := true
| Some Eradicate -> checkers := true; eradicate := true | Some Eradicate -> checkers := true; eradicate := true
| Some Tracing -> tracing := true | Some Tracing -> tracing := true
| Some (CaptureOnly | CompileOnly | BiAbduction | Linters) | None -> () | Some (CaptureOnly | CompileOnly | BiAbduction | Linters) -> ()
| None ->
let open CLOpt in
match command_opt with
| Some Compile -> analyzer := Some CompileOnly
| Some Capture -> analyzer := Some CaptureOnly
| _ -> ()
); );
Option.value ~default:CLOpt.Run command_opt Option.value ~default:CLOpt.Run command_opt

@ -99,8 +99,6 @@ val frontend_stats_dir_name : string
val global_tenv_filename : string val global_tenv_filename : string
val idempotent_getters : bool val idempotent_getters : bool
val incremental_procs : bool val incremental_procs : bool
val infer_exe_name : string
val infer_analyze_exe_name : string
val infer_py_argparse_error_exit_code : int val infer_py_argparse_error_exit_code : int
val initial_analysis_time : float val initial_analysis_time : float
val ivar_attributes : string val ivar_attributes : string

@ -139,7 +139,7 @@ let run_plugin_and_frontend source_path frontend clang_args => {
if debug_mode { if debug_mode {
/* -cc1 clang commands always set -o explicitly */ /* -cc1 clang commands always set -o explicitly */
let basename = source_path ^ ".ast"; let basename = source_path ^ ".ast";
/* Emit the clang command with the extra args piped to InferClang */ /* Emit the clang command with the extra args piped to infer-as-clang */
let frontend_script_fname = Printf.sprintf "%s.sh" basename; let frontend_script_fname = Printf.sprintf "%s.sh" basename;
let debug_script_out = open_out frontend_script_fname; let debug_script_out = open_out frontend_script_fname;
let debug_script_fmt = Format.formatter_of_out_channel debug_script_out; let debug_script_fmt = Format.formatter_of_out_channel debug_script_out;

@ -1,15 +0,0 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
open! IStd;
let () =
switch (Array.to_list Sys.argv) {
| [prog, ...args] => ClangWrapper.exe ::prog ::args
| [] => assert false /* Sys.argv is never empty */
};

@ -100,8 +100,7 @@ val log_out : Format.formatter ref
val pointer_decl_index : Clang_ast_t.decl Clang_ast_main.PointerMap.t ref val pointer_decl_index : Clang_ast_t.decl Clang_ast_main.PointerMap.t ref
val pointer_stmt_index : Clang_ast_t.stmt Clang_ast_main.PointerMap.t ref val pointer_stmt_index : Clang_ast_t.stmt Clang_ast_main.PointerMap.t ref
(** Map from clang pointers to types produced by ast exporter. Populated once on InferClang (** Map from clang pointers to types produced by ast exporter. Populated once on startup *)
startup *)
val pointer_type_index : Clang_ast_t.c_type Clang_ast_main.PointerMap.t ref val pointer_type_index : Clang_ast_t.c_type Clang_ast_main.PointerMap.t ref
(** Map from type pointers (clang pointers and types created later by frontend) to sil types (** Map from type pointers (clang pointers and types created later by frontend) to sil types

@ -33,7 +33,7 @@ let infer_profile = lazy
\n </plugins>\ \n </plugins>\
\n </build>\ \n </build>\
\n </profile>\ \n </profile>\
" infer_profile_name (Config.(bin_dir ^/ infer_exe_name))) " infer_profile_name (Config.bin_dir ^/ CommandDoc.infer_exe_name))
let pom_worklist = ref [CLOpt.init_work_dir] let pom_worklist = ref [CLOpt.init_work_dir]

@ -45,10 +45,10 @@ infer-out-reactive-capture/report.json: $(CMAKE_BUILD_DIR)/compile_commands.json
--changed-files-index $(CMAKE_DIR)/index.txt --compilation-database $<) --changed-files-index $(CMAKE_DIR)/index.txt --compilation-database $<)
issues.exp.test: infer-out-with-index/report.json infer-out-no-index/report.json infer-out-reactive-capture/report.json issues.exp.test: infer-out-with-index/report.json infer-out-no-index/report.json infer-out-reactive-capture/report.json
$(QUIET)$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.with-index \ $(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.with-index \
--from-json-report infer-out-with-index/report.json --from-json-report infer-out-with-index/report.json
$(QUIET)$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.no-index \ $(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.no-index \
--from-json-report infer-out-no-index/report.json --from-json-report infer-out-no-index/report.json
$(QUIET)$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.reactive-capture \ $(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.reactive-capture \
--from-json-report infer-out-reactive-capture/report.json --from-json-report infer-out-reactive-capture/report.json
$(QUIET)cat $@.with-index $@.no-index $@.reactive-capture > $@ $(QUIET)cat $@.with-index $@.no-index $@.reactive-capture > $@

@ -39,7 +39,7 @@ infer-out-simple_app/report.json: infer-out-app_with_infer_profile/report.json
infer-out-app_with_infer_profile/report.json: infer-out-app_with_profiles/report.json infer-out-app_with_infer_profile/report.json: infer-out-app_with_profiles/report.json
issues-%.exp.test: infer-out-%/report.json issues-%.exp.test: infer-out-%/report.json
$(QUIET)$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $< $(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $<
issues.exp.test: $(foreach mvndir,$(MVN_DIRS),issues-$(mvndir).exp.test) issues.exp.test: $(foreach mvndir,$(MVN_DIRS),issues-$(mvndir).exp.test)
# erase the contents of the file # erase the contents of the file

@ -22,7 +22,7 @@ $(REPORT):
$(INFER_BIN) -o $(INFER_OUT) --project-root $(CURDIR) -- javac SimpleLeak.java) $(INFER_BIN) -o $(INFER_OUT) --project-root $(CURDIR) -- javac SimpleLeak.java)
$(EXPECTED_TEST_OUTPUT): $(REPORT) $(EXPECTED_TEST_OUTPUT): $(REPORT)
$(QUIET)$(INFERPRINT_BIN) \ $(QUIET)$(INFER_BIN) report \
--issues-fields "qualifier_contains_potential_exception_note,bug_type,file,procedure,line_offset" \ --issues-fields "qualifier_contains_potential_exception_note,bug_type,file,procedure,line_offset" \
--from-json-report $(REPORT) \ --from-json-report $(REPORT) \
--issues-tests $(EXPECTED_TEST_OUTPUT) --issues-tests $(EXPECTED_TEST_OUTPUT)

@ -91,8 +91,8 @@ infer-out-make/report.json: $(CLANG_DEPS) $(MAKE_DIR)
$(INFER_BIN) -a $(ANALYZER) --results-dir $(CURDIR)/$(@D) -- \ $(INFER_BIN) -a $(ANALYZER) --results-dir $(CURDIR)/$(@D) -- \
make clean all) make clean all)
issues-%.exp.test: infer-out-%/report.json $(INFERPRINT_BIN) issues-%.exp.test: infer-out-%/report.json $(INFER_BIN)
$(QUIET)$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $< $(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $<
issues.exp.test: issues-cmake.exp.test issues-gradle.exp.test issues-javac.exp.test \ issues.exp.test: issues-cmake.exp.test issues-gradle.exp.test issues-javac.exp.test \
issues-make.exp.test issues-make.exp.test

@ -135,10 +135,10 @@ infer-out/report.json: $(CLANG_DEPS) $(SOURCES_DEFAULT)
$(QUIET)$(call check_no_duplicates,infer-out/duplicates.txt) $(QUIET)$(call check_no_duplicates,infer-out/duplicates.txt)
issues.exp.test: infer-out-all/report.json infer-out-arc/report.json infer-out/report.json issues.exp.test: infer-out-all/report.json infer-out-arc/report.json infer-out/report.json
$(QUIET)$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.all \ $(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.all \
--from-json-report infer-out-all/report.json --from-json-report infer-out-all/report.json
$(QUIET)$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.arc \ $(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.arc \
--from-json-report infer-out-arc/report.json --from-json-report infer-out-arc/report.json
$(QUIET)$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.default \ $(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@.default \
--from-json-report infer-out/report.json --from-json-report infer-out/report.json
$(QUIET)cat $@.all $@.arc $@.default > $@ $(QUIET)cat $@.all $@.arc $@.default > $@

@ -36,16 +36,16 @@ $(DIFFERENTIAL_REPORT): $(CURRENT_REPORT) $(PREVIOUS_REPORT)
--report-current $(CURRENT_REPORT) --report-previous $(PREVIOUS_REPORT) \ --report-current $(CURRENT_REPORT) --report-previous $(PREVIOUS_REPORT) \
$(DIFFERENTIAL_ARGS)) $(DIFFERENTIAL_ARGS))
$(EXPECTED_TEST_OUTPUT): $(DIFFERENTIAL_REPORT) $(INFERPRINT_BIN) $(EXPECTED_TEST_OUTPUT): $(DIFFERENTIAL_REPORT) $(INFER_BIN)
$(QUIET)$(INFERPRINT_BIN) \ $(QUIET)$(INFER_BIN) report \
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \ --issues-fields $(INFERPRINT_ISSUES_FIELDS) \
--from-json-report $(INFER_OUT)/differential/introduced.json \ --from-json-report $(INFER_OUT)/differential/introduced.json \
--issues-tests introduced.exp.test --issues-tests introduced.exp.test
$(QUIET)$(INFERPRINT_BIN) \ $(QUIET)$(INFER_BIN) report \
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \ --issues-fields $(INFERPRINT_ISSUES_FIELDS) \
--from-json-report $(INFER_OUT)/differential/fixed.json \ --from-json-report $(INFER_OUT)/differential/fixed.json \
--issues-tests fixed.exp.test --issues-tests fixed.exp.test
$(QUIET)$(INFERPRINT_BIN) \ $(QUIET)$(INFER_BIN) report \
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \ --issues-fields $(INFERPRINT_ISSUES_FIELDS) \
--from-json-report $(INFER_OUT)/differential/preexisting.json \ --from-json-report $(INFER_OUT)/differential/preexisting.json \
--issues-tests preexisting.exp.test --issues-tests preexisting.exp.test

@ -13,8 +13,8 @@ ANALYZER_STRING=$(shell if [ -n $(ANALYZER) ] && [ $(ANALYZER) != infer ]; then
default: compile default: compile
issues.exp.test$(TEST_SUFFIX): infer-out$(TEST_SUFFIX)/report.json $(INFERPRINT_BIN) issues.exp.test$(TEST_SUFFIX): infer-out$(TEST_SUFFIX)/report.json $(INFER_BIN)
$(QUIET)$(INFERPRINT_BIN) -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $< $(QUIET)$(INFER_BIN) report -q -a $(ANALYZER) $(INFERPRINT_OPTIONS) $@ --from-json-report $<
.PHONY: compile .PHONY: compile
compile: $(OBJECTS) compile: $(OBJECTS)

Loading…
Cancel
Save