[dune] let dune generate .merlin files

Summary:
Looks like the remaining issues were solved. In particular, build the toplevel
with the same ppx as infer so that the ppx information makes it to .merlin.

Reviewed By: mbouaziz

Differential Revision: D7381857

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

1
.gitignore vendored

@ -160,6 +160,7 @@ infer/src/.project
/infer/src/istd/jbuild /infer/src/istd/jbuild
/infer/src/scripts/jbuild /infer/src/scripts/jbuild
/infer/src/jbuild-workspace /infer/src/jbuild-workspace
.merlin
# generated when looking for dead code # generated when looking for dead code
/infer/src/deadcode/.depend /infer/src/deadcode/.depend

@ -16,14 +16,12 @@ module type S = sig
type t type t
(* schedule the successors of [node] *)
val schedule_succs : t -> CFG.node -> t val schedule_succs : t -> CFG.node -> t
(** schedule the successors of [node] *)
(* remove and return the node with the highest priority, the ids of its visited
predecessors, and the new schedule *)
val pop : t -> (CFG.node * CFG.id list * t) option val pop : t -> (CFG.node * CFG.id list * t) option
(** remove and return the node with the highest priority, the ids of its visited
predecessors, and the new schedule *)
val empty : CFG.t -> t val empty : CFG.t -> t
end end
@ -32,8 +30,8 @@ module type Make = functor (CFG : ProcCfg.S) -> sig
include S with module CFG = CFG include S with module CFG = CFG
end end
(* simple scheduler that visits CFG nodes in reverse postorder. fast/precise for straightline code (** simple scheduler that visits CFG nodes in reverse postorder. fast/precise for straightline code
and conditionals; not as good for loops (may visit nodes after a loop multiple times). *) and conditionals; not as good for loops (may visit nodes after a loop multiple times). *)
module ReversePostorder (CFG : ProcCfg.S) = struct module ReversePostorder (CFG : ProcCfg.S) = struct
module CFG = CFG module CFG = CFG
module M = ProcCfg.NodeIdMap (CFG) module M = ProcCfg.NodeIdMap (CFG)
@ -42,12 +40,10 @@ module ReversePostorder (CFG : ProcCfg.S) = struct
module IdSet = ProcCfg.NodeIdSet (CFG) module IdSet = ProcCfg.NodeIdSet (CFG)
type t = type t =
{ node: CFG.node { node: CFG.node (** node whose instructions will be analyzed *)
; (* node whose instructions will be analyzed *) ; visited_preds: IdSet.t
visited_preds: IdSet.t (** predecessors of [node] we have already visited in current iter *)
; (* predecessors of [node] we have already visited in current iter *) ; priority: int (** |preds| - |visited preds|. *) }
priority: int
(* |preds| - |visited preds|. *) }
let node t = t.node let node t = t.node
@ -65,7 +61,7 @@ module ReversePostorder (CFG : ProcCfg.S) = struct
{node; visited_preds; priority} {node; visited_preds; priority}
(* add [node_id] to the visited preds for [t] *) (** add [node_id] to the visited preds for [t] *)
let add_visited_pred cfg t node_id = let add_visited_pred cfg t node_id =
let visited_preds' = IdSet.add node_id t.visited_preds in let visited_preds' = IdSet.add node_id t.visited_preds in
let priority' = compute_priority cfg t.node visited_preds' in let priority' = compute_priority cfg t.node visited_preds' in
@ -74,7 +70,7 @@ module ReversePostorder (CFG : ProcCfg.S) = struct
type t = {worklist: WorkUnit.t M.t; cfg: CFG.t} type t = {worklist: WorkUnit.t M.t; cfg: CFG.t}
(* schedule the succs of [node] for analysis *) (** schedule the succs of [node] for analysis *)
let schedule_succs t node = let schedule_succs t node =
let node_id = CFG.id node in let node_id = CFG.id node in
(* mark [node] as a visited pred of [node_to_schedule] and schedule it *) (* mark [node] as a visited pred of [node_to_schedule] and schedule it *)
@ -91,10 +87,10 @@ module ReversePostorder (CFG : ProcCfg.S) = struct
{t with worklist= new_worklist} {t with worklist= new_worklist}
(* remove and return the node with the highest priority (note that smaller integers have higher
priority), the ids of its visited predecessors, and new schedule *)
(* TODO: could do this slightly more efficiently by keeping a list of priority zero nodes for (* TODO: could do this slightly more efficiently by keeping a list of priority zero nodes for
quick popping, and do a linear search only when this list is empty *) quick popping, and do a linear search only when this list is empty *)
(** remove and return the node with the highest priority (note that smaller integers have higher
priority), the ids of its visited predecessors, and new schedule *)
let pop t = let pop t =
try try
let init_id, init_work = M.min_binding t.worklist in let init_id, init_work = M.min_binding t.worklist in

