[refactor] invert ProcAttributes -> Pvar dependency

Summary:
Just moving stuff around.

This is possibly useful for making Pvar depend on ProcAttributes for
other things, eg checking if a pvar is captured by a procedure (which
would be awkward to have in the API of ProcAttributes and not Pvar).
Overall it forced me to move a few other things around in a way that I
feel makes more sense anyway.

Reviewed By: skcho

Differential Revision: D28091497

fbshipit-source-id: 367a1f17c
master
Jules Villard 4 years ago committed by Facebook GitHub Bot
parent 9b0f1ab415
commit 49883a8332

@ -8,10 +8,14 @@
open! IStd
module F = Format
type t = {name: Mangled.t; typ: Typ.t; capture_mode: Pvar.capture_mode} [@@deriving compare]
type capture_mode = ByReference | ByValue [@@deriving compare, equal]
let string_of_capture_mode = function ByReference -> "by ref" | ByValue -> "by value"
type t = {name: Mangled.t; typ: Typ.t; capture_mode: capture_mode} [@@deriving compare]
let make ~name ~typ ~capture_mode = {name; typ; capture_mode}
let pp fmt {name; typ; capture_mode} =
F.fprintf fmt "(%a,@,%a,@,%s)" Mangled.pp name (Typ.pp_full Pp.text) typ
(Pvar.string_of_capture_mode capture_mode)
(string_of_capture_mode capture_mode)

@ -7,8 +7,12 @@
open! IStd
type t = {name: Mangled.t; typ: Typ.t; capture_mode: Pvar.capture_mode} [@@deriving compare]
type capture_mode = ByReference | ByValue [@@deriving compare, equal]
val string_of_capture_mode : capture_mode -> string
type t = {name: Mangled.t; typ: Typ.t; capture_mode: capture_mode} [@@deriving compare]
val pp : Format.formatter -> t -> unit
val make : name:Mangled.t -> typ:Typ.t -> capture_mode:Pvar.capture_mode -> t
val make : name:Mangled.t -> typ:Typ.t -> capture_mode:capture_mode -> t

@ -23,7 +23,7 @@ let pp_etlist fmt etl =
let pp_var_list fmt etl =
List.iter etl ~f:(fun {CapturedVar.name; typ; capture_mode} ->
Format.fprintf fmt " [%s]%a:%a"
(Pvar.string_of_capture_mode capture_mode)
(CapturedVar.string_of_capture_mode capture_mode)
Mangled.pp name (Typ.pp_full Pp.text) typ )

