Summary: This diff finds dead modules, i.e, .ml files that is not used in the binaries. Reviewed By: ngorogiannis Differential Revision: D20035984 fbshipit-source-id: 56ac2e817master
parent
dcb3ab1288
commit
3c29685667
@ -1,26 +0,0 @@
|
|||||||
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
||||||
#
|
|
||||||
# This source code is licensed under the MIT license found in the
|
|
||||||
# LICENSE file in the root directory of this source tree.
|
|
||||||
|
|
||||||
ROOT_DIR = ../../..
|
|
||||||
include $(ROOT_DIR)/Makefile.config
|
|
||||||
|
|
||||||
INFER_BUILD_DIR = ../_build/default
|
|
||||||
|
|
||||||
default: llvm_sil
|
|
||||||
|
|
||||||
$(BIN_DIR)/llvm_sil:
|
|
||||||
rm -f $(INFER_BUILD_DIR)/llvm_sil.ml
|
|
||||||
make -C .. infer
|
|
||||||
cp llvm_sil.ml $(INFER_BUILD_DIR)
|
|
||||||
cd $(INFER_BUILD_DIR) && \
|
|
||||||
ocamlfind ocamlopt -package llair -linkpkg llvm_sil.ml -o $(BIN_DIR)/llvm_sil
|
|
||||||
rm -f $(INFER_BUILD_DIR)/llvm_sil.ml
|
|
||||||
|
|
||||||
.PHONY: llvm_sil
|
|
||||||
llvm_sil: $(BIN_DIR)/llvm_sil
|
|
||||||
|
|
||||||
.PHONY: clean
|
|
||||||
clean:
|
|
||||||
rm -f $(INFER_BUILD_DIR)/llvm_sil.ml $(BIN_DIR)/llvm_sil
|
|
@ -1,38 +0,0 @@
|
|||||||
(*
|
|
||||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
||||||
*
|
|
||||||
* This source code is licensed under the MIT license found in the
|
|
||||||
* LICENSE file in the root directory of this source tree.
|
|
||||||
*)
|
|
||||||
|
|
||||||
open Import
|
|
||||||
open Core_kernel
|
|
||||||
open Llair_
|
|
||||||
|
|
||||||
let main ~input ~output =
|
|
||||||
try
|
|
||||||
let program = Frontend.translate input in
|
|
||||||
Option.iter output ~f:(function
|
|
||||||
| "-" ->
|
|
||||||
Format.printf "%a@." Llair.fmt program
|
|
||||||
| filename ->
|
|
||||||
Out_channel.with_file filename ~f:(fun oc ->
|
|
||||||
let ff = Format.formatter_of_out_channel oc in
|
|
||||||
Format.fprintf ff "%a@." Llair.fmt program ) ) ;
|
|
||||||
Format.printf "@\nRESULT: Success@."
|
|
||||||
with exn ->
|
|
||||||
let bt = Caml.Printexc.get_raw_backtrace () in
|
|
||||||
( match exn with
|
|
||||||
| Frontend.Invalid_llvm msg ->
|
|
||||||
Format.printf "@\nRESULT: Invalid input: %s@." msg
|
|
||||||
| Unimplemented msg ->
|
|
||||||
Format.printf "@\nRESULT: Unimplemented: %s@." msg
|
|
||||||
| Failure msg ->
|
|
||||||
Format.printf "@\nRESULT: Internal error: %s@." msg
|
|
||||||
| _ ->
|
|
||||||
Format.printf "@\nRESULT: Unknown error: %s@." (Caml.Printexc.to_string exn) ) ;
|
|
||||||
Caml.Printexc.raise_with_backtrace exn bt
|
|
||||||
|
|
||||||
|
|
||||||
;;
|
|
||||||
main ~input:Caml.Sys.argv.(1) ~output:(Some "-")
|
|
Loading…
Reference in new issue