@ -1,12 +0,0 @@
B ../_build/default/atd/.InferGenerated.objs
FLG -open InferGenerated -g -short-paths -safe-string -principal -strict-formats -strict-sequence -bin-annot -w +3+5+6+8+10+11+12+18+19+20+21+23+26+29+27+32+33+34+35+37+38+39+50+52+57-4-9-40-41-42-45-48 -w -27-32-34-35-39
PKG atd
PKG atdgen
PKG biniou
PKG core
PKG easy-format
PKG ppx_compare
PKG str
PKG unix
PKG yojson
S .

@ -1,15 +1,3 @@
;; Do not let jbuilder generate .merlin files because it gets it (context ((switch @OPAMSWITCH@) (name default) (merlin)))
;; wrong. This is mainly due to the fact that source files live in
;; sub-directories and are copied into _build/ by our jbuild. jbuilder
;; wants to write "S ." in .merlin but that makes merlin use the
;; copied source files in _build/ instead of only using the original
;; files.
;;
;; The generated .merlin also doesn't know about the ppx used. This is
;; because some of our source files use some ppx and others do not, and
;; since jbuilder is trying to find a configuration that works for all the
;; files it only keeps the pxx common to all files.
(context ((switch @OPAMSWITCH@) (name default)))
(context ((switch @OPAMSWITCH@) (name opt))) (context ((switch @OPAMSWITCH@) (name opt)))
(context ((switch @OPAMSWITCH@) (name test))) (context ((switch @OPAMSWITCH@) (name test)))

@ -86,6 +86,7 @@ let stanzas =
(ocamlopt_flags (%s)) (ocamlopt_flags (%s))
(libraries (utop InferModules)) (libraries (utop InferModules))
(modules (Infertop)) (modules (Infertop))
(preprocess (pps (ppx_compare ppx_sexp_conv -no-check)))
(link_flags (-linkall -warn-error -31)))) (link_flags (-linkall -warn-error -31))))
|} |}
(String.concat " " infer_cflags) (String.concat " " infer_cflags)

@ -1,10 +1,10 @@
B _build/default/.InferModules.objs 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/base/.InferBase.objs
B _build/default/IR/.InferIR.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 Core -open InferStdlib -open InferGenerated -open InferModules -open IStd -open InferBase -open InferIR FLG -open Core -open InferStdlib -open InferGenerated -open InferModules -open IStd -open InferBase -open InferIR
@ -38,7 +38,6 @@ PKG findlib.top
PKG jane-street-headers PKG jane-street-headers
PKG javalib PKG javalib
PKG lambda-term PKG lambda-term
PKG llair
PKG lwt PKG lwt
PKG lwt.log PKG lwt.log
PKG lwt.react PKG lwt.react
@ -73,22 +72,22 @@ PKG yojson
PKG zed PKG zed
PKG zip PKG zip
S . S .
S IR S ../IR
S absint S ../absint
S atd S ../atd
S backend S ../backend
S base S ../base
S bufferoverrun S ../bufferoverrun
S checkers S ../checkers
S clang S ../clang
S concurrency S ../concurrency
S eradicate S ../eradicate
S facebook S ../facebook
S integration S ../integration
S istd S ../istd
S java S ../java
S labs S ../labs
S python S ../python
S quandary S ../quandary
S unit S ../unit
S unit/clang S ../unit/clang

@ -1,6 +0,0 @@
B ../_build/default/scripts
PKG core
PKG str
FLG -principal -safe-string -short-paths -strict-formats -strict-sequence
FLG -w +a-4-9-40-41-42-44-45-48-60
S .
Loading…
Cancel
Save