[pulse] refactor an ISL function

Summary:
The returned options were never used or only used in cases when they can
only be `None`, as far as I can tell.

Reviewed By: da319

Differential Revision: D28536428

fbshipit-source-id: c16ed4698
master
Jules Villard 4 years ago committed by Facebook GitHub Bot
parent 427937083b
commit c59765b95c

@ -353,12 +353,12 @@ module AddressAttributes = struct
let check_valid_isl access_trace addr ?(null_noop = false) astate = let check_valid_isl access_trace addr ?(null_noop = false) astate =
L.d_printfln "*****check_valid_isl: addr*** %a@\n" AbstractValue.pp addr ; L.d_printfln "*****check_valid_isl: addr*** %a@\n" AbstractValue.pp addr ;
match BaseAddressAttributes.get_invalid addr (astate.post :> BaseDomain.t).attrs with match BaseAddressAttributes.get_invalid addr (astate.post :> BaseDomain.t).attrs with
| None -> ( | None ->
match if
BaseAddressAttributes.get_must_be_valid_or_allocated_isl addr BaseAddressAttributes.is_must_be_valid_or_allocated_isl addr
(astate.post :> BaseDomain.t).attrs (astate.post :> BaseDomain.t).attrs
with then [Ok astate]
| None, reason -> else
let null_astates = let null_astates =
if PathCondition.is_known_not_equal_zero astate.path_condition addr then [] if PathCondition.is_known_not_equal_zero astate.path_condition addr then []
else else
@ -374,7 +374,7 @@ module AddressAttributes = struct
else else
let valid_astate = let valid_astate =
let abdalloc = Attribute.ISLAbduced access_trace in let abdalloc = Attribute.ISLAbduced access_trace in
let valid_attr = Attribute.MustBeValid (access_trace, reason) in let valid_attr = Attribute.MustBeValid (access_trace, None) in
add_one addr abdalloc astate |> abduce_attribute addr valid_attr add_one addr abdalloc astate |> abduce_attribute addr valid_attr
|> abduce_attribute addr abdalloc |> abduce_attribute addr abdalloc
in in
@ -386,8 +386,6 @@ module AddressAttributes = struct
[Ok valid_astate; Error (`ISLError invalid_free)] [Ok valid_astate; Error (`ISLError invalid_free)]
in in
not_null_astates @ null_astates not_null_astates @ null_astates
| Some _, _ ->
[Ok astate] )
| Some (invalidation, invalidation_trace) -> | Some (invalidation, invalidation_trace) ->
[Error (`InvalidAccess (invalidation, invalidation_trace, astate))] [Error (`InvalidAccess (invalidation, invalidation_trace, astate))]
end end

@ -136,16 +136,10 @@ let get_invalid = get_attribute Attributes.get_invalid
let get_must_be_valid = get_attribute Attributes.get_must_be_valid let get_must_be_valid = get_attribute Attributes.get_must_be_valid
let get_must_be_valid_or_allocated_isl address attrs = let is_must_be_valid_or_allocated_isl address attrs =
match get_must_be_valid address attrs with Option.is_some (get_must_be_valid address attrs)
| Some (trace, reason) -> || Option.is_some (get_attribute Attributes.get_allocation address attrs)
(Some trace, reason) || Option.is_some (get_attribute Attributes.get_isl_abduced address attrs)
| None -> (
match get_attribute Attributes.get_allocation address attrs with
| Some (_, trace) ->
(Some trace, None)
| None ->
(get_attribute Attributes.get_isl_abduced address attrs, None) )
let get_must_be_initialized = get_attribute Attributes.get_must_be_initialized let get_must_be_initialized = get_attribute Attributes.get_must_be_initialized

@ -42,8 +42,7 @@ val get_invalid : AbstractValue.t -> t -> (Invalidation.t * Trace.t) option
val get_must_be_valid : val get_must_be_valid :
AbstractValue.t -> t -> (Trace.t * Invalidation.must_be_valid_reason option) option AbstractValue.t -> t -> (Trace.t * Invalidation.must_be_valid_reason option) option
val get_must_be_valid_or_allocated_isl : val is_must_be_valid_or_allocated_isl : AbstractValue.t -> t -> bool
AbstractValue.t -> t -> Trace.t option * Invalidation.must_be_valid_reason option
val get_must_be_initialized : AbstractValue.t -> t -> Trace.t option val get_must_be_initialized : AbstractValue.t -> t -> Trace.t option

Loading…
Cancel
Save