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
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent 451f8f1efa
commit 2ee4b5da18

@ -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"

@ -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

@ -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 let log_issue procname ~clang_method_kind severity err_log ~loc ~node_id_key ~session ~ltr
~linters_def_file ~doc_url ~access ~extras exn = ~linters_def_file ~doc_url ~access ~extras exn =
let lang = Typ.Procname.get_language procname in
let error = Exceptions.recognize_exception exn in let error = Exceptions.recognize_exception exn in
let severity = Option.value error.severity ~default:severity in let severity = Option.value error.severity ~default:severity in
let hide_java_loc_zero = 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 in
( if exn_developer then ( if exn_developer then
let issue = 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 EventLogger.AnalysisIssue
{ bug_type= error.name.IssueType.unique_id { bug_type= error.name.IssueType.unique_id
; bug_kind= Exceptions.severity_string severity ; 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 ; exception_triggered_location= error.ocaml_pos
; lang= Language.to_explicit_string lang ; lang= Language.to_explicit_string lang
; procedure_name= Typ.Procname.to_string procname ; procedure_name= Typ.Procname.to_string procname

@ -93,6 +93,7 @@ val update : t -> t -> unit
(** Update an old error log with a new one *) (** Update an old error log with a new one *)
val log_issue : val log_issue :
Typ.Procname.t -> clang_method_kind:string option -> Exceptions.severity -> t -> loc:Location.t Typ.Procname.t -> clang_method_kind:ClangMethodKind.t option -> Exceptions.severity -> t
-> node_id_key:node_id_key -> session:int -> ltr:loc_trace -> linters_def_file:string option -> loc:Location.t -> node_id_key:node_id_key -> session:int -> ltr:loc_trace
-> doc_url:string option -> access:string option -> extras:Jsonbug_t.extra option -> exn -> unit -> linters_def_file:string option -> doc_url:string option -> access:string option
-> extras:Jsonbug_t.extra option -> exn -> unit

@ -16,32 +16,6 @@ type proc_flags = (string, string) Hashtbl.t
let proc_flags_empty () : proc_flags = Hashtbl.create 1 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 for ObjC accessors *)
type objc_accessor_type = Objc_getter of Typ.Struct.field | Objc_setter of Typ.Struct.field type objc_accessor_type = Objc_getter of Typ.Struct.field | Objc_setter of Typ.Struct.field
[@@deriving compare] [@@deriving compare]
@ -97,7 +71,7 @@ type t =
; is_specialized: bool (** the procedure is a clone specialized for dynamic dispatch handling *) ; is_specialized: bool (** the procedure is a clone specialized for dynamic dispatch handling *)
; is_synthetic_method: bool (** the procedure is a synthetic method *) ; is_synthetic_method: bool (** the procedure is a synthetic method *)
; is_variadic: bool (** the procedure is variadic, only supported for Clang procedures *) ; 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 *) ; loc: Location.t (** location of this procedure in the source code *)
; translation_unit: SourceFile.t (** translation unit to which the procedure belongs *) ; translation_unit: SourceFile.t (** translation unit to which the procedure belongs *)
; mutable locals: var_data list (** name, type and attributes of local variables *) ; 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_specialized= false
; is_synthetic_method= false ; is_synthetic_method= false
; is_variadic= false ; is_variadic= false
; clang_method_kind= C_FUNCTION ; clang_method_kind= ClangMethodKind.C_FUNCTION
; loc= Location.dummy ; loc= Location.dummy
; translation_unit ; translation_unit
; locals= [] ; 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_synthetic_method "is_synthetic_method" is_synthetic_method f
() ; () ;
pp_bool_default ~default:default.is_variadic "is_variadic" is_variadic 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@," 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 ; clang_method_kind ;
if not (Location.equal default.loc loc) then F.fprintf f "; loc= %a@," Location.pp loc ; 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 if not ([%compare.equal : var_data list] default.locals locals) then

@ -12,19 +12,6 @@ open! IStd
(** flags for a procedure *) (** flags for a procedure *)
type proc_flags = (string, string) Caml.Hashtbl.t 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 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 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_specialized: bool (** the procedure is a clone specialized for dynamic dispatch handling *)
; is_synthetic_method: bool (** the procedure is a synthetic method *) ; is_synthetic_method: bool (** the procedure is a synthetic method *)
; is_variadic: bool (** the procedure is variadic, only supported for Clang procedures *) ; 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 *) ; loc: Location.t (** location of this procedure in the source code *)
; translation_unit: SourceFile.t (** source file where the procedure was captured *) ; translation_unit: SourceFile.t (** source file where the procedure was captured *)
; mutable locals: var_data list (** name, type and attributes of local variables *) ; mutable locals: var_data list (** name, type and attributes of local variables *)

@ -594,7 +594,7 @@ module StatsLogs = struct
match summary.payloads.biabduction with Some {preposts} -> List.length preposts | None -> 0 match summary.payloads.biabduction with Some {preposts} -> List.length preposts | None -> 0
in in
let clang_method_kind = 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 in
let proc_name = Summary.get_proc_name summary in let proc_name = Summary.get_proc_name summary in
let lang = Typ.Procname.get_language proc_name in let lang = Typ.Procname.get_language proc_name in

@ -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 *) if should_suppress_lint || is_java_generated_method then () (* Skip the reporting *)
else else
let err_log = Summary.get_err_log summary in let err_log = Summary.get_err_log summary in
let clang_method_kind = let clang_method_kind = Some attrs.clang_method_kind in
Some (ProcAttributes.string_of_clang_method_kind attrs.clang_method_kind)
in
let loc = match loc with None -> State.get_loc () | Some loc -> loc in let loc = match loc with None -> State.get_loc () | Some loc -> loc in
let node_id_key = let node_id_key =
match node_id_key with None -> State.get_node_id_key () | Some node_id_key -> node_id_key match node_id_key with None -> State.get_node_id_key () | Some node_id_key -> node_id_key

