diff --git a/infer/src/absint/PatternMatch.ml b/infer/src/absint/PatternMatch.ml index f895a82c3..485291c84 100644 --- a/infer/src/absint/PatternMatch.ml +++ b/infer/src/absint/PatternMatch.ml @@ -341,22 +341,6 @@ module ObjectiveC = struct String.is_prefix ~prefix:"CG" procname && String.is_suffix ~suffix:"Release" procname - let is_modelled_as_alloc _ procname = - match Config.pulse_model_alloc_pattern with - | Some regex -> - Str.string_match regex procname 0 - | None -> - false - - - let is_modelled_as_release _ procname = - match Config.pulse_model_release_pattern with - | Some regex -> - Str.string_match regex procname 0 - | None -> - false - - let implements_ns_string_variants tenv procname = implements "NSString" tenv procname || implements "NSAttributedString" tenv procname end diff --git a/infer/src/absint/PatternMatch.mli b/infer/src/absint/PatternMatch.mli index 60d233159..5ca2c788b 100644 --- a/infer/src/absint/PatternMatch.mli +++ b/infer/src/absint/PatternMatch.mli @@ -215,10 +215,6 @@ module ObjectiveC : sig val is_core_foundation_create_or_copy : Tenv.t -> string -> bool val is_core_graphics_release : Tenv.t -> string -> bool - - val is_modelled_as_alloc : Tenv.t -> string -> bool - - val is_modelled_as_release : Tenv.t -> string -> bool end val is_entry_point : Procname.t -> bool diff --git a/infer/src/pulse/PulseModels.ml b/infer/src/pulse/PulseModels.ml index b7cb27f2d..824a18812 100644 --- a/infer/src/pulse/PulseModels.ml +++ b/infer/src/pulse/PulseModels.ml @@ -1718,12 +1718,11 @@ module ProcNameDispatcher = struct ; +map_context_tenv PatternMatch.ObjectiveC.is_core_foundation_create_or_copy &--> C.malloc_no_param ; +BuiltinDecl.(match_builtin malloc_no_fail) <>$ capt_exp $--> C.malloc_not_null - ; +map_context_tenv PatternMatch.ObjectiveC.is_modelled_as_alloc - &--> C.malloc_not_null_no_param + ; +match_regexp_opt Config.pulse_model_alloc_pattern &--> C.malloc_not_null_no_param ; +map_context_tenv PatternMatch.ObjectiveC.is_core_graphics_release <>$ capt_arg_payload $--> ObjCCoreFoundation.cf_bridging_release ; -"CFRelease" <>$ capt_arg_payload $--> ObjCCoreFoundation.cf_bridging_release - ; +map_context_tenv PatternMatch.ObjectiveC.is_modelled_as_release + ; +match_regexp_opt Config.pulse_model_release_pattern <>$ capt_arg_payload $--> ObjCCoreFoundation.cf_bridging_release ; -"CFAutorelease" <>$ capt_arg_payload $--> ObjCCoreFoundation.cf_bridging_release ; -"CFBridgingRelease" <>$ capt_arg_payload $--> ObjCCoreFoundation.cf_bridging_release