@ -357,7 +357,17 @@ module ReplaceCallee = struct
false
false
let get_cpp_constructor_of_make_shared tenv get_formals =
module CacheForMakeShared = struct
let results : Procname . t option Procname . Hash . t lazy_t = lazy ( Procname . Hash . create 128 )
let add pname value = Procname . Hash . replace ( Lazy . force results ) pname value
let find_opt pname = Procname . Hash . find_opt ( Lazy . force results ) pname
let clear () = if Lazy . is_val results then Procname . Hash . clear ( Lazy . force results )
end
let get_cpp_constructor_of_make_shared =
let rec strip_ttype = function
let rec strip_ttype = function
| [] ->
| [] ->
Some []
Some []
@ -366,9 +376,12 @@ module ReplaceCallee = struct
| _ ->
| _ ->
None
None
in
in
function
fun tenv get_formals pname ->
| Procname . C ( { template_args = Typ . Template { args } } as name ) when Procname . C . is_make_shared name
IOption . value_default_f ( CacheForMakeShared . find_opt pname ) ~ f : ( fun () ->
-> (
let result =
match pname with
| Procname . C ( { template_args = Typ . Template { args } } as name )
when Procname . C . is_make_shared name -> (
match strip_ttype args with
match strip_ttype args with
| Some ( class_typ_templ :: param_typs_templ ) ->
| Some ( class_typ_templ :: param_typs_templ ) ->
let open Option . Let_syntax in
let open Option . Let_syntax in
@ -380,6 +393,9 @@ module ReplaceCallee = struct
None )
None )
| _ ->
| _ ->
None
None
in
CacheForMakeShared . add pname result ;
result )
let replace_make_shared tenv get_formals pname params =
let replace_make_shared tenv get_formals pname params =
@ -393,3 +409,5 @@ module ReplaceCallee = struct
| None ->
| None ->
{ pname ; params ; is_params_ref = false }
{ pname ; params ; is_params_ref = false }
end
end
let clear_cache () = ReplaceCallee . CacheForMakeShared . clear ()