@ -1001,13 +1001,13 @@ let check_inconsistency_base tenv prop =
let is_objc_instance_self pvar = let is_objc_instance_self pvar =
Language.equal language Clang Language.equal language Clang
&& Mangled.equal (Pvar.get_name pvar) (Mangled.from_string "self") && Mangled.equal (Pvar.get_name pvar) (Mangled.from_string "self")
&& ProcAttributes.equal_clang_method_kind procedure_attr.ProcAttributes.clang_method_kind && ClangMethodKind.equal procedure_attr.ProcAttributes.clang_method_kind
ProcAttributes.OBJC_INSTANCE ClangMethodKind.OBJC_INSTANCE
in in
let is_cpp_this pvar = let is_cpp_this pvar =
Language.equal language Clang && Pvar.is_this pvar Language.equal language Clang && Pvar.is_this pvar
&& ProcAttributes.equal_clang_method_kind procedure_attr.ProcAttributes.clang_method_kind && ClangMethodKind.equal procedure_attr.ProcAttributes.clang_method_kind
ProcAttributes.CPP_INSTANCE ClangMethodKind.CPP_INSTANCE
in in
let do_hpred = function let do_hpred = function
| Sil.Hpointsto (Exp.Lvar pv, Sil.Eexp (e, _), _) -> | Sil.Hpointsto (Exp.Lvar pv, Sil.Eexp (e, _), _) ->

@ -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 let {ProcAttributes.clang_method_kind} = Procdesc.get_attributes pdesc in
match clang_method_kind with match clang_method_kind with
| ProcAttributes.OBJC_INSTANCE -> | ClangMethodKind.OBJC_INSTANCE ->
Pvar.is_self pvar Pvar.is_self pvar
| ProcAttributes.CPP_INSTANCE -> | ClangMethodKind.CPP_INSTANCE ->
Pvar.is_this pvar Pvar.is_this pvar
| _ -> | _ ->
false ) false )

@ -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 current_pdesc loc prop path
| None, false -> | None, false ->
let is_objc_instance_method = let is_objc_instance_method =
ProcAttributes.equal_clang_method_kind ClangMethodKind.equal attrs.ProcAttributes.clang_method_kind
attrs.ProcAttributes.clang_method_kind ProcAttributes.OBJC_INSTANCE ClangMethodKind.OBJC_INSTANCE
in in
skip_call ~is_objc_instance_method ~callee_attributes:(Some attrs) skip_call ~is_objc_instance_method ~callee_attributes:(Some attrs)
~reason prop path resolved_pname ret_annots loc ret_id_typ ret_type ~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 (* 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 *) where the receiver is null and the semantics of the call is nop *)
match (!Language.curr_language, callee_attrs.ProcAttributes.clang_method_kind) with 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 handle_objc_instance_method_call actual_pars actual_params pre tenv (fst ret_id_typ) pdesc
callee_pname loc path callee_pname loc path
(Tabulation.exe_function_call ?dynamic_dispatch exe_env callee_summary) (Tabulation.exe_function_call ?dynamic_dispatch exe_env callee_summary)

