From a21644685f89ba19a043e16629af1a8ae22584ac Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 27 Mar 2018 03:50:10 -0700 Subject: [PATCH] [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 --- .gitignore | 1 + infer/src/absint/Scheduler.ml | 30 +++++++++----------- infer/src/atd/.merlin | 12 -------- infer/src/jbuild-workspace.in | 14 +-------- infer/src/jbuild.in | 1 + infer/src/{ => llvm}/.merlin | 53 +++++++++++++++++------------------ infer/src/scripts/.merlin | 6 ---- 7 files changed, 42 insertions(+), 75 deletions(-) delete mode 100644 infer/src/atd/.merlin rename infer/src/{ => llvm}/.merlin (68%) delete mode 100644 infer/src/scripts/.merlin diff --git a/.gitignore b/.gitignore index 1b4638a24..f1484e4f8 100644 --- a/.gitignore +++ b/.gitignore @@ -160,6 +160,7 @@ infer/src/.project /infer/src/istd/jbuild /infer/src/scripts/jbuild /infer/src/jbuild-workspace +.merlin # generated when looking for dead code /infer/src/deadcode/.depend diff --git a/infer/src/absint/Scheduler.ml b/infer/src/absint/Scheduler.ml index 8bc09cef2..224a40b8a 100644 --- a/infer/src/absint/Scheduler.ml +++ b/infer/src/absint/Scheduler.ml @@ -16,14 +16,12 @@ module type S = sig type t - (* schedule the successors of [node] *) - val schedule_succs : t -> CFG.node -> t - - (* remove and return the node with the highest priority, the ids of its visited - predecessors, and the new schedule *) + (** schedule the successors of [node] *) 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 end @@ -32,8 +30,8 @@ module type Make = functor (CFG : ProcCfg.S) -> sig include S with module CFG = CFG end -(* 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). *) +(** 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). *) module ReversePostorder (CFG : ProcCfg.S) = struct module CFG = CFG module M = ProcCfg.NodeIdMap (CFG) @@ -42,12 +40,10 @@ module ReversePostorder (CFG : ProcCfg.S) = struct module IdSet = ProcCfg.NodeIdSet (CFG) type t = - { node: CFG.node - ; (* node whose instructions will be analyzed *) - visited_preds: IdSet.t - ; (* predecessors of [node] we have already visited in current iter *) - priority: int - (* |preds| - |visited preds|. *) } + { node: CFG.node (** node whose instructions will be analyzed *) + ; visited_preds: IdSet.t + (** predecessors of [node] we have already visited in current iter *) + ; priority: int (** |preds| - |visited preds|. *) } let node t = t.node @@ -65,7 +61,7 @@ module ReversePostorder (CFG : ProcCfg.S) = struct {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 visited_preds' = IdSet.add node_id t.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} - (* schedule the succs of [node] for analysis *) + (** schedule the succs of [node] for analysis *) let schedule_succs t node = let node_id = CFG.id node in (* 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} - (* 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 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 = try let init_id, init_work = M.min_binding t.worklist in diff --git a/infer/src/atd/.merlin b/infer/src/atd/.merlin deleted file mode 100644 index a3beae63b..000000000 --- a/infer/src/atd/.merlin +++ /dev/null @@ -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 . diff --git a/infer/src/jbuild-workspace.in b/infer/src/jbuild-workspace.in index 82a57a6de..5d93cb1be 100644 --- a/infer/src/jbuild-workspace.in +++ b/infer/src/jbuild-workspace.in @@ -1,15 +1,3 @@ -;; Do not let jbuilder generate .merlin files because it gets it -;; 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 default) (merlin))) (context ((switch @OPAMSWITCH@) (name opt))) (context ((switch @OPAMSWITCH@) (name test))) diff --git a/infer/src/jbuild.in b/infer/src/jbuild.in index 268452803..85a09e7cb 100644 --- a/infer/src/jbuild.in +++ b/infer/src/jbuild.in @@ -86,6 +86,7 @@ let stanzas = (ocamlopt_flags (%s)) (libraries (utop InferModules)) (modules (Infertop)) + (preprocess (pps (ppx_compare ppx_sexp_conv -no-check))) (link_flags (-linkall -warn-error -31)))) |} (String.concat " " infer_cflags) diff --git a/infer/src/.merlin b/infer/src/llvm/.merlin similarity index 68% rename from infer/src/.merlin rename to infer/src/llvm/.merlin index 2e2a0a7bc..d7f5a51c9 100644 --- a/infer/src/.merlin +++ b/infer/src/llvm/.merlin @@ -1,10 +1,10 @@ -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 +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 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 javalib PKG lambda-term -PKG llair PKG lwt PKG lwt.log PKG lwt.react @@ -73,22 +72,22 @@ PKG yojson PKG zed PKG zip S . -S IR -S absint -S atd -S backend -S base -S bufferoverrun -S checkers -S clang -S concurrency -S eradicate -S facebook -S integration -S istd -S java -S labs -S python -S quandary -S unit -S unit/clang +S ../IR +S ../absint +S ../atd +S ../backend +S ../base +S ../bufferoverrun +S ../checkers +S ../clang +S ../concurrency +S ../eradicate +S ../facebook +S ../integration +S ../istd +S ../java +S ../labs +S ../python +S ../quandary +S ../unit +S ../unit/clang diff --git a/infer/src/scripts/.merlin b/infer/src/scripts/.merlin deleted file mode 100644 index 66ad25f01..000000000 --- a/infer/src/scripts/.merlin +++ /dev/null @@ -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 .