From 2ee4b5da18673dfe200738dcfa20a239d19c8fd3 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 15 Aug 2018 11:17:00 -0700 Subject: [PATCH] Reporting cleanup 4: clang_method_kind Summary: Before we would convert it to string in `Reporting` and pass it to `Errlog` which would use it only to 'log events'. I guess the reason is that there was a cyclic dependency between `Errlog` and `clang_method_kind` defined in `ProcAttributes`. This diff: - moves it to its own module - defers the conversion to string Reviewed By: jvillard Differential Revision: D9332819 fbshipit-source-id: 43a028b61 --- infer/src/IR/ClangMethodKind.ml | 27 ++++++++++++++++++++ infer/src/IR/ClangMethodKind.mli | 15 ++++++++++++ infer/src/IR/Errlog.ml | 11 +++++++-- infer/src/IR/Errlog.mli | 7 +++--- infer/src/IR/ProcAttributes.ml | 34 +++----------------------- infer/src/IR/ProcAttributes.mli | 15 +----------- infer/src/backend/InferPrint.ml | 2 +- infer/src/backend/reporting.ml | 4 +-- infer/src/biabduction/Prover.ml | 8 +++--- infer/src/biabduction/Rearrange.ml | 4 +-- infer/src/biabduction/SymExec.ml | 6 ++--- infer/src/biabduction/Tabulation.ml | 2 +- infer/src/checkers/NullabilityCheck.ml | 8 +++--- infer/src/clang/CMethodProperties.ml | 14 +++++------ infer/src/clang/CMethodProperties.mli | 2 +- infer/src/clang/CType_decl.ml | 10 +++----- infer/src/clang/cContext.ml | 3 +-- infer/src/clang/cFrontend_decl.ml | 2 +- infer/src/clang/cMethodSignature.ml | 2 +- infer/src/clang/cMethodSignature.mli | 6 ++--- infer/src/clang/cMethod_trans.ml | 4 +-- infer/src/clang/cMethod_trans.mli | 4 +-- infer/src/clang/cTrans.ml | 2 +- infer/src/clang/cTrans_models.ml | 2 +- infer/src/clang/cTrans_utils.ml | 2 +- 25 files changed, 101 insertions(+), 95 deletions(-) create mode 100644 infer/src/IR/ClangMethodKind.ml create mode 100644 infer/src/IR/ClangMethodKind.mli diff --git a/infer/src/IR/ClangMethodKind.ml b/infer/src/IR/ClangMethodKind.ml new file mode 100644 index 000000000..d9cb80eab --- /dev/null +++ b/infer/src/IR/ClangMethodKind.ml @@ -0,0 +1,27 @@ +(* + * Copyright (c) 2018-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +open! IStd + +type t = CPP_INSTANCE | OBJC_INSTANCE | CPP_CLASS | OBJC_CLASS | BLOCK | C_FUNCTION +[@@deriving compare] + +let equal = [%compare.equal : t] + +let to_string = function + | CPP_INSTANCE -> + "CPP_INSTANCE" + | OBJC_INSTANCE -> + "OBJC_INSTANCE" + | CPP_CLASS -> + "CPP_CLASS" + | OBJC_CLASS -> + "OBJC_CLASS" + | BLOCK -> + "BLOCK" + | C_FUNCTION -> + "C_FUNCTION" diff --git a/infer/src/IR/ClangMethodKind.mli b/infer/src/IR/ClangMethodKind.mli new file mode 100644 index 000000000..deaffe649 --- /dev/null +++ b/infer/src/IR/ClangMethodKind.mli @@ -0,0 +1,15 @@ +(* + * Copyright (c) 2018-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + *) + +open! IStd + +type t = CPP_INSTANCE | OBJC_INSTANCE | CPP_CLASS | OBJC_CLASS | BLOCK | C_FUNCTION +[@@deriving compare] + +val equal : t -> t -> bool + +val to_string : t -> string diff --git a/infer/src/IR/Errlog.ml b/infer/src/IR/Errlog.ml index e2db96354..68986444c 100644 --- a/infer/src/IR/Errlog.ml +++ b/infer/src/IR/Errlog.ml @@ -215,7 +215,6 @@ let update errlog_old errlog_new = let log_issue procname ~clang_method_kind severity err_log ~loc ~node_id_key ~session ~ltr ~linters_def_file ~doc_url ~access ~extras exn = - let lang = Typ.Procname.get_language procname in let error = Exceptions.recognize_exception exn in let severity = Option.value error.severity ~default:severity in let hide_java_loc_zero = @@ -242,10 +241,18 @@ let log_issue procname ~clang_method_kind severity err_log ~loc ~node_id_key ~se in ( if exn_developer then let issue = + let lang = Typ.Procname.get_language procname in + let clang_method_kind = + match lang with + | Language.Clang -> + Option.map ~f:ClangMethodKind.to_string clang_method_kind + | _ -> + None + in EventLogger.AnalysisIssue { bug_type= error.name.IssueType.unique_id ; bug_kind= Exceptions.severity_string severity - ; clang_method_kind= (match lang with Language.Clang -> clang_method_kind | _ -> None) + ; clang_method_kind ; exception_triggered_location= error.ocaml_pos ; lang= Language.to_explicit_string lang ; procedure_name= Typ.Procname.to_string procname diff --git a/infer/src/IR/Errlog.mli b/infer/src/IR/Errlog.mli index 1e6cab3dd..09ecbd4c5 100644 --- a/infer/src/IR/Errlog.mli +++ b/infer/src/IR/Errlog.mli @@ -93,6 +93,7 @@ val update : t -> t -> unit (** Update an old error log with a new one *) val log_issue : - Typ.Procname.t -> clang_method_kind:string option -> Exceptions.severity -> t -> loc:Location.t - -> node_id_key:node_id_key -> session:int -> ltr:loc_trace -> linters_def_file:string option - -> doc_url:string option -> access:string option -> extras:Jsonbug_t.extra option -> exn -> unit + Typ.Procname.t -> clang_method_kind:ClangMethodKind.t option -> Exceptions.severity -> t + -> loc:Location.t -> node_id_key:node_id_key -> session:int -> ltr:loc_trace + -> linters_def_file:string option -> doc_url:string option -> access:string option + -> extras:Jsonbug_t.extra option -> exn -> unit diff --git a/infer/src/IR/ProcAttributes.ml b/infer/src/IR/ProcAttributes.ml index 2f0c37dee..d2827ebce 100644 --- a/infer/src/IR/ProcAttributes.ml +++ b/infer/src/IR/ProcAttributes.ml @@ -16,32 +16,6 @@ type proc_flags = (string, string) Hashtbl.t let proc_flags_empty () : proc_flags = Hashtbl.create 1 -type clang_method_kind = - | CPP_INSTANCE - | OBJC_INSTANCE - | CPP_CLASS - | OBJC_CLASS - | BLOCK - | C_FUNCTION -[@@deriving compare] - -let equal_clang_method_kind = [%compare.equal : clang_method_kind] - -let string_of_clang_method_kind = function - | CPP_INSTANCE -> - "CPP_INSTANCE" - | OBJC_INSTANCE -> - "OBJC_INSTANCE" - | CPP_CLASS -> - "CPP_CLASS" - | OBJC_CLASS -> - "OBJC_CLASS" - | BLOCK -> - "BLOCK" - | C_FUNCTION -> - "C_FUNCTION" - - (** Type for ObjC accessors *) type objc_accessor_type = Objc_getter of Typ.Struct.field | Objc_setter of Typ.Struct.field [@@deriving compare] @@ -97,7 +71,7 @@ type t = ; is_specialized: bool (** the procedure is a clone specialized for dynamic dispatch handling *) ; is_synthetic_method: bool (** the procedure is a synthetic method *) ; is_variadic: bool (** the procedure is variadic, only supported for Clang procedures *) - ; clang_method_kind: clang_method_kind (** the kind of method the procedure is *) + ; clang_method_kind: ClangMethodKind.t (** the kind of method the procedure is *) ; loc: Location.t (** location of this procedure in the source code *) ; translation_unit: SourceFile.t (** translation unit to which the procedure belongs *) ; mutable locals: var_data list (** name, type and attributes of local variables *) @@ -127,7 +101,7 @@ let default translation_unit proc_name = ; is_specialized= false ; is_synthetic_method= false ; is_variadic= false - ; clang_method_kind= C_FUNCTION + ; clang_method_kind= ClangMethodKind.C_FUNCTION ; loc= Location.dummy ; translation_unit ; locals= [] @@ -217,9 +191,9 @@ let pp f pp_bool_default ~default:default.is_synthetic_method "is_synthetic_method" is_synthetic_method f () ; pp_bool_default ~default:default.is_variadic "is_variadic" is_variadic f () ; - if not ([%compare.equal : clang_method_kind] default.clang_method_kind clang_method_kind) then + if not (ClangMethodKind.equal default.clang_method_kind clang_method_kind) then F.fprintf f "; clang_method_kind= %a@," - (Pp.to_string ~f:string_of_clang_method_kind) + (Pp.to_string ~f:ClangMethodKind.to_string) clang_method_kind ; if not (Location.equal default.loc loc) then F.fprintf f "; loc= %a@," Location.pp loc ; if not ([%compare.equal : var_data list] default.locals locals) then diff --git a/infer/src/IR/ProcAttributes.mli b/infer/src/IR/ProcAttributes.mli index a9928da60..0354443e0 100644 --- a/infer/src/IR/ProcAttributes.mli +++ b/infer/src/IR/ProcAttributes.mli @@ -12,19 +12,6 @@ open! IStd (** flags for a procedure *) type proc_flags = (string, string) Caml.Hashtbl.t -type clang_method_kind = - | CPP_INSTANCE - | OBJC_INSTANCE - | CPP_CLASS - | OBJC_CLASS - | BLOCK - | C_FUNCTION -[@@deriving compare] - -val equal_clang_method_kind : clang_method_kind -> clang_method_kind -> bool - -val string_of_clang_method_kind : clang_method_kind -> string - type objc_accessor_type = Objc_getter of Typ.Struct.field | Objc_setter of Typ.Struct.field val kind_of_objc_accessor_type : objc_accessor_type -> string @@ -57,7 +44,7 @@ type t = ; is_specialized: bool (** the procedure is a clone specialized for dynamic dispatch handling *) ; is_synthetic_method: bool (** the procedure is a synthetic method *) ; is_variadic: bool (** the procedure is variadic, only supported for Clang procedures *) - ; clang_method_kind: clang_method_kind (** the kind of method the procedure is *) + ; clang_method_kind: ClangMethodKind.t (** the kind of method the procedure is *) ; loc: Location.t (** location of this procedure in the source code *) ; translation_unit: SourceFile.t (** source file where the procedure was captured *) ; mutable locals: var_data list (** name, type and attributes of local variables *) diff --git a/infer/src/backend/InferPrint.ml b/infer/src/backend/InferPrint.ml index 536e033cc..8ca885a25 100644 --- a/infer/src/backend/InferPrint.ml +++ b/infer/src/backend/InferPrint.ml @@ -594,7 +594,7 @@ module StatsLogs = struct match summary.payloads.biabduction with Some {preposts} -> List.length preposts | None -> 0 in let clang_method_kind = - ProcAttributes.string_of_clang_method_kind (Summary.get_attributes summary).clang_method_kind + ClangMethodKind.to_string (Summary.get_attributes summary).clang_method_kind in let proc_name = Summary.get_proc_name summary in let lang = Typ.Procname.get_language proc_name in diff --git a/infer/src/backend/reporting.ml b/infer/src/backend/reporting.ml index 8c0844a66..a55eb5f81 100644 --- a/infer/src/backend/reporting.ml +++ b/infer/src/backend/reporting.ml @@ -47,9 +47,7 @@ let log_issue_from_summary severity summary ?loc ?node_id_key ?session ?ltr ?lin if should_suppress_lint || is_java_generated_method then () (* Skip the reporting *) else let err_log = Summary.get_err_log summary in - let clang_method_kind = - Some (ProcAttributes.string_of_clang_method_kind attrs.clang_method_kind) - in + let clang_method_kind = Some attrs.clang_method_kind in let loc = match loc with None -> State.get_loc () | Some loc -> loc in let node_id_key = match node_id_key with None -> State.get_node_id_key () | Some node_id_key -> node_id_key diff --git a/infer/src/biabduction/Prover.ml b/infer/src/biabduction/Prover.ml index 453263cc2..55450afbc 100644 --- a/infer/src/biabduction/Prover.ml +++ b/infer/src/biabduction/Prover.ml @@ -1001,13 +1001,13 @@ let check_inconsistency_base tenv prop = let is_objc_instance_self pvar = Language.equal language Clang && Mangled.equal (Pvar.get_name pvar) (Mangled.from_string "self") - && ProcAttributes.equal_clang_method_kind procedure_attr.ProcAttributes.clang_method_kind - ProcAttributes.OBJC_INSTANCE + && ClangMethodKind.equal procedure_attr.ProcAttributes.clang_method_kind + ClangMethodKind.OBJC_INSTANCE in let is_cpp_this pvar = Language.equal language Clang && Pvar.is_this pvar - && ProcAttributes.equal_clang_method_kind procedure_attr.ProcAttributes.clang_method_kind - ProcAttributes.CPP_INSTANCE + && ClangMethodKind.equal procedure_attr.ProcAttributes.clang_method_kind + ClangMethodKind.CPP_INSTANCE in let do_hpred = function | Sil.Hpointsto (Exp.Lvar pv, Sil.Eexp (e, _), _) -> diff --git a/infer/src/biabduction/Rearrange.ml b/infer/src/biabduction/Rearrange.ml index 65f6a3fd4..63e24bc3c 100644 --- a/infer/src/biabduction/Rearrange.ml +++ b/infer/src/biabduction/Rearrange.ml @@ -1666,9 +1666,9 @@ let check_call_to_objc_block_error tenv pdesc prop fun_exp loc = -> ( let {ProcAttributes.clang_method_kind} = Procdesc.get_attributes pdesc in match clang_method_kind with - | ProcAttributes.OBJC_INSTANCE -> + | ClangMethodKind.OBJC_INSTANCE -> Pvar.is_self pvar - | ProcAttributes.CPP_INSTANCE -> + | ClangMethodKind.CPP_INSTANCE -> Pvar.is_this pvar | _ -> false ) diff --git a/infer/src/biabduction/SymExec.ml b/infer/src/biabduction/SymExec.ml index 64a884460..d981b1f68 100644 --- a/infer/src/biabduction/SymExec.ml +++ b/infer/src/biabduction/SymExec.ml @@ -1460,8 +1460,8 @@ let rec sym_exec exe_env tenv current_pdesc instr_ (prop_: Prop.normal Prop.t) p current_pdesc loc prop path | None, false -> let is_objc_instance_method = - ProcAttributes.equal_clang_method_kind - attrs.ProcAttributes.clang_method_kind ProcAttributes.OBJC_INSTANCE + ClangMethodKind.equal attrs.ProcAttributes.clang_method_kind + ClangMethodKind.OBJC_INSTANCE in skip_call ~is_objc_instance_method ~callee_attributes:(Some attrs) ~reason prop path resolved_pname ret_annots loc ret_id_typ ret_type @@ -1907,7 +1907,7 @@ and proc_call ?dynamic_dispatch exe_env callee_summary (* In case we call an objc instance method we add an extra spec where the receiver is null and the semantics of the call is nop *) match (!Language.curr_language, callee_attrs.ProcAttributes.clang_method_kind) with - | Language.Clang, ProcAttributes.OBJC_INSTANCE -> + | Language.Clang, ClangMethodKind.OBJC_INSTANCE -> handle_objc_instance_method_call actual_pars actual_params pre tenv (fst ret_id_typ) pdesc callee_pname loc path (Tabulation.exe_function_call ?dynamic_dispatch exe_env callee_summary) diff --git a/infer/src/biabduction/Tabulation.ml b/infer/src/biabduction/Tabulation.ml index ca678b206..6f6297e64 100644 --- a/infer/src/biabduction/Tabulation.ml +++ b/infer/src/biabduction/Tabulation.ml @@ -91,7 +91,7 @@ let log_call_trace ~caller_name ~callee_name ?callee_attributes ?reason ?dynamic match callee_attributes with | Some attributes when Language.curr_language_is Language.Clang -> let callee_clang_method_kind = - ProcAttributes.string_of_clang_method_kind attributes.ProcAttributes.clang_method_kind + ClangMethodKind.to_string attributes.ProcAttributes.clang_method_kind in let callee_source_file = get_valid_source_file attributes.ProcAttributes.loc in (Some callee_clang_method_kind, callee_source_file) diff --git a/infer/src/checkers/NullabilityCheck.ml b/infer/src/checkers/NullabilityCheck.ml index a0fb59fda..246274d45 100644 --- a/infer/src/checkers/NullabilityCheck.ml +++ b/infer/src/checkers/NullabilityCheck.ml @@ -39,16 +39,16 @@ module TransferFunctions (CFG : ProcCfg.S) = struct | _ -> Option.exists ~f:(fun attributes -> - ProcAttributes.equal_clang_method_kind attributes.ProcAttributes.clang_method_kind - ProcAttributes.CPP_INSTANCE ) + ClangMethodKind.equal attributes.ProcAttributes.clang_method_kind + ClangMethodKind.CPP_INSTANCE ) (Summary.proc_resolve_attributes callee_pname) let is_objc_instance_method callee_pname = Option.exists ~f:(fun attributes -> - ProcAttributes.equal_clang_method_kind attributes.ProcAttributes.clang_method_kind - ProcAttributes.OBJC_INSTANCE ) + ClangMethodKind.equal attributes.ProcAttributes.clang_method_kind + ClangMethodKind.OBJC_INSTANCE ) (Summary.proc_resolve_attributes callee_pname) diff --git a/infer/src/clang/CMethodProperties.ml b/infer/src/clang/CMethodProperties.ml index 2818349a4..f5ea644d0 100644 --- a/infer/src/clang/CMethodProperties.ml +++ b/infer/src/clang/CMethodProperties.ml @@ -12,18 +12,18 @@ let get_method_kind meth_decl = let open Clang_ast_t in match meth_decl with | FunctionDecl _ -> - ProcAttributes.C_FUNCTION + ClangMethodKind.C_FUNCTION | CXXMethodDecl (_, _, _, _, method_decl_info) | CXXConstructorDecl (_, _, _, _, method_decl_info) | CXXConversionDecl (_, _, _, _, method_decl_info) | CXXDestructorDecl (_, _, _, _, method_decl_info) -> - if method_decl_info.Clang_ast_t.xmdi_is_static then ProcAttributes.CPP_CLASS - else ProcAttributes.CPP_INSTANCE + if method_decl_info.Clang_ast_t.xmdi_is_static then ClangMethodKind.CPP_CLASS + else ClangMethodKind.CPP_INSTANCE | ObjCMethodDecl (_, _, method_decl_info) -> - if method_decl_info.Clang_ast_t.omdi_is_instance_method then ProcAttributes.OBJC_INSTANCE - else ProcAttributes.OBJC_CLASS + if method_decl_info.Clang_ast_t.omdi_is_instance_method then ClangMethodKind.OBJC_INSTANCE + else ClangMethodKind.OBJC_CLASS | BlockDecl _ -> - ProcAttributes.BLOCK + ClangMethodKind.BLOCK | _ -> raise CFrontend_config.Invalid_declaration @@ -32,7 +32,7 @@ let rec is_inside_objc_class_method meth_decl = let open Clang_ast_t in match meth_decl with | ObjCMethodDecl _ -> - ProcAttributes.equal_clang_method_kind (get_method_kind meth_decl) ProcAttributes.OBJC_CLASS + ClangMethodKind.equal (get_method_kind meth_decl) ClangMethodKind.OBJC_CLASS | BlockDecl (di, _) -> ( match CAst_utils.get_decl_opt di.di_parent_pointer with | Some decl -> diff --git a/infer/src/clang/CMethodProperties.mli b/infer/src/clang/CMethodProperties.mli index 70d3c28ac..43e232d12 100644 --- a/infer/src/clang/CMethodProperties.mli +++ b/infer/src/clang/CMethodProperties.mli @@ -9,7 +9,7 @@ open! IStd (** Functions for extracting properties of functions or method declarations *) -val get_method_kind : Clang_ast_t.decl -> ProcAttributes.clang_method_kind +val get_method_kind : Clang_ast_t.decl -> ClangMethodKind.t val is_inside_objc_class_method : Clang_ast_t.decl -> bool diff --git a/infer/src/clang/CType_decl.ml b/infer/src/clang/CType_decl.ml index 8695f9f5f..36e3ce65d 100644 --- a/infer/src/clang/CType_decl.ml +++ b/infer/src/clang/CType_decl.ml @@ -12,9 +12,9 @@ open! IStd module BuildMethodSignature = struct let get_class_parameter_name method_kind = match method_kind with - | ProcAttributes.CPP_INSTANCE -> + | ClangMethodKind.CPP_INSTANCE -> Some (Mangled.from_string CFrontend_config.this) - | ProcAttributes.OBJC_INSTANCE -> + | ClangMethodKind.OBJC_INSTANCE -> Some (Mangled.from_string CFrontend_config.self) | _ -> None @@ -41,7 +41,7 @@ module BuildMethodSignature = struct -> ( let method_kind = CMethodProperties.get_method_kind method_decl in match method_kind with - | ProcAttributes.CPP_INSTANCE | ProcAttributes.OBJC_INSTANCE -> ( + | ClangMethodKind.CPP_INSTANCE | ClangMethodKind.OBJC_INSTANCE -> ( match (get_class_parameter_name method_kind, decl_info.di_parent_pointer) with | Some name, Some parent_pointer -> let qual_type = CAst_utils.qual_type_of_decl_ptr parent_pointer in @@ -129,9 +129,7 @@ module BuildMethodSignature = struct let types_of_captured_vars qual_type_to_sil_type tenv meth_decl = let captured_vars = CMethodProperties.get_block_captured_variables meth_decl in let is_block = - ProcAttributes.equal_clang_method_kind - (CMethodProperties.get_method_kind meth_decl) - ProcAttributes.BLOCK + ClangMethodKind.equal (CMethodProperties.get_method_kind meth_decl) ClangMethodKind.BLOCK in let is_block_inside_objc_class_method = is_block && CMethodProperties.is_inside_objc_class_method meth_decl diff --git a/infer/src/clang/cContext.ml b/infer/src/clang/cContext.ml index 245c3ae01..3163eed8c 100644 --- a/infer/src/clang/cContext.ml +++ b/infer/src/clang/cContext.ml @@ -62,8 +62,7 @@ let rec is_objc_class_method context = is_objc_class_method outer_context | None -> let attrs = Procdesc.get_attributes context.procdesc in - ProcAttributes.equal_clang_method_kind attrs.ProcAttributes.clang_method_kind - ProcAttributes.OBJC_CLASS + ClangMethodKind.equal attrs.ProcAttributes.clang_method_kind ClangMethodKind.OBJC_CLASS let rec get_curr_class context = diff --git a/infer/src/clang/cFrontend_decl.ml b/infer/src/clang/cFrontend_decl.ml index b69a6bab0..e0209fcaa 100644 --- a/infer/src/clang/cFrontend_decl.ml +++ b/infer/src/clang/cFrontend_decl.ml @@ -416,7 +416,7 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron in let ms = CMethodSignature.mk procname None [] (Typ.void, Annot.Item.empty) [] - decl_info.Clang_ast_t.di_source_range ProcAttributes.C_FUNCTION None None None + decl_info.Clang_ast_t.di_source_range ClangMethodKind.C_FUNCTION None None None `None in let stmt_info = diff --git a/infer/src/clang/cMethodSignature.ml b/infer/src/clang/cMethodSignature.ml index 4f138216b..2525a97a5 100644 --- a/infer/src/clang/cMethodSignature.ml +++ b/infer/src/clang/cMethodSignature.ml @@ -29,7 +29,7 @@ type t = ; has_added_return_param: bool ; attributes: Clang_ast_t.attribute list ; loc: Clang_ast_t.source_range - ; method_kind: ProcAttributes.clang_method_kind + ; method_kind: ClangMethodKind.t ; is_cpp_virtual: bool ; is_cpp_nothrow: bool ; is_variadic: bool diff --git a/infer/src/clang/cMethodSignature.mli b/infer/src/clang/cMethodSignature.mli index e0fe86d68..d0d1d69f9 100644 --- a/infer/src/clang/cMethodSignature.mli +++ b/infer/src/clang/cMethodSignature.mli @@ -22,7 +22,7 @@ type t = ; has_added_return_param: bool ; attributes: Clang_ast_t.attribute list ; loc: Clang_ast_t.source_range - ; method_kind: ProcAttributes.clang_method_kind + ; method_kind: ClangMethodKind.t ; is_cpp_virtual: bool ; is_cpp_nothrow: bool ; is_variadic: bool @@ -38,8 +38,8 @@ val is_setter : t -> bool val mk : Typ.Procname.t -> param_type option -> param_type list -> Typ.t * Annot.Item.t -> ?has_added_return_param:bool -> Clang_ast_t.attribute list -> Clang_ast_t.source_range - -> ProcAttributes.clang_method_kind -> ?is_cpp_virtual:bool -> ?is_cpp_nothrow:bool - -> ?is_variadic:bool -> Clang_ast_t.pointer option -> Clang_ast_t.pointer option -> Typ.t option + -> ClangMethodKind.t -> ?is_cpp_virtual:bool -> ?is_cpp_nothrow:bool -> ?is_variadic:bool + -> Clang_ast_t.pointer option -> Clang_ast_t.pointer option -> Typ.t option -> Clang_ast_t.access_specifier -> t val pp : Format.formatter -> t -> unit diff --git a/infer/src/clang/cMethod_trans.ml b/infer/src/clang/cMethod_trans.ml index 8600293bd..9e56bda77 100644 --- a/infer/src/clang/cMethod_trans.ml +++ b/infer/src/clang/cMethod_trans.ml @@ -332,10 +332,10 @@ let create_procdesc_with_pointer context pointer class_name_opt name = match class_name_opt with | Some class_name -> ( CType_decl.CProcname.NoAstDecl.cpp_method_of_string context.tenv class_name name - , ProcAttributes.CPP_INSTANCE ) + , ClangMethodKind.CPP_INSTANCE ) | None -> ( CType_decl.CProcname.NoAstDecl.c_function_of_string context.tenv name - , ProcAttributes.C_FUNCTION ) + , ClangMethodKind.C_FUNCTION ) in create_external_procdesc context.translation_unit_context context.cfg callee_name method_kind None ; diff --git a/infer/src/clang/cMethod_trans.mli b/infer/src/clang/cMethod_trans.mli index 731a88ea9..d036fe6d0 100644 --- a/infer/src/clang/cMethod_trans.mli +++ b/infer/src/clang/cMethod_trans.mli @@ -23,8 +23,8 @@ val create_local_procdesc : -> CMethodSignature.t -> Clang_ast_t.stmt list -> (Pvar.t * Typ.t) list -> bool val create_external_procdesc : - CFrontend_config.translation_unit_context -> Cfg.t -> Typ.Procname.t - -> ProcAttributes.clang_method_kind -> (Typ.t * Typ.t list) option -> unit + CFrontend_config.translation_unit_context -> Cfg.t -> Typ.Procname.t -> ClangMethodKind.t + -> (Typ.t * Typ.t list) option -> unit val get_objc_method_data : Clang_ast_t.obj_c_message_expr_info -> string * Clang_ast_t.pointer option * method_call_type diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index d1ea4a9b5..bab90673c 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -28,7 +28,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s let is_instance = mc_type <> CMethod_trans.MCStatic in let objc_method_kind = Typ.Procname.ObjC_Cpp.objc_method_kind_of_bool is_instance in let method_kind = - if is_instance then ProcAttributes.OBJC_INSTANCE else ProcAttributes.OBJC_CLASS + if is_instance then ClangMethodKind.OBJC_INSTANCE else ClangMethodKind.OBJC_CLASS in let ms_opt = match method_pointer_opt with diff --git a/infer/src/clang/cTrans_models.ml b/infer/src/clang/cTrans_models.ml index e2ff22669..14f267109 100644 --- a/infer/src/clang/cTrans_models.ml +++ b/infer/src/clang/cTrans_models.ml @@ -75,7 +75,7 @@ let get_predefined_ms_method condition class_name method_name method_kind mk_pro let ms = CMethodSignature.mk procname None arguments return_type attributes (CAst_utils.dummy_source_range ()) - ProcAttributes.C_FUNCTION None None None `None + ClangMethodKind.C_FUNCTION None None None `None in Some ms else None diff --git a/infer/src/clang/cTrans_utils.ml b/infer/src/clang/cTrans_utils.ml index 94aaa375f..7203c3ab8 100644 --- a/infer/src/clang/cTrans_utils.ml +++ b/infer/src/clang/cTrans_utils.ml @@ -373,7 +373,7 @@ let objc_new_trans trans_state ~alloc_builtin loc stmt_info cls_name function_ty let init_ret_id = Ident.create_fresh Ident.knormal in let is_instance = true in let call_flags = {CallFlags.default with CallFlags.cf_virtual= is_instance} in - let method_kind = ProcAttributes.OBJC_INSTANCE in + let method_kind = ClangMethodKind.OBJC_INSTANCE in let pname = CType_decl.CProcname.NoAstDecl.objc_method_of_string_kind cls_name CFrontend_config.init Typ.Procname.ObjC_Cpp.ObjCInstanceMethod