[purity] Print warning when inferbo mem is not found

Summary:
Sometimes purity running failed because it couldn't find inferbo mem.  Let's make it print a warning
message, instead of raising an exception.

Reviewed By: ezgicicek

Differential Revision: D26367275

fbshipit-source-id: d2350e855
master
Sungkeun Cho 4 years ago committed by Facebook GitHub Bot
parent 7f6798999a
commit c5de5ee837

@ -147,14 +147,14 @@ module TransferFunctions = struct
let (node_id : InstrCFG.Node.id) = let (node_id : InstrCFG.Node.id) =
CFG.Node.underlying_node node |> InstrCFG.last_of_underlying_node |> InstrCFG.Node.id CFG.Node.underlying_node node |> InstrCFG.last_of_underlying_node |> InstrCFG.Node.id
in in
let inferbo_mem = let inferbo_mem = BufferOverrunAnalysis.extract_post node_id inferbo_invariant_map in
Option.value_exn (BufferOverrunAnalysis.extract_post node_id inferbo_invariant_map) if Option.is_none inferbo_mem then
in debug "Inferbo memory at %a was not found\n" InstrCFG.Node.pp_id node_id ;
match instr with match (instr, inferbo_mem) with
| Assign (ae, _, _) | Assign (ae, _, _), Some inferbo_mem
when is_heap_access ae || (Language.curr_language_is Clang && modified_global ae) -> when is_heap_access ae || (Language.curr_language_is Clang && modified_global ae) ->
track_modified_params inferbo_mem formals ae |> Domain.join astate track_modified_params inferbo_mem formals ae |> Domain.join astate
| Call (_, Direct called_pname, args, _, _) -> | Call (_, Direct called_pname, args, _, _), Some inferbo_mem ->
Domain.join astate Domain.join astate
( match PurityModels.ProcName.dispatch tenv called_pname with ( match PurityModels.ProcName.dispatch tenv called_pname with
| Some callee_summary -> | Some callee_summary ->
@ -167,11 +167,11 @@ module TransferFunctions = struct
| None -> | None ->
if Procname.is_constructor called_pname then Domain.pure else Domain.impure_global ) if Procname.is_constructor called_pname then Domain.pure else Domain.impure_global )
) )
| Call (_, Indirect _, _, _, _) -> | Call (_, Indirect _, _, _, _), _ ->
(* This should never happen in Java *) (* This should never happen in Java *)
debug "Unexpected indirect call %a" HilInstr.pp instr ; debug "Unexpected indirect call %a" HilInstr.pp instr ;
Top Top
| _ -> | _, _ ->
astate astate

Loading…
Cancel
Save