@ -91,7 +91,7 @@ let log_call_trace ~caller_name ~callee_name ?callee_attributes ?reason ?dynamic
match callee_attributes with match callee_attributes with
| Some attributes when Language.curr_language_is Language.Clang -> | Some attributes when Language.curr_language_is Language.Clang ->
let callee_clang_method_kind = 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 in
let callee_source_file = get_valid_source_file attributes.ProcAttributes.loc in let callee_source_file = get_valid_source_file attributes.ProcAttributes.loc in
(Some callee_clang_method_kind, callee_source_file) (Some callee_clang_method_kind, callee_source_file)

@ -39,16 +39,16 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
| _ -> | _ ->
Option.exists Option.exists
~f:(fun attributes -> ~f:(fun attributes ->
ProcAttributes.equal_clang_method_kind attributes.ProcAttributes.clang_method_kind ClangMethodKind.equal attributes.ProcAttributes.clang_method_kind
ProcAttributes.CPP_INSTANCE ) ClangMethodKind.CPP_INSTANCE )
(Summary.proc_resolve_attributes callee_pname) (Summary.proc_resolve_attributes callee_pname)
let is_objc_instance_method callee_pname = let is_objc_instance_method callee_pname =
Option.exists Option.exists
~f:(fun attributes -> ~f:(fun attributes ->
ProcAttributes.equal_clang_method_kind attributes.ProcAttributes.clang_method_kind ClangMethodKind.equal attributes.ProcAttributes.clang_method_kind
ProcAttributes.OBJC_INSTANCE ) ClangMethodKind.OBJC_INSTANCE )
(Summary.proc_resolve_attributes callee_pname) (Summary.proc_resolve_attributes callee_pname)