@ -18,7 +18,8 @@ type ident_ = Ident.t
let compare_ident_ x y = Ident.compare y x
type closure = {name: Procname.t; captured_vars: (t * Pvar.t * Typ.t * Pvar.capture_mode) list}
type closure =
{name: Procname.t; captured_vars: (t * Pvar.t * Typ.t * CapturedVar.capture_mode) list}
(** This records information about a [sizeof(typ)] expression.
@ -243,7 +244,7 @@ and pp_captured_var pe pp_t f (exp, var, typ, mode) =
(Pvar.pp pe) f var
| _ ->
F.fprintf f "([%s]%a %a:%a)"
(Pvar.string_of_capture_mode mode)
(CapturedVar.string_of_capture_mode mode)
(pp_ pe pp_t) exp (Pvar.pp pe) var (Typ.pp pe) typ

@ -13,7 +13,8 @@
open! IStd
module F = Format
type closure = {name: Procname.t; captured_vars: (t * Pvar.t * Typ.t * Pvar.capture_mode) list}
type closure =
{name: Procname.t; captured_vars: (t * Pvar.t * Typ.t * CapturedVar.capture_mode) list}
(** This records information about a [sizeof(typ)] expression.

@ -12,22 +12,6 @@ open! IStd
module L = Logging
module F = Format
(** Visibility modifiers. *)
type access = Default | Public | Private | Protected [@@deriving compare]
let equal_access = [%compare.equal: access]
let string_of_access = function
| Default ->
"Default"
| Public ->
"Public"
| Private ->
"Private"
| Protected ->
"Protected"
type mem_kind =
| Mmalloc (** memory allocated with malloc *)
| Mnew (** memory allocated with new *)

@ -12,13 +12,6 @@ open! IStd
(** {2 Programs and Types} *)
(** Visibility modifiers. *)
type access = Default | Public | Private | Protected [@@deriving compare]
val equal_access : access -> access -> bool
val string_of_access : access -> string
type mem_kind =
| Mmalloc (** memory allocated with malloc *)
| Mnew (** memory allocated with new *)

@ -10,6 +10,22 @@
open! IStd
module F = Format
(** Visibility modifiers. *)
type access = Default | Public | Private | Protected [@@deriving compare]
let equal_access = [%compare.equal: access]
let string_of_access = function
| Default ->
"Default"
| Public ->
"Public"
| Private ->
"Private"
| Protected ->
"Protected"
(** Type for ObjC accessors *)
type objc_accessor_type = Objc_getter of Struct.field | Objc_setter of Struct.field
[@@deriving compare]
@ -44,7 +60,7 @@ type specialized_with_blocks_info =
[@@deriving compare]
type t =
{ access: PredSymb.access (** visibility access *)
{ access: access (** visibility access *)
; captured: CapturedVar.t list (** name and type of variables captured in blocks *)
; exceptions: string list (** exceptions thrown by the procedure *)
; formals: (Mangled.t * Typ.t) list (** name and type of formal parameters *)
@ -104,17 +120,12 @@ let get_access attributes = attributes.access
let get_formals attributes = attributes.formals
let get_pvar_formals attributes =
let pname = attributes.proc_name in
List.map attributes.formals ~f:(fun (name, typ) -> (Pvar.mk name pname, typ))
let get_proc_name attributes = attributes.proc_name
let get_loc attributes = attributes.loc
let default translation_unit proc_name =
{ access= PredSymb.Default
{ access= Default
; captured= []
; exceptions= []
; formals= []
@ -197,8 +208,8 @@ let pp f
in
F.fprintf f "@[<v>{ proc_name= %a@,; translation_unit= %a@," Procname.pp proc_name SourceFile.pp
translation_unit ;
if not (PredSymb.equal_access default.access access) then
F.fprintf f "; access= %a@," (Pp.of_string ~f:PredSymb.string_of_access) access ;
if not (equal_access default.access access) then
F.fprintf f "; access= %a@," (Pp.of_string ~f:string_of_access) access ;
if not ([%compare.equal: CapturedVar.t list] default.captured captured) then
F.fprintf f "; captured= [@[%a@]]@," pp_captured captured ;
if not ([%compare.equal: string list] default.exceptions exceptions) then

@ -9,6 +9,11 @@ open! IStd
(** Attributes of a procedure. *)
(** Visibility modifiers. *)
type access = Default | Public | Private | Protected [@@deriving compare]
val equal_access : access -> access -> bool
type objc_accessor_type = Objc_getter of Struct.field | Objc_setter of Struct.field
type var_data =
@ -26,7 +31,7 @@ type specialized_with_blocks_info =
[@@deriving compare]
type t =
{ access: PredSymb.access (** visibility access *)
{ access: access (** visibility access *)
; captured: CapturedVar.t list
(** name, type, and mode of variables captured in blocks and lambdas *)
; exceptions: string list (** exceptions thrown by the procedure *)
@ -68,7 +73,7 @@ val default : SourceFile.t -> Procname.t -> t
val pp : Format.formatter -> t -> unit
val get_access : t -> PredSymb.access
val get_access : t -> access
(** Return the visibility attribute *)
val get_formals : t -> (Mangled.t * Typ.t) list
@ -81,7 +86,4 @@ val get_loc : t -> Location.t
val get_proc_name : t -> Procname.t
val get_pvar_formals : t -> (Pvar.t * Typ.t) list
(** Return pvar and type of formal parameters *)
module SQLite : SqliteUtils.Data with type t = t

@ -513,10 +513,7 @@ let get_proc_name pdesc = pdesc.attributes.proc_name
(** Return name and type of formal parameters *)
let get_formals pdesc = pdesc.attributes.formals
let get_pvar_formals pdesc =
let proc_name = get_proc_name pdesc in
get_formals pdesc |> List.map ~f:(fun (name, typ) -> (Pvar.mk name proc_name, typ))
let get_pvar_formals pdesc = Pvar.get_pvar_formals pdesc.attributes
let get_loc pdesc = pdesc.attributes.loc
@ -786,7 +783,7 @@ let pp_captured_list fmt etl =
List.iter
~f:(fun {CapturedVar.name; typ; capture_mode} ->
Format.fprintf fmt " [%s] %a:%a"
(Pvar.string_of_capture_mode capture_mode)
(CapturedVar.string_of_capture_mode capture_mode)
Mangled.pp name (Typ.pp_full Pp.text) typ )
etl

@ -229,7 +229,7 @@ val find_map_instrs : t -> f:(Sil.instr -> 'a option) -> 'a option
val from_proc_attributes : ProcAttributes.t -> t
(** Use [Cfg.create_proc_desc] if you are adding a proc desc to a cfg *)
val get_access : t -> PredSymb.access
val get_access : t -> ProcAttributes.access
(** Return the visibility attribute *)
val get_attributes : t -> ProcAttributes.t

@ -332,6 +332,6 @@ module Set = PrettyPrintable.MakePPSet (struct
let pp = pp Pp.text
end)
type capture_mode = ByReference | ByValue [@@deriving compare, equal]
let string_of_capture_mode = function ByReference -> "by ref" | ByValue -> "by value"
let get_pvar_formals (attributes : ProcAttributes.t) =
let pname = attributes.proc_name in
List.map attributes.formals ~f:(fun (name, typ) -> (mk name pname, typ))

@ -176,6 +176,5 @@ val swap_proc_in_local_pvar : t -> Procname.t -> t
(** Sets of pvars. *)
module Set : PrettyPrintable.PPSet with type elt = t
type capture_mode = ByReference | ByValue [@@deriving compare, equal]
val string_of_capture_mode : capture_mode -> string
val get_pvar_formals : ProcAttributes.t -> (t * Typ.t) list
(** Return pvar and type of formal parameters *)

@ -357,13 +357,13 @@ let parse_method_annotation (json : Safe.t) : Annot.Method.t =
let parse_captured_var (json : Safe.t) =
let n = to_string (member "name" json) in
let t = parse_sil_type_name (member "type" json) in
CapturedVar.make ~name:(Mangled.from_string n) ~typ:t ~capture_mode:Pvar.ByValue
CapturedVar.make ~name:(Mangled.from_string n) ~typ:t ~capture_mode:ByValue
let parse_proc_attributes_var (json : Safe.t) =
let n = to_string (member "name" json) in
let t = parse_sil_type_name (member "type" json) in
(Mangled.from_string n, t, Pvar.ByValue)
(Mangled.from_string n, t, CapturedVar.ByValue)
let parse_proc_attributes_formals (json : Safe.t) =
@ -379,18 +379,18 @@ let parse_proc_attributes_locals (json : Safe.t) : ProcAttributes.var_data =
let parse_proc_attributes (json : Safe.t) =
let access =
let access : ProcAttributes.access =
match to_string (member "access" json) with
| "Default" ->
PredSymb.Default
Default
| "Public" ->
PredSymb.Public
Public
| "Private" ->
PredSymb.Private
Private
| "Protected" ->
PredSymb.Protected
Protected
| atype ->
Logging.die InternalError "Unsupported access type %s" atype
L.die InternalError "Unsupported access type %s" atype
in
let captured = parse_list parse_captured_var (member "captured" json) in
let formals = parse_list parse_proc_attributes_formals (member "formals" json) in

@ -928,7 +928,7 @@ let rec exp_sub_ids (f : subst_fun) exp =
if phys_equal e' e then exp else Exp.Exn e'
| Closure c ->
let captured_vars =
IList.map_changed ~equal:[%compare.equal: Exp.t * Pvar.t * Typ.t * Pvar.capture_mode]
IList.map_changed ~equal:[%compare.equal: Exp.t * Pvar.t * Typ.t * CapturedVar.capture_mode]
~f:(fun ((e, pvar, typ, mode) as captured) ->
let e' = exp_sub_ids f e in
if phys_equal e' e then captured else (e', pvar, typ, mode) )

@ -475,7 +475,7 @@ let compute_invariant_map :
let open IOption.Let_syntax in
let get_summary proc_name = analyze_dependency proc_name >>| snd in
let get_formals callee_pname =
AnalysisCallbacks.proc_resolve_attributes callee_pname >>| ProcAttributes.get_pvar_formals
AnalysisCallbacks.proc_resolve_attributes callee_pname >>| Pvar.get_pvar_formals
in
let integer_type_widths = Exe_env.get_integer_type_widths exe_env proc_name in
let oenv = OndemandEnv.mk proc_desc tenv integer_type_widths in

@ -458,7 +458,7 @@ let checker ({InterproceduralAnalysis.proc_desc; tenv; exe_env; analyze_dependen
analysis_summary
in
let get_formals callee_pname =
AnalysisCallbacks.proc_resolve_attributes callee_pname >>| ProcAttributes.get_pvar_formals
AnalysisCallbacks.proc_resolve_attributes callee_pname >>| Pvar.get_pvar_formals
in
compute_checks get_checks_summary get_summary get_formals proc_name tenv integer_type_widths
cfg inv_map

@ -194,16 +194,16 @@ let create_local_procdesc ?(set_objc_accessor_attr = false) ?(record_lambda_capt
let defined = not (List.is_empty fbody) in
let proc_name = ms.CMethodSignature.name in
let clang_method_kind = ms.CMethodSignature.method_kind in
let access =
let access : ProcAttributes.access =
match ms.CMethodSignature.access with
| `None ->
PredSymb.Default
Default
| `Private ->
PredSymb.Private
Private
| `Protected ->
PredSymb.Protected
Protected
| `Public ->
PredSymb.Protected
Protected
in
let captured_mangled =
List.map

@ -33,7 +33,7 @@ val create_local_procdesc :
-> Tenv.t
-> CMethodSignature.t
-> Clang_ast_t.stmt list
-> (Pvar.t * Typ.t * Pvar.capture_mode) list
-> (Pvar.t * Typ.t * CapturedVar.capture_mode) list
-> bool
val create_external_procdesc :
@ -57,7 +57,7 @@ val method_signature_of_pointer : Tenv.t -> Clang_ast_t.pointer -> CMethodSignat
val get_method_name_from_clang : Tenv.t -> CMethodSignature.t option -> Procname.t option
val create_procdesc_with_pointer :
?captured_vars:(Pvar.t * Typ.t * Pvar.capture_mode) list
?captured_vars:(Pvar.t * Typ.t * CapturedVar.capture_mode) list
-> CContext.t
-> Clang_ast_t.pointer
-> Typ.Name.t option
@ -65,6 +65,6 @@ val create_procdesc_with_pointer :
-> Procname.t
val get_procname_from_cpp_lambda :
CContext.t -> Clang_ast_t.decl -> (Pvar.t * Typ.t * Pvar.capture_mode) list -> Procname.t
CContext.t -> Clang_ast_t.decl -> (Pvar.t * Typ.t * CapturedVar.capture_mode) list -> Procname.t
val get_captures_from_cpp_lambda : Clang_ast_t.decl -> Clang_ast_t.lambda_capture_info list

@ -8,7 +8,7 @@
open! IStd
type block_data =
{ captured_vars: (Pvar.t * Typ.t * Pvar.capture_mode) list
{ captured_vars: (Pvar.t * Typ.t * CapturedVar.capture_mode) list
; context: CContext.t
; passed_as_noescape_block_to: Procname.t option
; procname: Procname.t

@ -297,10 +297,10 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
(** Given a captured var, return the instruction to assign it to a temp *)
let assign_captured_var loc (cvar, typ, mode) =
match mode with
| Pvar.ByReference ->
match (mode : CapturedVar.capture_mode) with
| ByReference ->
((Exp.Lvar cvar, cvar, typ, mode), None)
| Pvar.ByValue ->
| ByValue ->
let id = Ident.create_fresh Ident.knormal in
let instr = Sil.Load {id; e= Exp.Lvar cvar; root_typ= typ; typ; loc} in
((Exp.Var id, cvar, typ, mode), Some instr)
@ -3363,8 +3363,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
List.map captured_vars_no_mode ~f:(fun (var, typ, modify_in_block) ->
let mode, typ =
if modify_in_block || Pvar.is_global var then
(Pvar.ByReference, Typ.mk (Tptr (typ, Pk_reference)))
else (Pvar.ByValue, typ)
(CapturedVar.ByReference, Typ.mk (Tptr (typ, Pk_reference)))
else (CapturedVar.ByValue, typ)
in
(var, typ, mode) )
in
@ -3419,8 +3419,8 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
"Capture-init statement without var decl"
in
let translate_normal_capture mode (pvar, typ) (trans_results_acc, captured_vars_acc) =
match mode with
| Pvar.ByReference -> (
match (mode : CapturedVar.capture_mode) with
| ByReference -> (
match typ.Typ.desc with
| Tptr (_, Typ.Pk_reference) ->
let trans_result, captured_var =
@ -3435,7 +3435,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
( trans_results_acc
, (Exp.Lvar pvar, pvar, Typ.mk (Tptr (typ, Pk_reference)), mode) :: captured_vars_acc )
)
| Pvar.ByValue -> (
| ByValue -> (
let init, exp, typ_new =
match typ.Typ.desc with
(* TODO: Structs are missing copy constructor instructions when passed by value *)
@ -3479,7 +3479,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s
| `LCK_StarThis (* [*this] is special syntax for capturing current object by value *) ->
false
in
let mode = if is_by_ref then Pvar.ByReference else Pvar.ByValue in
let mode = if is_by_ref then CapturedVar.ByReference else CapturedVar.ByValue in
match (lci_captured_var, lci_init_captured_vardecl) with
| Some captured_var_decl_ref, Some init_decl -> (
(* capture and init *)

@ -361,7 +361,7 @@ let should_report_on_proc tenv procdesc =
(* return true if procedure is at an abstraction boundary or reporting has been explicitly
requested via @ThreadSafe in java *)
RacerDModels.is_thread_safe_method proc_name tenv
|| (not (PredSymb.equal_access (Procdesc.get_access procdesc) Private))
|| (not (ProcAttributes.equal_access (Procdesc.get_access procdesc) Private))
&& (not (Procname.Java.is_class_initializer java_pname))
&& (not (Procname.Java.is_autogen_method java_pname))
&& not (Annotations.pdesc_return_annot_ends_with procdesc Annotations.visibleForTesting)
@ -369,7 +369,7 @@ let should_report_on_proc tenv procdesc =
(* do not report on lambdas; they are essentially private though do not appear as such *)
false
| ObjC_Cpp {kind= CPPMethod _ | CPPConstructor _ | CPPDestructor _} ->
not (PredSymb.equal_access (Procdesc.get_access procdesc) Private)
not (ProcAttributes.equal_access (Procdesc.get_access procdesc) Private)
| ObjC_Cpp {kind= ObjCClassMethod | ObjCInstanceMethod | ObjCInternalMethod; class_name} ->
Tenv.lookup tenv class_name
|> Option.exists ~f:(fun {Struct.exported_objc_methods} ->

@ -638,7 +638,7 @@ let fold_reportable_summaries analyze_ondemand tenv clazz ~init ~f =
List.fold methods ~init ~f
let is_private attrs = PredSymb.equal_access (ProcAttributes.get_access attrs) Private
let is_private attrs = ProcAttributes.equal_access (ProcAttributes.get_access attrs) Private
(* Note about how many times we report a deadlock: normally twice, at each trace starting point.
Due to the fact we look for deadlocks in the summaries of the class at the root of a path,

@ -436,7 +436,7 @@ let checker ({InterproceduralAnalysis.proc_desc; exe_env; analyze_dependency} as
inferbo_summary
in
let get_formals callee_pname =
AnalysisCallbacks.proc_resolve_attributes callee_pname >>| ProcAttributes.get_pvar_formals
AnalysisCallbacks.proc_resolve_attributes callee_pname >>| Pvar.get_pvar_formals
in
let instr_cfg = InstrCFG.from_pdesc proc_desc in
let extras =

@ -287,15 +287,15 @@ let pp_jbir fmt jbir =
fmt (JBir.print jbir)
let trans_access = function
let trans_access : _ -> ProcAttributes.access = function
| `Default ->
PredSymb.Default
Default
| `Public ->
PredSymb.Public
Public
| `Private ->
PredSymb.Private
Private
| `Protected ->
PredSymb.Protected
Protected
let create_callee_attributes tenv program cn ms procname =

@ -18,7 +18,7 @@ let final_typestates initializers_current_class tenv typecheck_proc =
let do_proc (init_pn, init_pd) =
let filter callee_pn callee_attributes =
let is_private =
PredSymb.equal_access callee_attributes.ProcAttributes.access PredSymb.Private
ProcAttributes.equal_access callee_attributes.ProcAttributes.access Private
in
let same_class =
let get_class_opt pn =

@ -38,7 +38,7 @@ module PulseTransferFunctions = struct
type analysis_data = PulseSummary.t InterproceduralAnalysis.t
let get_pvar_formals pname =
AnalysisCallbacks.proc_resolve_attributes pname |> Option.map ~f:ProcAttributes.get_pvar_formals
AnalysisCallbacks.proc_resolve_attributes pname |> Option.map ~f:Pvar.get_pvar_formals
let interprocedural_call {InterproceduralAnalysis.analyze_dependency; tenv; proc_desc} ret

@ -97,7 +97,7 @@ module Misc = struct
in
let formals_opt =
AnalysisCallbacks.proc_resolve_attributes callee_procname
|> Option.map ~f:ProcAttributes.get_pvar_formals
|> Option.map ~f:Pvar.get_pvar_formals
in
PulseCallOperations.unknown_call tenv location (Model skip_reason) ~ret ~actuals ~formals_opt
astate

@ -105,14 +105,14 @@ module Closures = struct
let fake_capture_field_prefix = "__capture_"
let string_of_capture_mode = function
| Pvar.ByReference ->
| CapturedVar.ByReference ->
"by_ref_"
| Pvar.ByValue ->
| CapturedVar.ByValue ->
"by_value_"
let fake_captured_by_ref_field_prefix =
Printf.sprintf "%s%s" fake_capture_field_prefix (string_of_capture_mode Pvar.ByReference)
Printf.sprintf "%s%s" fake_capture_field_prefix (string_of_capture_mode ByReference)
let mk_fake_field ~id mode =

@ -204,7 +204,7 @@ val check_address_escape :
val get_captured_actuals :
Location.t
-> captured_vars:(Var.t * Pvar.capture_mode * Typ.t) list
-> captured_vars:(Var.t * CapturedVar.capture_mode * Typ.t) list
-> actual_closure:AbstractValue.t * ValueHistory.t
-> t
-> (t * (Var.t * ((AbstractValue.t * ValueHistory.t) * Typ.t)) list) AccessResult.t

@ -12,7 +12,7 @@ type event =
| Allocation of {f: CallEvent.t; location: Location.t}
| Assignment of Location.t
| Call of {f: CallEvent.t; location: Location.t; in_call: t}
| Capture of {captured_as: Pvar.t; mode: Pvar.capture_mode; location: Location.t}
| Capture of {captured_as: Pvar.t; mode: CapturedVar.capture_mode; location: Location.t}
| Conditional of {is_then_branch: bool; if_kind: Sil.if_kind; location: Location.t}
| CppTemporaryCreated of Location.t
| FormalDeclared of Pvar.t * Location.t
@ -45,7 +45,7 @@ let pp_event_no_location fmt event =
F.fprintf fmt "allocated by call to %a" CallEvent.pp f
| Capture {captured_as; mode; location= _} ->
F.fprintf fmt "value captured %s as `%a`"
(Pvar.string_of_capture_mode mode)
(CapturedVar.string_of_capture_mode mode)
Pvar.pp_value_non_verbose captured_as
| Conditional {is_then_branch; if_kind; location= _} ->
F.fprintf fmt "expression in %s condition is %b" (Sil.if_kind_to_string if_kind)

@ -12,7 +12,7 @@ type event =
| Allocation of {f: CallEvent.t; location: Location.t}
| Assignment of Location.t
| Call of {f: CallEvent.t; location: Location.t; in_call: t}
| Capture of {captured_as: Pvar.t; mode: Pvar.capture_mode; location: Location.t}
| Capture of {captured_as: Pvar.t; mode: CapturedVar.capture_mode; location: Location.t}
| Conditional of {is_then_branch: bool; if_kind: Sil.if_kind; location: Location.t}
| CppTemporaryCreated of Location.t
| FormalDeclared of Pvar.t * Location.t

@ -122,8 +122,8 @@ module SourceKind = struct
let get_tainted_formals pdesc tenv =
if PredSymb.equal_access (Procdesc.get_attributes pdesc).ProcAttributes.access PredSymb.Private
then Source.all_formals_untainted pdesc
if ProcAttributes.equal_access (Procdesc.get_access pdesc) Private then
Source.all_formals_untainted pdesc
else
let overrides_service_method pname tenv =
PatternMatch.override_exists

@ -17,7 +17,7 @@ let tests =
let fun_ptr_typ = Typ.mk (Tptr (Typ.mk Tfun, Pk_pointer)) in
let closure_exp captureds =
let mk_captured_var str =
(Exp.Var (ident_of_str str), pvar_of_str str, int_ptr_typ, Pvar.ByReference)
(Exp.Var (ident_of_str str), pvar_of_str str, int_ptr_typ, CapturedVar.ByReference)
in
let captured_vars = List.map ~f:mk_captured_var captureds in
let closure = {Exp.name= dummy_procname; captured_vars} in

@ -16,7 +16,7 @@ let tests =
let fun_ptr_typ = Typ.mk (Tptr (Typ.mk Tfun, Pk_pointer)) in
let closure_exp captured_pvars =
let mk_captured_var str =
(Exp.Var (ident_of_str str), pvar_of_str str, dummy_typ, Pvar.ByReference)
(Exp.Var (ident_of_str str), pvar_of_str str, dummy_typ, CapturedVar.ByReference)
in
let captured_vars = List.map ~f:mk_captured_var captured_pvars in
let closure = {Exp.name= dummy_procname; captured_vars} in

Loading…
Cancel
Save