From 84f7732b21c60754489d7cdab941fdc09776eead Mon Sep 17 00:00:00 2001 From: Jeremy Dubreil Date: Fri, 8 Sep 2017 13:04:56 -0700 Subject: [PATCH] [infer][java] fix inconsistent treatment of the --skip-implementation option Summary: The code was previously inconsistent as passing the option was using an empty list of instructions to translate the code but still using the original JBIR representation to connect the nodes. Reviewed By: sblackshear Differential Revision: D5795903 fbshipit-source-id: 88c0e64 --- infer/src/java/jFrontend.ml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/infer/src/java/jFrontend.ml b/infer/src/java/jFrontend.ml index 8926afe63..38e75653d 100644 --- a/infer/src/java/jFrontend.ml +++ b/infer/src/java/jFrontend.ml @@ -104,10 +104,13 @@ let add_cmethod source_file program linereader icfg cm proc_name = | None -> L.(die InternalError) "No exn node found for %s" (Typ.Procname.to_string proc_name) in - let instrs = if skip_implementation then Array.of_list [] else JBir.code jbir_code in - let context = JContext.create_context icfg procdesc jbir_code cn source_file program in - let method_body_nodes = Array.mapi ~f:(JTrans.instruction context) instrs in - add_edges context start_node exn_node [exit_node] method_body_nodes jbir_code false + if skip_implementation then + Procdesc.node_set_succs_exn procdesc start_node [exit_node] [exn_node] + else + let instrs = JBir.code jbir_code in + let context = JContext.create_context icfg procdesc jbir_code cn source_file program in + let method_body_nodes = Array.mapi ~f:(JTrans.instruction context) instrs in + add_edges context start_node exn_node [exit_node] method_body_nodes jbir_code false let path_of_cached_classname cn = let root_path = Config.(results_dir ^/ classnames_dir_name) in