@ -12,18 +12,18 @@ let get_method_kind meth_decl =
let open Clang_ast_t in let open Clang_ast_t in
match meth_decl with match meth_decl with
| FunctionDecl _ -> | FunctionDecl _ ->
ProcAttributes.C_FUNCTION ClangMethodKind.C_FUNCTION
| CXXMethodDecl (_, _, _, _, method_decl_info) | CXXMethodDecl (_, _, _, _, method_decl_info)
| CXXConstructorDecl (_, _, _, _, method_decl_info) | CXXConstructorDecl (_, _, _, _, method_decl_info)
| CXXConversionDecl (_, _, _, _, method_decl_info) | CXXConversionDecl (_, _, _, _, method_decl_info)
| CXXDestructorDecl (_, _, _, _, method_decl_info) -> | CXXDestructorDecl (_, _, _, _, method_decl_info) ->
if method_decl_info.Clang_ast_t.xmdi_is_static then ProcAttributes.CPP_CLASS if method_decl_info.Clang_ast_t.xmdi_is_static then ClangMethodKind.CPP_CLASS
else ProcAttributes.CPP_INSTANCE else ClangMethodKind.CPP_INSTANCE
| ObjCMethodDecl (_, _, method_decl_info) -> | ObjCMethodDecl (_, _, method_decl_info) ->
if method_decl_info.Clang_ast_t.omdi_is_instance_method then ProcAttributes.OBJC_INSTANCE if method_decl_info.Clang_ast_t.omdi_is_instance_method then ClangMethodKind.OBJC_INSTANCE
else ProcAttributes.OBJC_CLASS else ClangMethodKind.OBJC_CLASS
| BlockDecl _ -> | BlockDecl _ ->
ProcAttributes.BLOCK ClangMethodKind.BLOCK
| _ -> | _ ->
raise CFrontend_config.Invalid_declaration raise CFrontend_config.Invalid_declaration
@ -32,7 +32,7 @@ let rec is_inside_objc_class_method meth_decl =
let open Clang_ast_t in let open Clang_ast_t in
match meth_decl with match meth_decl with
| ObjCMethodDecl _ -> | 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, _) -> ( | BlockDecl (di, _) -> (
match CAst_utils.get_decl_opt di.di_parent_pointer with match CAst_utils.get_decl_opt di.di_parent_pointer with
| Some decl -> | Some decl ->

@ -9,7 +9,7 @@ open! IStd
(** Functions for extracting properties of functions or method declarations *) (** 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 val is_inside_objc_class_method : Clang_ast_t.decl -> bool

@ -12,9 +12,9 @@ open! IStd
module BuildMethodSignature = struct module BuildMethodSignature = struct
let get_class_parameter_name method_kind = let get_class_parameter_name method_kind =
match method_kind with match method_kind with
| ProcAttributes.CPP_INSTANCE -> | ClangMethodKind.CPP_INSTANCE ->
Some (Mangled.from_string CFrontend_config.this) Some (Mangled.from_string CFrontend_config.this)
| ProcAttributes.OBJC_INSTANCE -> | ClangMethodKind.OBJC_INSTANCE ->
Some (Mangled.from_string CFrontend_config.self) Some (Mangled.from_string CFrontend_config.self)
| _ -> | _ ->
None None
@ -41,7 +41,7 @@ module BuildMethodSignature = struct
-> ( -> (
let method_kind = CMethodProperties.get_method_kind method_decl in let method_kind = CMethodProperties.get_method_kind method_decl in
match method_kind with 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 match (get_class_parameter_name method_kind, decl_info.di_parent_pointer) with
| Some name, Some parent_pointer -> | Some name, Some parent_pointer ->
let qual_type = CAst_utils.qual_type_of_decl_ptr parent_pointer in 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 types_of_captured_vars qual_type_to_sil_type tenv meth_decl =
let captured_vars = CMethodProperties.get_block_captured_variables meth_decl in let captured_vars = CMethodProperties.get_block_captured_variables meth_decl in
let is_block = let is_block =
ProcAttributes.equal_clang_method_kind ClangMethodKind.equal (CMethodProperties.get_method_kind meth_decl) ClangMethodKind.BLOCK
(CMethodProperties.get_method_kind meth_decl)
ProcAttributes.BLOCK
in in
let is_block_inside_objc_class_method = let is_block_inside_objc_class_method =
is_block && CMethodProperties.is_inside_objc_class_method meth_decl is_block && CMethodProperties.is_inside_objc_class_method meth_decl

@ -62,8 +62,7 @@ let rec is_objc_class_method context =
is_objc_class_method outer_context is_objc_class_method outer_context
| None -> | None ->
let attrs = Procdesc.get_attributes context.procdesc in let attrs = Procdesc.get_attributes context.procdesc in
ProcAttributes.equal_clang_method_kind attrs.ProcAttributes.clang_method_kind ClangMethodKind.equal attrs.ProcAttributes.clang_method_kind ClangMethodKind.OBJC_CLASS
ProcAttributes.OBJC_CLASS
let rec get_curr_class context = let rec get_curr_class context =

@ -416,7 +416,7 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron
in in
let ms = let ms =
CMethodSignature.mk procname None [] (Typ.void, Annot.Item.empty) [] 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 `None
in in
let stmt_info = let stmt_info =

@ -29,7 +29,7 @@ type t =
; has_added_return_param: bool ; has_added_return_param: bool
; attributes: Clang_ast_t.attribute list ; attributes: Clang_ast_t.attribute list
; loc: Clang_ast_t.source_range ; loc: Clang_ast_t.source_range
; method_kind: ProcAttributes.clang_method_kind ; method_kind: ClangMethodKind.t
; is_cpp_virtual: bool ; is_cpp_virtual: bool
; is_cpp_nothrow: bool ; is_cpp_nothrow: bool
; is_variadic: bool ; is_variadic: bool

@ -22,7 +22,7 @@ type t =
; has_added_return_param: bool ; has_added_return_param: bool
; attributes: Clang_ast_t.attribute list ; attributes: Clang_ast_t.attribute list
; loc: Clang_ast_t.source_range ; loc: Clang_ast_t.source_range
; method_kind: ProcAttributes.clang_method_kind ; method_kind: ClangMethodKind.t
; is_cpp_virtual: bool ; is_cpp_virtual: bool
; is_cpp_nothrow: bool ; is_cpp_nothrow: bool
; is_variadic: bool ; is_variadic: bool
@ -38,8 +38,8 @@ val is_setter : t -> bool
val mk : val mk :
Typ.Procname.t -> param_type option -> param_type list -> Typ.t * Annot.Item.t 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 -> ?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 -> ClangMethodKind.t -> ?is_cpp_virtual:bool -> ?is_cpp_nothrow:bool -> ?is_variadic:bool
-> ?is_variadic:bool -> Clang_ast_t.pointer option -> Clang_ast_t.pointer option -> Typ.t option -> Clang_ast_t.pointer option -> Clang_ast_t.pointer option -> Typ.t option
-> Clang_ast_t.access_specifier -> t -> Clang_ast_t.access_specifier -> t
val pp : Format.formatter -> t -> unit val pp : Format.formatter -> t -> unit

@ -332,10 +332,10 @@ let create_procdesc_with_pointer context pointer class_name_opt name =
match class_name_opt with match class_name_opt with
| Some class_name -> | Some class_name ->
( CType_decl.CProcname.NoAstDecl.cpp_method_of_string context.tenv class_name name ( CType_decl.CProcname.NoAstDecl.cpp_method_of_string context.tenv class_name name
, ProcAttributes.CPP_INSTANCE ) , ClangMethodKind.CPP_INSTANCE )
| None -> | None ->
( CType_decl.CProcname.NoAstDecl.c_function_of_string context.tenv name ( CType_decl.CProcname.NoAstDecl.c_function_of_string context.tenv name
, ProcAttributes.C_FUNCTION ) , ClangMethodKind.C_FUNCTION )
in in
create_external_procdesc context.translation_unit_context context.cfg callee_name method_kind create_external_procdesc context.translation_unit_context context.cfg callee_name method_kind
None ; None ;

@ -23,8 +23,8 @@ val create_local_procdesc :
-> CMethodSignature.t -> Clang_ast_t.stmt list -> (Pvar.t * Typ.t) list -> bool -> CMethodSignature.t -> Clang_ast_t.stmt list -> (Pvar.t * Typ.t) list -> bool
val create_external_procdesc : val create_external_procdesc :
CFrontend_config.translation_unit_context -> Cfg.t -> Typ.Procname.t CFrontend_config.translation_unit_context -> Cfg.t -> Typ.Procname.t -> ClangMethodKind.t
-> ProcAttributes.clang_method_kind -> (Typ.t * Typ.t list) option -> unit -> (Typ.t * Typ.t list) option -> unit
val get_objc_method_data : val get_objc_method_data :
Clang_ast_t.obj_c_message_expr_info -> string * Clang_ast_t.pointer option * method_call_type Clang_ast_t.obj_c_message_expr_info -> string * Clang_ast_t.pointer option * method_call_type

@ -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 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 objc_method_kind = Typ.Procname.ObjC_Cpp.objc_method_kind_of_bool is_instance in
let method_kind = 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 in
let ms_opt = let ms_opt =
match method_pointer_opt with match method_pointer_opt with

@ -75,7 +75,7 @@ let get_predefined_ms_method condition class_name method_name method_kind mk_pro
let ms = let ms =
CMethodSignature.mk procname None arguments return_type attributes CMethodSignature.mk procname None arguments return_type attributes
(CAst_utils.dummy_source_range ()) (CAst_utils.dummy_source_range ())
ProcAttributes.C_FUNCTION None None None `None ClangMethodKind.C_FUNCTION None None None `None
in in
Some ms Some ms
else None else None

@ -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 init_ret_id = Ident.create_fresh Ident.knormal in
let is_instance = true in let is_instance = true in
let call_flags = {CallFlags.default with CallFlags.cf_virtual= is_instance} 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 = let pname =
CType_decl.CProcname.NoAstDecl.objc_method_of_string_kind cls_name CFrontend_config.init CType_decl.CProcname.NoAstDecl.objc_method_of_string_kind cls_name CFrontend_config.init
Typ.Procname.ObjC_Cpp.ObjCInstanceMethod Typ.Procname.ObjC_Cpp.ObjCInstanceMethod

Loading…
Cancel
Save