base and IR build separately, biabduction/ directory

Summary:
There's actually a nice separation between IR/, base/, istd/, and the rest of
infer, so they can be made into separate jbuilder libraries so that the
separation remains. This helps make sense of the infer codebase.

Also:
- move everything biabduction-related out of backend/ and into a new
  biabduction/ directory. This clarifies the current situation where backend/
  contains a mix of analysis-independent code (still there now), and
  biabduction-specific code (moved to biabduction/).
- move everything from base/ that is not infer-specific into istd/, e.g. IList.ml
- kill unused `FbTraceCalls`
- A couple of files needed to move around to complete the separation of base/ and IR/

Reviewed By: mbouaziz

Differential Revision: D7381842

fbshipit-source-id: cd86dea
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent a2d3a0ec73
commit 6f187a954c

2
.gitignore vendored

@ -155,6 +155,8 @@ infer/src/.project
/infer/src/jbuild.common /infer/src/jbuild.common
/infer/src/jbuild /infer/src/jbuild
/infer/src/atd/jbuild /infer/src/atd/jbuild
/infer/src/base/jbuild
/infer/src/IR/jbuild
/infer/src/istd/jbuild /infer/src/istd/jbuild
/infer/src/scripts/jbuild /infer/src/scripts/jbuild
/infer/src/jbuild-workspace /infer/src/jbuild-workspace

@ -2,10 +2,12 @@ B _build/default/.InferModules.objs
B _build/default/.infer.eobjs B _build/default/.infer.eobjs
B _build/default/.infertop.eobjs B _build/default/.infertop.eobjs
B _build/default/atd/.InferGenerated.objs B _build/default/atd/.InferGenerated.objs
B _build/default/base/.InferBase.objs
B _build/default/IR/.InferIR.objs
B _build/default/istd/.InferStdlib.objs B _build/default/istd/.InferStdlib.objs
FLG -principal -safe-string -short-paths -strict-formats -strict-sequence FLG -principal -safe-string -short-paths -strict-formats -strict-sequence
FLG -w +a-4-9-40-41-42-44-45-48-60 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 ANSITerminal
PKG atd PKG atd
PKG atdgen PKG atdgen

@ -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

@ -95,7 +95,7 @@ all: infer
GENERATED_FROM_AUTOCONF = jbuild.common jbuild-workspace base/Version.ml 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) SRC_BUILD_COMMON = $(GENERATED_FROM_AUTOCONF) $(GENERATED_JBUILDS) $(OCAML_SOURCES)
ifeq ($(BUILD_C_ANALYZERS),yes) ifeq ($(BUILD_C_ANALYZERS),yes)
@ -265,7 +265,9 @@ $(GENERATED_JBUILDS): jbuild.common
jbuild: jbuild.in jbuild: jbuild.in
atd/jbuild: atd/jbuild.in atd/jbuild: atd/jbuild.in
base/jbuild: base/jbuild.in
deadcode/jbuild: deadcode/jbuild.in deadcode/jbuild: deadcode/jbuild.in
IR/jbuild: IR/jbuild.in
istd/jbuild: istd/jbuild.in istd/jbuild: istd/jbuild.in
scripts/jbuild: scripts/jbuild.in scripts/jbuild: scripts/jbuild.in

@ -100,7 +100,6 @@ let register_active_checkers () =
let main ~changed_files ~makefile = let main ~changed_files ~makefile =
BuiltinDefn.init () ;
( match Config.modified_targets with ( match Config.modified_targets with
| Some file -> | Some file ->
MergeCapture.record_modified_targets_from_file file MergeCapture.record_modified_targets_from_file file

@ -0,0 +1,2 @@
Utility modules that are somewhat specific to infer, usually because
they depend on Config.ml.

@ -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

@ -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 = 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 let proc_name = Procdesc.get_proc_name proc_desc in
Specs.add_summary proc_name summary ; Specs.add_summary proc_name summary ;
( try ignore (analyze_procedure_aux exe_env tenv proc_desc) with exn -> ( try ignore (analyze_procedure_aux exe_env tenv proc_desc) with exn ->

@ -46,7 +46,7 @@ ml_src_files_without_mli:=$(shell cd .. && for i in */*.ml */*/*.ml; do [ -f $${
depend: depend:
cd .. && \ cd .. && \
ocamldep -native \ 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 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 \ -I java -I labs -I python -I quandary -I unit -I unit/clang -I deadcode \
$(ml_src_files) > deadcode/.depend $(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 # root .cmx to include all the code. Any code not used in the construction of these "root .cmx" will
# be considered dead. # be considered dead.
.PHONY: flatten_infer .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)" $(QUIET)echo "see results in $(ALL_INFER_IN_ONE_FILE_ML)"
.PHONY: detect_dead_code .PHONY: detect_dead_code

@ -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 .

@ -12,8 +12,6 @@ module F = Format
(** Pretty Printing} *) (** Pretty Printing} *)
module CLOpt = CommandLineOption
(** Kind of simple printing: default or with full types *) (** Kind of simple printing: default or with full types *)
type simple_kind = SIM_DEFAULT | SIM_WITH_TYP type simple_kind = SIM_DEFAULT | SIM_WITH_TYP

@ -0,0 +1,2 @@
Utility modules not specific to infer. In particular, nothing here
should depend on Config.ml.

@ -7,6 +7,7 @@
(flags (%s -open Core)) (flags (%s -open Core))
(ocamlopt_flags (%s)) (ocamlopt_flags (%s))
(libraries (%s)) (libraries (%s))
(preprocess (pps (ppx_compare)))
)) ))
|} |}
(String.concat " " common_cflags) (String.concat " " common_cflags)

@ -10,13 +10,12 @@ let source_dirs =
; (if python && facebook then "python" else "python_stubs") ; (if python && facebook then "python" else "python_stubs")
; "absint" ; "absint"
; "backend" ; "backend"
; "base" ; "biabduction"
; "bufferoverrun" ; "bufferoverrun"
; "checkers" ; "checkers"
; "concurrency" ; "concurrency"
; "eradicate" ; "eradicate"
; "integration" ; "integration"
; "IR"
; "labs" ; "labs"
; "quandary" ; "quandary"
; "unit" ] ) ; "unit" ] )
@ -27,11 +26,21 @@ let infer_binaries =
let infer_cflags = 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 *) (** The build stanzas to be passed to jbuilder *)
let stanzas = let stanzas =
( if clang then ( if clang then
@ -52,7 +61,7 @@ let stanzas =
|} |}
(String.concat " " infer_cflags) (String.concat " " infer_cflags)
(String.concat " " common_optflags) (String.concat " " common_optflags)
(String.concat " " infer_libraries) (String.concat " " ("InferIR" :: common_libraries))
(String.concat " " infer_binaries) (String.concat " " infer_binaries)
; Format.sprintf ; Format.sprintf
{| {|

Loading…
Cancel
Save