[config] Combine analyze_models into models_mode

Summary:
Config.analyze_models, set by the INFER_ANALYZE_MODELS environment
variable, is redundant with Config.models_mode.

Reviewed By: jvillard

Differential Revision: D4047338

fbshipit-source-id: 4522d65
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent e73350598a
commit a7c1105147

@ -11,14 +11,12 @@ include $(ROOT_DIR)/Makefile.config
C_MODELS_FILE = $(SPECS_LIB_DIR)/c_models
C_MODELS_SOURCES = $(shell find src/ -name "*.c")
INFER = INFER_ANALYZE_MODELS=1 $(BIN_DIR)/infer
all: $(C_MODELS_FILE)
$(C_MODELS_FILE): $(C_MODELS_SOURCES) $(CLANG_DEPS)
# make clean in src/ in case $(CLANG_DEPS) have changed
$(MAKE) -C src clean
$(INFER) -o out/ --models_mode --no_failures_allowed -- $(MAKE) -C src
$(INFER_BIN) -o out/ --models-mode --no-failures-allowed -- $(MAKE) -C src
touch $(C_MODELS_FILE)
install: $(C_MODELS_FILE)

@ -12,14 +12,12 @@ CPP_MODELS_FILE = $(SPECS_LIB_DIR)/cpp_models
CPP_MODELS_SOURCES = $(shell find src/ -name "*.cpp")
C_MODELS_SOURCES = $(shell find src/c_src/ -name "*.c")
INFER = INFER_ANALYZE_MODELS=1 $(BIN_DIR)/infer
all: $(CPP_MODELS_FILE)
$(CPP_MODELS_FILE): $(CPP_MODELS_SOURCES) $(C_MODELS_SOURCES) $(CLANG_DEPS)
# make clean in src/ in case $(CLANG_DEPS) have changed
$(MAKE) -C src clean
$(INFER) -o out/ --models_mode --no_failures_allowed --cxx -- $(MAKE) -C src
$(INFER_BIN) -o out/ --models-mode --no-failures-allowed --cxx -- $(MAKE) -C src
touch $(CPP_MODELS_FILE)
install: $(CPP_MODELS_FILE)

@ -8,9 +8,6 @@
ROOT_DIR = ../../..
include $(ROOT_DIR)/Makefile.config
INFER = INFER_ANALYZE_MODELS=1 $(INFER_BIN) \
--buck --analyzer infer --multicore 1
ANDROID_JAR = $(LIB_DIR)/java/android/android-19.jar
JACKSON_JAR = $(DEPENDENCIES_DIR)/java/jackson/jackson-2.2.3.jar
INFER_ANNOTATIONS_JAR = $(ANNOTATIONS_DIR)/annotations.jar
@ -36,7 +33,7 @@ $(INFER_REPORT): $(ANDROID_JAR) $(JACKSON_JAR) $(JAVA_DEPS) $(INFER_ANNOTATIONS_
@rm -fr $(MODELS_OUT)
mkdir -p $(MODELS_OUT)
@rm -f $(DEPLOYED_MODELS_JAR)
$(INFER) -- javac -bootclasspath $(ANDROID_JAR) -d $(MODELS_OUT) -classpath $(JACKSON_JAR):$(INFER_ANNOTATIONS_JAR) $(JAVA_SOURCES)
$(INFER_BIN) --buck --models-mode -- javac -bootclasspath $(ANDROID_JAR) -d $(MODELS_OUT) -classpath $(JACKSON_JAR):$(INFER_ANNOTATIONS_JAR) $(JAVA_SOURCES)
$(MODELS_JAR): $(INFER_REPORT)
cd $(MODELS_OUT); jar cf ../$(MODELS_JAR) *

@ -11,14 +11,12 @@ include $(ROOT_DIR)/Makefile.config
OBJC_MODELS_FILE = $(SPECS_LIB_DIR)/objc_models
OBJC_MODELS_SOURCES = $(shell find src/ -name "*.m" -or -name "*.c")
INFER = INFER_ANALYZE_MODELS=1 $(BIN_DIR)/infer
all: $(OBJC_MODELS_FILE)
$(OBJC_MODELS_FILE): $(OBJC_MODELS_SOURCES) $(CLANG_DEPS)
# make clean in src/ in case $(CLANG_DEPS) have changed
$(MAKE) -C src clean
$(INFER) -o out/ --models_mode --no_failures_allowed -- $(MAKE) -C src
$(INFER_BIN) -o out/ --models-mode --no-failures-allowed -- $(MAKE) -C src
touch $(OBJC_MODELS_FILE)
install: $(OBJC_MODELS_FILE)

@ -1464,7 +1464,7 @@ let do_analysis exe_env =
IList.iter
(fun ((pn, _) as x) ->
let should_init () =
Config.analyze_models ||
Config.models_mode ||
Specs.get_summary pn = None in
if should_init ()
then init_proc x)

@ -1232,8 +1232,6 @@ let get_env_variable var_name =
if v = "" then None else Some v
with Not_found -> None
let analyze_models = from_env_variable "INFER_ANALYZE_MODELS"
(** experimental: handle dynamic dispatch by following the JVM semantics and creating
during the symbolic excution procedure descriptions using the types information
found in the abstract state *)
@ -1311,7 +1309,7 @@ let post_parsing_initialization () =
let default_seconds_timeout = 10.0 in
let long_symops_timeout = 1000 in
let long_seconds_timeout = 30.0 in
if analyze_models then
if !models_mode then
(* use longer timeouts when analyzing models *)
long_symops_timeout, long_seconds_timeout
else

@ -134,7 +134,6 @@ val wrappers_dir : string
val from_env_variable : string -> bool
val get_env_variable : string -> string option
val analyze_models : bool
val lazy_dynamic_dispatch : bool
val report_custom_error : bool
val sound_dynamic_dispatch : bool

@ -16,9 +16,9 @@ module L = Logging
let () =
(match Config.models_file with Some file -> JClasspath.add_models file | None -> ());
if Config.analyze_models && !JClasspath.models_jar <> "" then
if Config.models_mode && !JClasspath.models_jar <> "" then
failwith "Not expecting model file when analyzing the models";
if not Config.analyze_models && !JClasspath.models_jar = "" then
if not Config.models_mode && !JClasspath.models_jar = "" then
failwith "Java model file is required"
@ -96,7 +96,7 @@ let load_tenv () =
match Tenv.load_from_file DB.global_tenv_fname with
| None ->
Tenv.create ()
| Some _ when Config.analyze_models ->
| Some _ when Config.models_mode ->
let error_msg =
"Unexpected tenv file "
^ (DB.filename_to_string DB.global_tenv_fname)
@ -111,7 +111,7 @@ let load_tenv () =
(* Store to a file the type environment containing all the types required to perform the analysis *)
let save_tenv tenv =
if not Config.analyze_models then JTransType.add_models_types tenv;
if not Config.models_mode then JTransType.add_models_types tenv;
(* TODO: this prevents per compilation step incremental analysis at this stage *)
if DB.file_exists DB.global_tenv_fname then DB.file_remove DB.global_tenv_fname;
JUtils.log "writing new tenv %s@." (DB.filename_to_string DB.global_tenv_fname);

@ -626,7 +626,7 @@ let method_invocation
let instrs =
match call_args with
(* modeling a class bypasses the treatment of Closeable *)
| _ when Config.analyze_models || JClasspath.is_model callee_procname -> call_instrs
| _ when Config.models_mode || JClasspath.is_model callee_procname -> call_instrs
(* add a file attribute when calling the constructor of a subtype of Closeable *)
| (_, typ) as exp :: _

Loading…
Cancel
Save