diff --git a/.gitignore b/.gitignore index 46fd96e39..1b4638a24 100644 --- a/.gitignore +++ b/.gitignore @@ -155,6 +155,8 @@ infer/src/.project /infer/src/jbuild.common /infer/src/jbuild /infer/src/atd/jbuild +/infer/src/base/jbuild +/infer/src/IR/jbuild /infer/src/istd/jbuild /infer/src/scripts/jbuild /infer/src/jbuild-workspace diff --git a/infer/src/.merlin b/infer/src/.merlin index 499eb37ff..2e2a0a7bc 100644 --- a/infer/src/.merlin +++ b/infer/src/.merlin @@ -2,10 +2,12 @@ B _build/default/.InferModules.objs B _build/default/.infer.eobjs B _build/default/.infertop.eobjs B _build/default/atd/.InferGenerated.objs +B _build/default/base/.InferBase.objs +B _build/default/IR/.InferIR.objs B _build/default/istd/.InferStdlib.objs FLG -principal -safe-string -short-paths -strict-formats -strict-sequence FLG -w +a-4-9-40-41-42-44-45-48-60 -FLG -open InferStdlib -open InferGenerated -open InferModules -open IStd +FLG -open Core -open InferStdlib -open InferGenerated -open InferModules -open IStd -open InferBase -open InferIR PKG ANSITerminal PKG atd PKG atdgen diff --git a/infer/src/base/SourceFiles.ml b/infer/src/IR/SourceFiles.ml similarity index 100% rename from infer/src/base/SourceFiles.ml rename to infer/src/IR/SourceFiles.ml diff --git a/infer/src/base/SourceFiles.mli b/infer/src/IR/SourceFiles.mli similarity index 100% rename from infer/src/base/SourceFiles.mli rename to infer/src/IR/SourceFiles.mli diff --git a/infer/src/IR/jbuild.in b/infer/src/IR/jbuild.in new file mode 100644 index 000000000..c839e2ae7 --- /dev/null +++ b/infer/src/IR/jbuild.in @@ -0,0 +1,16 @@ +(* -*- tuareg -*- *) +(* NOTE: prepend jbuild.common to this file! *) +;; Format.sprintf + {| +(library + ((name InferIR) + (flags (%s -open Core -open InferStdlib -open IStd -open InferGenerated -open InferBase)) + (ocamlopt_flags (%s)) + (libraries (%s)) + (preprocess (pps (ppx_compare))) + )) +|} + (String.concat " " common_cflags) + (String.concat " " common_optflags) + (String.concat " " ("InferBase" :: common_libraries)) + |> Jbuild_plugin.V1.send diff --git a/infer/src/Makefile b/infer/src/Makefile index dbafacdc6..894323f3b 100644 --- a/infer/src/Makefile +++ b/infer/src/Makefile @@ -95,7 +95,7 @@ all: infer GENERATED_FROM_AUTOCONF = jbuild.common jbuild-workspace base/Version.ml -GENERATED_JBUILDS += jbuild atd/jbuild istd/jbuild scripts/jbuild +GENERATED_JBUILDS += jbuild atd/jbuild base/jbuild IR/jbuild istd/jbuild scripts/jbuild SRC_BUILD_COMMON = $(GENERATED_FROM_AUTOCONF) $(GENERATED_JBUILDS) $(OCAML_SOURCES) ifeq ($(BUILD_C_ANALYZERS),yes) @@ -265,7 +265,9 @@ $(GENERATED_JBUILDS): jbuild.common jbuild: jbuild.in atd/jbuild: atd/jbuild.in +base/jbuild: base/jbuild.in deadcode/jbuild: deadcode/jbuild.in +IR/jbuild: IR/jbuild.in istd/jbuild: istd/jbuild.in scripts/jbuild: scripts/jbuild.in diff --git a/infer/src/backend/InferAnalyze.ml b/infer/src/backend/InferAnalyze.ml index 7008778f6..271e8f0ed 100644 --- a/infer/src/backend/InferAnalyze.ml +++ b/infer/src/backend/InferAnalyze.ml @@ -100,7 +100,6 @@ let register_active_checkers () = let main ~changed_files ~makefile = - BuiltinDefn.init () ; ( match Config.modified_targets with | Some file -> MergeCapture.record_modified_targets_from_file file diff --git a/infer/src/IR/Location.ml b/infer/src/base/Location.ml similarity index 100% rename from infer/src/IR/Location.ml rename to infer/src/base/Location.ml diff --git a/infer/src/IR/Location.mli b/infer/src/base/Location.mli similarity index 100% rename from infer/src/IR/Location.mli rename to infer/src/base/Location.mli diff --git a/infer/src/base/README.md b/infer/src/base/README.md new file mode 100644 index 000000000..6aadf2ac0 --- /dev/null +++ b/infer/src/base/README.md @@ -0,0 +1,2 @@ +Utility modules that are somewhat specific to infer, usually because +they depend on Config.ml. diff --git a/infer/src/base/jbuild.in b/infer/src/base/jbuild.in new file mode 100644 index 000000000..3b8375589 --- /dev/null +++ b/infer/src/base/jbuild.in @@ -0,0 +1,16 @@ +(* -*- tuareg -*- *) +(* NOTE: prepend jbuild.common to this file! *) +;; Format.sprintf + {| +(library + ((name InferBase) + (flags (%s -open Core -open InferStdlib -open IStd -open InferGenerated)) + (ocamlopt_flags (%s)) + (libraries (%s)) + (preprocess (pps (ppx_compare))) + )) +|} + (String.concat " " common_cflags) + (String.concat " " common_optflags) + (String.concat " " ("InferStdlib" :: "InferGenerated" :: common_libraries)) + |> Jbuild_plugin.V1.send diff --git a/infer/src/backend/abs.ml b/infer/src/biabduction/Abs.ml similarity index 100% rename from infer/src/backend/abs.ml rename to infer/src/biabduction/Abs.ml diff --git a/infer/src/backend/abs.mli b/infer/src/biabduction/Abs.mli similarity index 100% rename from infer/src/backend/abs.mli rename to infer/src/biabduction/Abs.mli diff --git a/infer/src/backend/absarray.ml b/infer/src/biabduction/Absarray.ml similarity index 100% rename from infer/src/backend/absarray.ml rename to infer/src/biabduction/Absarray.ml diff --git a/infer/src/backend/absarray.mli b/infer/src/biabduction/Absarray.mli similarity index 100% rename from infer/src/backend/absarray.mli rename to infer/src/biabduction/Absarray.mli diff --git a/infer/src/backend/Attribute.ml b/infer/src/biabduction/Attribute.ml similarity index 100% rename from infer/src/backend/Attribute.ml rename to infer/src/biabduction/Attribute.ml diff --git a/infer/src/backend/Attribute.mli b/infer/src/biabduction/Attribute.mli similarity index 100% rename from infer/src/backend/Attribute.mli rename to infer/src/biabduction/Attribute.mli diff --git a/infer/src/backend/buckets.ml b/infer/src/biabduction/Buckets.ml similarity index 100% rename from infer/src/backend/buckets.ml rename to infer/src/biabduction/Buckets.ml diff --git a/infer/src/backend/buckets.mli b/infer/src/biabduction/Buckets.mli similarity index 100% rename from infer/src/backend/buckets.mli rename to infer/src/biabduction/Buckets.mli diff --git a/infer/src/backend/builtin.ml b/infer/src/biabduction/Builtin.ml similarity index 100% rename from infer/src/backend/builtin.ml rename to infer/src/biabduction/Builtin.ml diff --git a/infer/src/backend/builtin.mli b/infer/src/biabduction/Builtin.mli similarity index 100% rename from infer/src/backend/builtin.mli rename to infer/src/biabduction/Builtin.mli diff --git a/infer/src/backend/BuiltinDefn.ml b/infer/src/biabduction/BuiltinDefn.ml similarity index 100% rename from infer/src/backend/BuiltinDefn.ml rename to infer/src/biabduction/BuiltinDefn.ml diff --git a/infer/src/backend/BuiltinDefn.mli b/infer/src/biabduction/BuiltinDefn.mli similarity index 100% rename from infer/src/backend/BuiltinDefn.mli rename to infer/src/biabduction/BuiltinDefn.mli diff --git a/infer/src/backend/dom.ml b/infer/src/biabduction/Dom.ml similarity index 100% rename from infer/src/backend/dom.ml rename to infer/src/biabduction/Dom.ml diff --git a/infer/src/backend/dom.mli b/infer/src/biabduction/Dom.mli similarity index 100% rename from infer/src/backend/dom.mli rename to infer/src/biabduction/Dom.mli diff --git a/infer/src/backend/joinState.ml b/infer/src/biabduction/JoinState.ml similarity index 100% rename from infer/src/backend/joinState.ml rename to infer/src/biabduction/JoinState.ml diff --git a/infer/src/backend/joinState.mli b/infer/src/biabduction/JoinState.mli similarity index 100% rename from infer/src/backend/joinState.mli rename to infer/src/biabduction/JoinState.mli diff --git a/infer/src/backend/match.ml b/infer/src/biabduction/Match.ml similarity index 100% rename from infer/src/backend/match.ml rename to infer/src/biabduction/Match.ml diff --git a/infer/src/backend/match.mli b/infer/src/biabduction/Match.mli similarity index 100% rename from infer/src/backend/match.mli rename to infer/src/biabduction/Match.mli diff --git a/infer/src/backend/paths.ml b/infer/src/biabduction/Paths.ml similarity index 100% rename from infer/src/backend/paths.ml rename to infer/src/biabduction/Paths.ml diff --git a/infer/src/backend/paths.mli b/infer/src/biabduction/Paths.mli similarity index 100% rename from infer/src/backend/paths.mli rename to infer/src/biabduction/Paths.mli diff --git a/infer/src/backend/prop.ml b/infer/src/biabduction/Prop.ml similarity index 100% rename from infer/src/backend/prop.ml rename to infer/src/biabduction/Prop.ml diff --git a/infer/src/backend/prop.mli b/infer/src/biabduction/Prop.mli similarity index 100% rename from infer/src/backend/prop.mli rename to infer/src/biabduction/Prop.mli diff --git a/infer/src/backend/PropUtil.ml b/infer/src/biabduction/PropUtil.ml similarity index 100% rename from infer/src/backend/PropUtil.ml rename to infer/src/biabduction/PropUtil.ml diff --git a/infer/src/backend/PropUtil.mli b/infer/src/biabduction/PropUtil.mli similarity index 100% rename from infer/src/backend/PropUtil.mli rename to infer/src/biabduction/PropUtil.mli diff --git a/infer/src/backend/propgraph.ml b/infer/src/biabduction/Propgraph.ml similarity index 100% rename from infer/src/backend/propgraph.ml rename to infer/src/biabduction/Propgraph.ml diff --git a/infer/src/backend/propgraph.mli b/infer/src/biabduction/Propgraph.mli similarity index 100% rename from infer/src/backend/propgraph.mli rename to infer/src/biabduction/Propgraph.mli diff --git a/infer/src/backend/propset.ml b/infer/src/biabduction/Propset.ml similarity index 100% rename from infer/src/backend/propset.ml rename to infer/src/biabduction/Propset.ml diff --git a/infer/src/backend/propset.mli b/infer/src/biabduction/Propset.mli similarity index 100% rename from infer/src/backend/propset.mli rename to infer/src/biabduction/Propset.mli diff --git a/infer/src/backend/prover.ml b/infer/src/biabduction/Prover.ml similarity index 100% rename from infer/src/backend/prover.ml rename to infer/src/biabduction/Prover.ml diff --git a/infer/src/backend/prover.mli b/infer/src/biabduction/Prover.mli similarity index 100% rename from infer/src/backend/prover.mli rename to infer/src/biabduction/Prover.mli diff --git a/infer/src/backend/rearrange.ml b/infer/src/biabduction/Rearrange.ml similarity index 100% rename from infer/src/backend/rearrange.ml rename to infer/src/biabduction/Rearrange.ml diff --git a/infer/src/backend/rearrange.mli b/infer/src/biabduction/Rearrange.mli similarity index 100% rename from infer/src/backend/rearrange.mli rename to infer/src/biabduction/Rearrange.mli diff --git a/infer/src/backend/RetainCycles.ml b/infer/src/biabduction/RetainCycles.ml similarity index 100% rename from infer/src/backend/RetainCycles.ml rename to infer/src/biabduction/RetainCycles.ml diff --git a/infer/src/backend/RetainCycles.mli b/infer/src/biabduction/RetainCycles.mli similarity index 100% rename from infer/src/backend/RetainCycles.mli rename to infer/src/biabduction/RetainCycles.mli diff --git a/infer/src/backend/RetainCyclesType.ml b/infer/src/biabduction/RetainCyclesType.ml similarity index 100% rename from infer/src/backend/RetainCyclesType.ml rename to infer/src/biabduction/RetainCyclesType.ml diff --git a/infer/src/backend/RetainCyclesType.mli b/infer/src/biabduction/RetainCyclesType.mli similarity index 100% rename from infer/src/backend/RetainCyclesType.mli rename to infer/src/biabduction/RetainCyclesType.mli diff --git a/infer/src/backend/state.ml b/infer/src/biabduction/State.ml similarity index 100% rename from infer/src/backend/state.ml rename to infer/src/biabduction/State.ml diff --git a/infer/src/backend/state.mli b/infer/src/biabduction/State.mli similarity index 100% rename from infer/src/backend/state.mli rename to infer/src/biabduction/State.mli diff --git a/infer/src/backend/symExec.ml b/infer/src/biabduction/SymExec.ml similarity index 100% rename from infer/src/backend/symExec.ml rename to infer/src/biabduction/SymExec.ml diff --git a/infer/src/backend/symExec.mli b/infer/src/biabduction/SymExec.mli similarity index 100% rename from infer/src/backend/symExec.mli rename to infer/src/biabduction/SymExec.mli diff --git a/infer/src/backend/SymExecBlocks.ml b/infer/src/biabduction/SymExecBlocks.ml similarity index 100% rename from infer/src/backend/SymExecBlocks.ml rename to infer/src/biabduction/SymExecBlocks.ml diff --git a/infer/src/backend/SymExecBlocks.mli b/infer/src/biabduction/SymExecBlocks.mli similarity index 100% rename from infer/src/backend/SymExecBlocks.mli rename to infer/src/biabduction/SymExecBlocks.mli diff --git a/infer/src/backend/tabulation.ml b/infer/src/biabduction/Tabulation.ml similarity index 100% rename from infer/src/backend/tabulation.ml rename to infer/src/biabduction/Tabulation.ml diff --git a/infer/src/backend/tabulation.mli b/infer/src/biabduction/Tabulation.mli similarity index 100% rename from infer/src/backend/tabulation.mli rename to infer/src/biabduction/Tabulation.mli diff --git a/infer/src/backend/timeout.ml b/infer/src/biabduction/Timeout.ml similarity index 100% rename from infer/src/backend/timeout.ml rename to infer/src/biabduction/Timeout.ml diff --git a/infer/src/backend/timeout.mli b/infer/src/biabduction/Timeout.mli similarity index 100% rename from infer/src/backend/timeout.mli rename to infer/src/biabduction/Timeout.mli diff --git a/infer/src/backend/interproc.ml b/infer/src/biabduction/interproc.ml similarity index 99% rename from infer/src/backend/interproc.ml rename to infer/src/biabduction/interproc.ml index 8d06c90b6..88ed67d21 100644 --- a/infer/src/backend/interproc.ml +++ b/infer/src/biabduction/interproc.ml @@ -1199,6 +1199,8 @@ let analyze_procedure_aux exe_env tenv proc_desc = let analyze_procedure {Callbacks.summary; proc_desc; tenv; exe_env} : Specs.summary = + (* make sure models have been registered *) + BuiltinDefn.init () ; let proc_name = Procdesc.get_proc_name proc_desc in Specs.add_summary proc_name summary ; ( try ignore (analyze_procedure_aux exe_env tenv proc_desc) with exn -> diff --git a/infer/src/backend/interproc.mli b/infer/src/biabduction/interproc.mli similarity index 100% rename from infer/src/backend/interproc.mli rename to infer/src/biabduction/interproc.mli diff --git a/infer/src/IR/IssueAuxData.ml b/infer/src/concurrency/IssueAuxData.ml similarity index 100% rename from infer/src/IR/IssueAuxData.ml rename to infer/src/concurrency/IssueAuxData.ml diff --git a/infer/src/IR/IssueAuxData.mli b/infer/src/concurrency/IssueAuxData.mli similarity index 100% rename from infer/src/IR/IssueAuxData.mli rename to infer/src/concurrency/IssueAuxData.mli diff --git a/infer/src/deadcode/Makefile b/infer/src/deadcode/Makefile index c23f87194..56ff491cb 100644 --- a/infer/src/deadcode/Makefile +++ b/infer/src/deadcode/Makefile @@ -46,7 +46,7 @@ ml_src_files_without_mli:=$(shell cd .. && for i in */*.ml */*/*.ml; do [ -f $${ depend: cd .. && \ ocamldep -native \ - -I IR -I absint -I atd -I backend -I base -I bufferoverrun -I checkers \ + -I IR -I absint -I atd -I backend -I base -I biabduction -I bufferoverrun -I checkers \ -I clang -I concurrency -I eradicate -I facebook -I integration -I istd \ -I java -I labs -I python -I quandary -I unit -I unit/clang -I deadcode \ $(ml_src_files) > deadcode/.depend @@ -105,7 +105,7 @@ $(ml_src_files_without_mli:.ml=.cmx): # root .cmx to include all the code. Any code not used in the construction of these "root .cmx" will # be considered dead. .PHONY: flatten_infer -flatten_infer: backend/infer.cmx unit/inferunit.cmx facebook/InferCreateTraceViewLinks.cmx +flatten_infer: infer.cmx unit/inferunit.cmx facebook/InferCreateTraceViewLinks.cmx $(QUIET)echo "see results in $(ALL_INFER_IN_ONE_FILE_ML)" .PHONY: detect_dead_code diff --git a/infer/src/backend/infer.ml b/infer/src/infer.ml similarity index 100% rename from infer/src/backend/infer.ml rename to infer/src/infer.ml diff --git a/infer/src/backend/infer.mli b/infer/src/infer.mli similarity index 100% rename from infer/src/backend/infer.mli rename to infer/src/infer.mli diff --git a/infer/src/istd/.merlin b/infer/src/istd/.merlin deleted file mode 100644 index e47615a55..000000000 --- a/infer/src/istd/.merlin +++ /dev/null @@ -1,20 +0,0 @@ -B _build/default/istd/.InferStdlib.objs -PKG ANSITerminal -PKG atdgen -PKG cmdliner -PKG core -PKG javalib -PKG oUnit -PKG parmap -PKG ppx_compare -PKG ptrees -PKG sawja -PKG str -PKG unix -PKG xmlm -PKG yojson -PKG zip -FLG -principal -safe-string -short-paths -strict-formats -strict-sequence -FLG -w +a-4-9-40-41-42-44-45-48-60 -FLG -open Core -S . diff --git a/infer/src/base/Escape.ml b/infer/src/istd/Escape.ml similarity index 100% rename from infer/src/base/Escape.ml rename to infer/src/istd/Escape.ml diff --git a/infer/src/base/Escape.mli b/infer/src/istd/Escape.mli similarity index 100% rename from infer/src/base/Escape.mli rename to infer/src/istd/Escape.mli diff --git a/infer/src/base/IList.ml b/infer/src/istd/IList.ml similarity index 100% rename from infer/src/base/IList.ml rename to infer/src/istd/IList.ml diff --git a/infer/src/base/IList.mli b/infer/src/istd/IList.mli similarity index 100% rename from infer/src/base/IList.mli rename to infer/src/istd/IList.mli diff --git a/infer/src/base/ISequence.ml b/infer/src/istd/ISequence.ml similarity index 100% rename from infer/src/base/ISequence.ml rename to infer/src/istd/ISequence.ml diff --git a/infer/src/base/ISequence.mli b/infer/src/istd/ISequence.mli similarity index 100% rename from infer/src/base/ISequence.mli rename to infer/src/istd/ISequence.mli diff --git a/infer/src/base/Pp.ml b/infer/src/istd/Pp.ml similarity index 99% rename from infer/src/base/Pp.ml rename to infer/src/istd/Pp.ml index a2ff12a35..36b70659f 100644 --- a/infer/src/base/Pp.ml +++ b/infer/src/istd/Pp.ml @@ -12,8 +12,6 @@ module F = Format (** Pretty Printing} *) -module CLOpt = CommandLineOption - (** Kind of simple printing: default or with full types *) type simple_kind = SIM_DEFAULT | SIM_WITH_TYP diff --git a/infer/src/base/Pp.mli b/infer/src/istd/Pp.mli similarity index 100% rename from infer/src/base/Pp.mli rename to infer/src/istd/Pp.mli diff --git a/infer/src/base/PrettyPrintable.ml b/infer/src/istd/PrettyPrintable.ml similarity index 100% rename from infer/src/base/PrettyPrintable.ml rename to infer/src/istd/PrettyPrintable.ml diff --git a/infer/src/base/PrettyPrintable.mli b/infer/src/istd/PrettyPrintable.mli similarity index 100% rename from infer/src/base/PrettyPrintable.mli rename to infer/src/istd/PrettyPrintable.mli diff --git a/infer/src/istd/README.md b/infer/src/istd/README.md new file mode 100644 index 000000000..0b0fd2b6b --- /dev/null +++ b/infer/src/istd/README.md @@ -0,0 +1,2 @@ +Utility modules not specific to infer. In particular, nothing here +should depend on Config.ml. diff --git a/infer/src/base/StatisticsToolbox.ml b/infer/src/istd/StatisticsToolbox.ml similarity index 100% rename from infer/src/base/StatisticsToolbox.ml rename to infer/src/istd/StatisticsToolbox.ml diff --git a/infer/src/base/StatisticsToolbox.mli b/infer/src/istd/StatisticsToolbox.mli similarity index 100% rename from infer/src/base/StatisticsToolbox.mli rename to infer/src/istd/StatisticsToolbox.mli diff --git a/infer/src/istd/jbuild.in b/infer/src/istd/jbuild.in index a1639a522..5a7435bb3 100644 --- a/infer/src/istd/jbuild.in +++ b/infer/src/istd/jbuild.in @@ -7,6 +7,7 @@ (flags (%s -open Core)) (ocamlopt_flags (%s)) (libraries (%s)) + (preprocess (pps (ppx_compare))) )) |} (String.concat " " common_cflags) diff --git a/infer/src/jbuild.in b/infer/src/jbuild.in index 3d06e03f5..268452803 100644 --- a/infer/src/jbuild.in +++ b/infer/src/jbuild.in @@ -10,13 +10,12 @@ let source_dirs = ; (if python && facebook then "python" else "python_stubs") ; "absint" ; "backend" - ; "base" + ; "biabduction" ; "bufferoverrun" ; "checkers" ; "concurrency" ; "eradicate" ; "integration" - ; "IR" ; "labs" ; "quandary" ; "unit" ] ) @@ -27,11 +26,21 @@ let infer_binaries = let infer_cflags = - common_cflags @ ["-open"; "InferStdlib"; "-open"; "IStd"; "-open"; "InferGenerated"] + common_cflags + @ [ "-open" + ; "Core" + ; "-open" + ; "InferStdlib" + ; "-open" + ; "IStd" + ; "-open" + ; "InferGenerated" + ; "-open" + ; "InferIR" + ; "-open" + ; "InferBase" ] -let infer_libraries = "InferStdlib" :: "InferGenerated" :: common_libraries - (** The build stanzas to be passed to jbuilder *) let stanzas = ( if clang then @@ -52,7 +61,7 @@ let stanzas = |} (String.concat " " infer_cflags) (String.concat " " common_optflags) - (String.concat " " infer_libraries) + (String.concat " " ("InferIR" :: common_libraries)) (String.concat " " infer_binaries) ; Format.sprintf {|