Skip to content

Commit

Permalink
[hack] Rename resolve_fieldname to resolve_field_info
Browse files Browse the repository at this point in the history
Summary:
This diff renames `resolve_fieldname` to `resolve_field_info`, since
the method returns a field info, rather than a field name.

Reviewed By: nicovank

Differential Revision: D50735755

fbshipit-source-id: 9cf7d73236d83ab0a664523af53592ae38d3f61c
  • Loading branch information
skcho authored and facebook-github-bot committed Oct 27, 2023
1 parent b36792f commit 38764d4
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion infer/src/IR/Tenv.ml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ let find_map_supers (type f_result) tenv name ~(f : Typ.Name.t -> Struct.t optio
with FOUND result -> result


let resolve_fieldname tenv name fieldname =
let resolve_field_info tenv name fieldname =
let field_string = Fieldname.get_field_name fieldname in
find_map_supers tenv name ~f:(fun typ_name _ ->
let fieldname = Fieldname.make typ_name field_string in
Expand Down
6 changes: 3 additions & 3 deletions infer/src/IR/Tenv.mli
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ val resolve_method :
[method_exists adapted_procname methods] should check if [adapted_procname] ([procname] but with
its class potentially changed to some [other_class]) is among the [methods] of [other_class]. *)

val resolve_fieldname : t -> Typ.Name.t -> Fieldname.t -> Struct.field_info option
(** [resolve_fieldname tenv class_name field] tries to find the first field declaration that matches
[field] name (ignoring its enclosing declared type), starting from class [class_name] *)
val resolve_field_info : t -> Typ.Name.t -> Fieldname.t -> Struct.field_info option
(** [resolve_field_info tenv class_name field] tries to find the first field declaration that
matches [field] name (ignoring its enclosing declared type), starting from class [class_name]. *)

val find_cpp_destructor : t -> Typ.Name.t -> Procname.t option

Expand Down
4 changes: 2 additions & 2 deletions infer/src/pulse/PulseModelsDSL.ml
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ module Syntax = struct
AddressAttributes.get_const_string addr |> exec_pure_operation


let tenv_resolve_fieldname typ_name field_name : Struct.field_info option model_monad =
let tenv_resolve_field_info typ_name field_name : Struct.field_info option model_monad =
fun ({analysis_data= {tenv}} as data) astate ->
let info = Tenv.resolve_fieldname tenv typ_name field_name in
let info = Tenv.resolve_field_info tenv typ_name field_name in
ret info data astate


Expand Down
2 changes: 1 addition & 1 deletion infer/src/pulse/PulseModelsDSL.mli
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ module Syntax : sig
val and_positive : aval -> unit model_monad

(* Tenv operations *)
val tenv_resolve_fieldname : Typ.name -> Fieldname.t -> Struct.field_info option model_monad
val tenv_resolve_field_info : Typ.name -> Fieldname.t -> Struct.field_info option model_monad

val write_deref : ref:aval -> obj:aval -> unit model_monad

Expand Down
2 changes: 1 addition & 1 deletion infer/src/pulse/PulseModelsErlang.ml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ let get_module_attribute tenv ~tag =
let open IOption.Let_syntax in
let typ = Typ.ErlangType ModuleInfo in
let* field_info =
Tenv.resolve_fieldname tenv typ (Fieldname.make typ ErlangTypeName.module_info_field_name)
Tenv.resolve_field_info tenv typ (Fieldname.make typ ErlangTypeName.module_info_field_name)
in
let* annot =
List.find field_info.Struct.annotations ~f:(function ({class_name} : Annot.t) ->
Expand Down
2 changes: 1 addition & 1 deletion infer/src/pulse/PulseModelsHack.ml
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ let hack_field_get this field : model =
| Some {Typ.desc= Tstruct type_name} ->
let field = Fieldname.make type_name string_field_name in
let* aval = eval_deref_access Read this (FieldAccess field) in
let* struct_info = tenv_resolve_fieldname type_name field in
let* struct_info = tenv_resolve_field_info type_name field in
let opt_field_type_name =
let open IOption.Let_syntax in
let* {Struct.typ= field_typ} = struct_info in
Expand Down
2 changes: 1 addition & 1 deletion infer/src/pulse/PulseOperations.ml
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ let hack_python_propagates_type_on_load tenv path loc rhs_exp addr astate =
eval path NoAccess loc recv astate |> PulseOperationResult.sat_ok
in
let* typ_name = AbductiveDomain.AddressAttributes.get_static_type base_addr astate in
let* {Struct.typ= field_typ} = Tenv.resolve_fieldname tenv typ_name field_name in
let* {Struct.typ= field_typ} = Tenv.resolve_field_info tenv typ_name field_name in
let+ field_typ_name =
if Typ.is_pointer field_typ then Typ.name (Typ.strip_ptr field_typ) else None
in
Expand Down

0 comments on commit 38764d4

Please sign in to comment.