From ad10435b5825b29bbd239ae0c5e213724deb9417 Mon Sep 17 00:00:00 2001 From: Varun Arora Date: Thu, 8 Feb 2018 05:08:11 -0800 Subject: [PATCH] [IR] combine is_objc_instance_method and is_cpp_instance_method fields in ProcAttributes into method_kind Summary: - Combine two fields from ProcAttributes.t into a single field `method_kind` with more information - New field details whether the procedure is an `OBJC_INSTANCE`, `CPP_INSTANCE`, `OBJ_CLASS`, `CPP_CLASS`, `BLOCK`, or `C_FUNCTION` - `is_objc_instance_method` and `is_cpp_instance_method` fields no longer necessary - Changed `is_instance` field in CMethod_signature to `method_kind` field of type ProcAttributes.method_kind Reviewed By: dulmarod Differential Revision: D6884402 fbshipit-source-id: 4b916c3 --- infer/src/IR/ProcAttributes.ml | 17 +- infer/src/IR/ProcAttributes.mli | 14 +- infer/src/backend/prover.ml | 6 +- infer/src/backend/rearrange.ml | 15 +- infer/src/backend/symExec.ml | 7 +- infer/src/checkers/NullabilityCheck.ml | 8 +- infer/src/clang/cContext.ml | 3 +- infer/src/clang/cFrontend_decl.ml | 35 ++-- infer/src/clang/cMethod_signature.ml | 8 +- infer/src/clang/cMethod_signature.mli | 9 +- infer/src/clang/cMethod_trans.ml | 61 +++---- infer/src/clang/cMethod_trans.mli | 4 +- infer/src/clang/cTrans.ml | 25 ++- infer/src/clang/cTrans_models.ml | 2 +- infer/src/clang/cTrans_utils.ml | 3 +- .../objc/frontend/block/static.m.dot | 66 ++++---- .../objc/frontend/types/testloop.m.dot | 22 +-- .../objc/shared/block/dispatch.m.dot | 88 +++++----- .../objc/shared/block/dispatch_examples.m.dot | 150 +++++++++--------- .../objc/shared/block/dispatch_in_macro.m.dot | 22 +-- 20 files changed, 308 insertions(+), 257 deletions(-) diff --git a/infer/src/IR/ProcAttributes.ml b/infer/src/IR/ProcAttributes.ml index 4165b52b9..1349264a8 100644 --- a/infer/src/IR/ProcAttributes.ml +++ b/infer/src/IR/ProcAttributes.ml @@ -24,6 +24,17 @@ let compare_proc_flags x y = 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 clang_method_kind_equal = [%compare.equal : clang_method_kind] + (** Type for ObjC accessors *) type objc_accessor_type = | Objc_getter of Typ.Struct.field @@ -50,13 +61,12 @@ type t = ; is_abstract: bool (** the procedure is abstract *) ; is_bridge_method: bool (** the procedure is a bridge method *) ; is_defined: bool (** true if the procedure is defined, and not just declared *) - ; is_objc_instance_method: bool (** the procedure is an objective-C instance method *) - ; is_cpp_instance_method: bool (** the procedure is an C++ instance method *) ; is_cpp_noexcept_method: bool (** the procedure is an C++ method annotated with "noexcept" *) ; is_java_synchronized_method: bool (** the procedure is a Java synchronized method *) ; is_model: bool (** the procedure is a model *) ; is_specialized: bool (** the procedure is a clone specialized for dynamic dispatch handling *) ; is_synthetic_method: bool (** the procedure is a synthetic method *) + ; clang_method_kind: clang_method_kind (** the kind of method the procedure is *) ; loc: Location.t (** location of this procedure in the source code *) ; translation_unit: SourceFile.t option (** translation unit to which the procedure belongs *) ; mutable locals: var_data list (** name, type and attributes of local variables *) @@ -81,14 +91,13 @@ let default proc_name = ; func_attributes= [] ; is_abstract= false ; is_bridge_method= false - ; is_cpp_instance_method= false ; is_cpp_noexcept_method= false ; is_java_synchronized_method= false ; is_defined= false - ; is_objc_instance_method= false ; is_model= false ; is_specialized= false ; is_synthetic_method= false + ; clang_method_kind= C_FUNCTION ; loc= Location.dummy ; translation_unit= None ; locals= [] diff --git a/infer/src/IR/ProcAttributes.mli b/infer/src/IR/ProcAttributes.mli index 4feb1770c..4a8b8748d 100644 --- a/infer/src/IR/ProcAttributes.mli +++ b/infer/src/IR/ProcAttributes.mli @@ -14,6 +14,17 @@ open! IStd (** flags for a procedure *) type proc_flags = (string, string) Caml.Hashtbl.t [@@deriving compare] +type clang_method_kind = + | CPP_INSTANCE + | OBJC_INSTANCE + | CPP_CLASS + | OBJC_CLASS + | BLOCK + | C_FUNCTION + [@@deriving compare] + +val clang_method_kind_equal : clang_method_kind -> clang_method_kind -> bool + type objc_accessor_type = | Objc_getter of Typ.Struct.field | Objc_setter of Typ.Struct.field @@ -43,13 +54,12 @@ type t = ; is_abstract: bool (** the procedure is abstract *) ; is_bridge_method: bool (** the procedure is a bridge method *) ; is_defined: bool (** true if the procedure is defined, and not just declared *) - ; is_objc_instance_method: bool (** the procedure is an objective-C instance method *) - ; is_cpp_instance_method: bool (** the procedure is an C++ instance method *) ; is_cpp_noexcept_method: bool (** the procedure is an C++ method annotated with "noexcept" *) ; is_java_synchronized_method: bool (** the procedure is a Java synchronized method *) ; is_model: bool (** the procedure is a model *) ; is_specialized: bool (** the procedure is a clone specialized for dynamic dispatch handling *) ; is_synthetic_method: bool (** the procedure is a synthetic method *) + ; clang_method_kind: clang_method_kind (** the kind of method the procedure is *) ; loc: Location.t (** location of this procedure in the source code *) ; translation_unit: SourceFile.t option (** translation unit to which the procedure belongs *) ; mutable locals: var_data list (** name, type and attributes of local variables *) diff --git a/infer/src/backend/prover.ml b/infer/src/backend/prover.ml index 5197c9dbd..57b7d8949 100644 --- a/infer/src/backend/prover.ml +++ b/infer/src/backend/prover.ml @@ -996,11 +996,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") - && procedure_attr.ProcAttributes.is_objc_instance_method + && ProcAttributes.clang_method_kind_equal procedure_attr.ProcAttributes.clang_method_kind + ProcAttributes.OBJC_INSTANCE in let is_cpp_this pvar = Language.equal language Clang && Pvar.is_this pvar - && procedure_attr.ProcAttributes.is_cpp_instance_method + && ProcAttributes.clang_method_kind_equal procedure_attr.ProcAttributes.clang_method_kind + ProcAttributes.CPP_INSTANCE in let do_hpred = function | Sil.Hpointsto (Exp.Lvar pv, Sil.Eexp (e, _), _) -> diff --git a/infer/src/backend/rearrange.ml b/infer/src/backend/rearrange.ml index 257a120a4..28913a740 100644 --- a/infer/src/backend/rearrange.ml +++ b/infer/src/backend/rearrange.ml @@ -1665,11 +1665,16 @@ let check_dereference_error tenv pdesc (prop: Prop.normal Prop.t) lexp loc = let check_call_to_objc_block_error tenv pdesc prop fun_exp loc = let pname = Procdesc.get_proc_name pdesc in let is_this = function - | Exp.Lvar pvar -> - let {ProcAttributes.is_objc_instance_method; is_cpp_instance_method} = - Procdesc.get_attributes pdesc - in - is_objc_instance_method && Pvar.is_self pvar || is_cpp_instance_method && Pvar.is_this pvar + | Exp.Lvar pvar + -> ( + let {ProcAttributes.clang_method_kind} = Procdesc.get_attributes pdesc in + match clang_method_kind with + | ProcAttributes.OBJC_INSTANCE -> + Pvar.is_self pvar + | ProcAttributes.CPP_INSTANCE -> + Pvar.is_this pvar + | _ -> + false ) | _ -> false in diff --git a/infer/src/backend/symExec.ml b/infer/src/backend/symExec.ml index 010070f51..52f8a77d9 100644 --- a/infer/src/backend/symExec.ml +++ b/infer/src/backend/symExec.ml @@ -1298,7 +1298,8 @@ let rec sym_exec tenv current_pdesc instr_ (prop_: Prop.normal Prop.t) path prop path | None, false -> let is_objc_instance_method = - attrs.ProcAttributes.is_objc_instance_method + ProcAttributes.clang_method_kind_equal + attrs.ProcAttributes.clang_method_kind ProcAttributes.OBJC_INSTANCE in skip_call ~is_objc_instance_method ~reason:"function or method not found" prop path resolved_pname ret_annots loc ret_id ret_typ_opt @@ -1751,7 +1752,9 @@ and proc_call callee_summary (* were the receiver is null and the semantics of the call is nop*) (* let callee_attrs = Specs.get_attributes callee_summary in *) if !Language.curr_language <> Language.Java - && (Specs.get_attributes callee_summary).ProcAttributes.is_objc_instance_method + && ProcAttributes.clang_method_kind_equal + (Specs.get_attributes callee_summary).ProcAttributes.clang_method_kind + ProcAttributes.OBJC_INSTANCE then handle_objc_instance_method_call actual_pars actual_params pre tenv ret_id pdesc callee_pname loc path diff --git a/infer/src/checkers/NullabilityCheck.ml b/infer/src/checkers/NullabilityCheck.ml index 997081440..3051d70b5 100644 --- a/infer/src/checkers/NullabilityCheck.ml +++ b/infer/src/checkers/NullabilityCheck.ml @@ -40,13 +40,17 @@ module TransferFunctions (CFG : ProcCfg.S) = struct not (Typ.Procname.Java.is_static java_pname) | _ -> Option.exists - ~f:(fun attributes -> attributes.ProcAttributes.is_cpp_instance_method) + ~f:(fun attributes -> + ProcAttributes.clang_method_kind_equal attributes.ProcAttributes.clang_method_kind + ProcAttributes.CPP_INSTANCE ) (Specs.proc_resolve_attributes callee_pname) let is_objc_instance_method callee_pname = Option.exists - ~f:(fun attributes -> attributes.ProcAttributes.is_objc_instance_method) + ~f:(fun attributes -> + ProcAttributes.clang_method_kind_equal attributes.ProcAttributes.clang_method_kind + ProcAttributes.OBJC_INSTANCE ) (Specs.proc_resolve_attributes callee_pname) diff --git a/infer/src/clang/cContext.ml b/infer/src/clang/cContext.ml index cfcdc61fe..18acfad48 100644 --- a/infer/src/clang/cContext.ml +++ b/infer/src/clang/cContext.ml @@ -71,7 +71,8 @@ let rec is_objc_instance context = is_objc_instance outer_context | None -> let attrs = Procdesc.get_attributes context.procdesc in - attrs.ProcAttributes.is_objc_instance_method + ProcAttributes.clang_method_kind_equal attrs.ProcAttributes.clang_method_kind + ProcAttributes.OBJC_INSTANCE let rec get_curr_class context = diff --git a/infer/src/clang/cFrontend_decl.ml b/infer/src/clang/cFrontend_decl.ml index 9560eba62..bdedbdaa1 100644 --- a/infer/src/clang/cFrontend_decl.ml +++ b/infer/src/clang/cFrontend_decl.ml @@ -53,13 +53,14 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron (** Translates the method/function's body into nodes of the cfg. *) let add_method ?(is_destructor_wrapper= false) trans_unit_ctx tenv cfg class_decl_opt procname - body has_return_param is_objc_method outer_context_opt extra_instrs = + body ms has_return_param is_objc_method outer_context_opt extra_instrs = L.(debug Capture Verbose) "@\n@\n>>---------- ADDING METHOD: '%a' ---------<<@\n@\n" Typ.Procname.pp procname ; incr CFrontend_config.procedures_attempted ; let recover () = Typ.Procname.Hash.remove cfg procname ; - CMethod_trans.create_external_procdesc cfg procname is_objc_method None + let method_kind = CMethod_signature.ms_get_method_kind ms in + CMethod_trans.create_external_procdesc cfg procname method_kind None in let pp_context fmt () = F.fprintf fmt "Aborting translation of method '%a'" Typ.Procname.pp procname @@ -108,10 +109,8 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron (* Only in the case the function declaration has a defined body we create a procdesc *) let procname = CMethod_signature.ms_get_name ms in let return_param_typ_opt = CMethod_signature.ms_get_return_param_typ ms in - if CMethod_trans.create_local_procdesc trans_unit_ctx cfg tenv ms [body] captured_vars - false - then - add_method trans_unit_ctx tenv cfg CContext.ContextNoCls procname body + if CMethod_trans.create_local_procdesc trans_unit_ctx cfg tenv ms [body] captured_vars then + add_method trans_unit_ctx tenv cfg CContext.ContextNoCls procname body ms return_param_typ_opt false outer_context_opt extra_instrs | None -> () @@ -122,8 +121,6 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron let ms, body_opt, extra_instrs = CMethod_trans.method_signature_of_decl trans_unit_ctx tenv meth_decl None in - let is_instance = CMethod_signature.ms_is_instance ms in - let is_objc_inst_method = is_instance && is_objc in match body_opt with | Some body -> let procname = CMethod_signature.ms_get_name ms in @@ -134,9 +131,9 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron (* A destructor wrapper is called from the outside, i.e. for destructing local variables and fields *) (* The destructor wrapper calls the inner destructor which has the actual body *) if CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv - ms [body] [] is_objc_inst_method + ms [body] [] then - add_method trans_unit_ctx tenv cfg curr_class procname body return_param_typ_opt + add_method trans_unit_ctx tenv cfg curr_class procname body ms return_param_typ_opt is_objc None extra_instrs ~is_destructor_wrapper:true ; let new_method_name = Config.clang_inner_destructor_prefix ^ Typ.Procname.get_method procname @@ -150,15 +147,15 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron else (ms, procname) in if CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv ms' - [body] [] is_objc_inst_method + [body] [] then - add_method trans_unit_ctx tenv cfg curr_class procname' body return_param_typ_opt is_objc - None extra_instrs ~is_destructor_wrapper:false + add_method trans_unit_ctx tenv cfg curr_class procname' body ms' return_param_typ_opt + is_objc None extra_instrs ~is_destructor_wrapper:false | None -> if set_objc_accessor_attr then ignore (CMethod_trans.create_local_procdesc ~set_objc_accessor_attr trans_unit_ctx cfg tenv ms - [] [] is_objc_inst_method) + [] []) let process_property_implementation trans_unit_ctx tenv cfg curr_class @@ -335,17 +332,17 @@ module CFrontend_decl_funct (T : CModule_type.CTranslation) : CModule_type.CFron in let ms = CMethod_signature.make_ms procname [] Ast_expressions.create_void_type [] - decl_info.Clang_ast_t.di_source_range false trans_unit_ctx.CFrontend_config.lang - None None None `None + decl_info.Clang_ast_t.di_source_range ProcAttributes.C_FUNCTION + trans_unit_ctx.CFrontend_config.lang None None None `None in let stmt_info = { si_pointer= CAst_utils.get_fresh_pointer () ; si_source_range= decl_info.di_source_range } in let body = Clang_ast_t.DeclStmt (stmt_info, [], [dec]) in - ignore (CMethod_trans.create_local_procdesc trans_unit_ctx cfg tenv ms [body] [] false) ; - add_method trans_unit_ctx tenv cfg CContext.ContextNoCls procname body None false None - [] + ignore (CMethod_trans.create_local_procdesc trans_unit_ctx cfg tenv ms [body] []) ; + add_method trans_unit_ctx tenv cfg CContext.ContextNoCls procname body ms None false + None [] (* Note that C and C++ records are treated the same way Skip translating implicit struct declarations, unless they have full definition (which happens with C++ lambdas) *) diff --git a/infer/src/clang/cMethod_signature.ml b/infer/src/clang/cMethod_signature.ml index 4452d4177..7f9f69436 100644 --- a/infer/src/clang/cMethod_signature.ml +++ b/infer/src/clang/cMethod_signature.ml @@ -20,7 +20,7 @@ type method_signature = ; ret_type: Clang_ast_t.qual_type ; attributes: Clang_ast_t.attribute list ; loc: Clang_ast_t.source_range - ; is_instance: bool + ; method_kind: ProcAttributes.clang_method_kind ; is_cpp_virtual: bool ; is_cpp_nothrow: bool ; language: CFrontend_config.clang_lang @@ -43,7 +43,7 @@ let ms_get_attributes {attributes} = attributes let ms_get_loc {loc} = loc -let ms_is_instance {is_instance} = is_instance +let ms_get_method_kind {method_kind} = method_kind let ms_is_cpp_virtual {is_cpp_virtual} = is_cpp_virtual @@ -69,7 +69,7 @@ let ms_is_setter {pointer_to_property_opt; args} = Option.is_some pointer_to_property_opt && Int.equal (List.length args) 2 -let make_ms name args ret_type attributes loc is_instance ?is_cpp_virtual ?is_cpp_nothrow language +let make_ms name args ret_type attributes loc method_kind ?is_cpp_virtual ?is_cpp_nothrow language pointer_to_parent pointer_to_property_opt return_param_typ access = let booloption_to_bool = function Some b -> b | None -> false in let is_cpp_virtual = booloption_to_bool is_cpp_virtual in @@ -80,7 +80,7 @@ let make_ms name args ret_type attributes loc is_instance ?is_cpp_virtual ?is_cp ; ret_type ; attributes ; loc - ; is_instance + ; method_kind ; is_cpp_virtual ; is_cpp_nothrow ; language diff --git a/infer/src/clang/cMethod_signature.mli b/infer/src/clang/cMethod_signature.mli index 73bc23126..b4d5db767 100644 --- a/infer/src/clang/cMethod_signature.mli +++ b/infer/src/clang/cMethod_signature.mli @@ -29,7 +29,7 @@ val ms_get_attributes : method_signature -> Clang_ast_t.attribute list val ms_get_loc : method_signature -> Clang_ast_t.source_range -val ms_is_instance : method_signature -> bool +val ms_get_method_kind : method_signature -> ProcAttributes.clang_method_kind val ms_is_cpp_virtual : method_signature -> bool @@ -49,9 +49,10 @@ val ms_is_setter : method_signature -> bool val make_ms : Typ.Procname.t -> (Mangled.t * Clang_ast_t.qual_type) list -> Clang_ast_t.qual_type - -> Clang_ast_t.attribute list -> Clang_ast_t.source_range -> bool -> ?is_cpp_virtual:bool - -> ?is_cpp_nothrow:bool -> CFrontend_config.clang_lang -> Clang_ast_t.pointer option - -> Clang_ast_t.pointer option -> Typ.t option -> Clang_ast_t.access_specifier -> method_signature + -> Clang_ast_t.attribute list -> Clang_ast_t.source_range -> ProcAttributes.clang_method_kind + -> ?is_cpp_virtual:bool -> ?is_cpp_nothrow:bool -> CFrontend_config.clang_lang + -> Clang_ast_t.pointer option -> Clang_ast_t.pointer option -> Typ.t option + -> Clang_ast_t.access_specifier -> method_signature val replace_name_ms : method_signature -> Typ.Procname.t -> method_signature diff --git a/infer/src/clang/cMethod_trans.ml b/infer/src/clang/cMethod_trans.ml index 7ec2234eb..768320062 100644 --- a/infer/src/clang/cMethod_trans.ml +++ b/infer/src/clang/cMethod_trans.ml @@ -34,14 +34,18 @@ type function_method_decl_info = | ObjC_Meth_decl_info of Clang_ast_t.obj_c_method_decl_info * Clang_ast_t.pointer | Block_decl_info of Clang_ast_t.block_decl_info * Clang_ast_t.qual_type * CContext.t -let is_instance_method function_method_decl_info = +let get_method_kind function_method_decl_info = match function_method_decl_info with - | Func_decl_info _ | Block_decl_info _ -> - false + | Func_decl_info _ -> + ProcAttributes.C_FUNCTION + | Block_decl_info _ -> + ProcAttributes.BLOCK | Cpp_Meth_decl_info (_, method_decl_info, _, _) -> - not method_decl_info.Clang_ast_t.xmdi_is_static + if method_decl_info.Clang_ast_t.xmdi_is_static then ProcAttributes.CPP_CLASS + else ProcAttributes.CPP_INSTANCE | ObjC_Meth_decl_info (method_decl_info, _) -> - method_decl_info.Clang_ast_t.omdi_is_instance_method + if method_decl_info.Clang_ast_t.omdi_is_instance_method then ProcAttributes.OBJC_INSTANCE + else ProcAttributes.OBJC_CLASS let get_original_return_type function_method_decl_info = @@ -53,7 +57,8 @@ let get_original_return_type function_method_decl_info = let get_class_param function_method_decl_info = - if is_instance_method function_method_decl_info then + match get_method_kind function_method_decl_info with + | ProcAttributes.CPP_INSTANCE | ProcAttributes.OBJC_INSTANCE -> ( match function_method_decl_info with | Cpp_Meth_decl_info (_, _, class_decl_ptr, _) -> let class_type = CAst_utils.qual_type_of_decl_ptr class_decl_ptr in @@ -62,8 +67,9 @@ let get_class_param function_method_decl_info = let class_type = CAst_utils.qual_type_of_decl_ptr class_decl_ptr in [(Mangled.from_string CFrontend_config.self, class_type)] | _ -> - [] - else [] + [] ) + | _ -> + [] let should_add_return_param return_type ~is_objc_method = @@ -162,14 +168,14 @@ let build_method_signature trans_unit_ctx tenv decl_info procname function_metho parent_pointer pointer_to_property_opt = let source_range = decl_info.Clang_ast_t.di_source_range in let tp, return_param_type_opt = get_return_val_and_param_types tenv function_method_decl_info in - let is_instance_method = is_instance_method function_method_decl_info in + let method_kind = get_method_kind function_method_decl_info in let parameters = get_parameters trans_unit_ctx tenv decl_info function_method_decl_info in let attributes = decl_info.Clang_ast_t.di_attributes in let lang = get_language trans_unit_ctx function_method_decl_info in let is_cpp_virtual = is_cpp_virtual function_method_decl_info in let is_cpp_nothrow = is_cpp_nothrow function_method_decl_info in let access = decl_info.Clang_ast_t.di_access in - CMethod_signature.make_ms procname parameters tp attributes source_range is_instance_method + CMethod_signature.make_ms procname parameters tp attributes source_range method_kind ~is_cpp_virtual ~is_cpp_nothrow lang parent_pointer pointer_to_property_opt return_param_type_opt access @@ -348,7 +354,11 @@ let get_formal_parameters tenv ms = (CMethod_signature.ms_get_lang ms) CFrontend_config.CPP in - is_objc_self && CMethod_signature.ms_is_instance ms || is_cxx_this + is_objc_self + && ProcAttributes.clang_method_kind_equal + (CMethod_signature.ms_get_method_kind ms) + ProcAttributes.OBJC_INSTANCE + || is_cxx_this in let qt = if should_add_pointer (Mangled.to_string mangled) ms then @@ -547,7 +557,7 @@ let get_objc_property_accessor tenv ms = (** Creates a procedure description. *) let create_local_procdesc ?(set_objc_accessor_attr= false) trans_unit_ctx cfg tenv ms fbody - captured is_objc_inst_method = + captured = let defined = not (Int.equal (List.length fbody) 0) in let proc_name = CMethod_signature.ms_get_name ms in let pname = Typ.Procname.to_string proc_name in @@ -556,10 +566,7 @@ let create_local_procdesc ?(set_objc_accessor_attr= false) trans_unit_ctx cfg te let method_annotation = sil_method_annotation_of_args (CMethod_signature.ms_get_args ms) method_ret_type in - let is_cpp_inst_method = - CMethod_signature.ms_is_instance ms - && CFrontend_config.equal_clang_lang (CMethod_signature.ms_get_lang ms) CFrontend_config.CPP - in + let clang_method_kind = CMethod_signature.ms_get_method_kind ms in let is_cpp_nothrow = CMethod_signature.ms_is_cpp_nothrow ms in let access = match CMethod_signature.ms_get_access ms with @@ -607,11 +614,10 @@ let create_local_procdesc ?(set_objc_accessor_attr= false) trans_unit_ctx cfg te ; access ; func_attributes= attributes ; is_defined= defined - ; is_objc_instance_method= is_objc_inst_method - ; is_cpp_instance_method= is_cpp_inst_method ; is_cpp_noexcept_method= is_cpp_nothrow ; is_model= Config.models_mode ; loc= loc_start + ; clang_method_kind ; objc_accessor= objc_property_accessor ; translation_unit= Some trans_unit_ctx.CFrontend_config.source_file ; method_annotation @@ -633,7 +639,7 @@ let create_local_procdesc ?(set_objc_accessor_attr= false) trans_unit_ctx cfg te (** Create a procdesc for objc methods whose signature cannot be found. *) -let create_external_procdesc cfg proc_name is_objc_inst_method type_opt = +let create_external_procdesc cfg proc_name clang_method_kind type_opt = if not (Typ.Procname.Hash.mem cfg proc_name) then let ret_type, formals = match type_opt with @@ -643,8 +649,7 @@ let create_external_procdesc cfg proc_name is_objc_inst_method type_opt = (Typ.mk Typ.Tvoid, []) in let proc_attributes = - { (ProcAttributes.default proc_name) with - ProcAttributes.formals; is_objc_instance_method= is_objc_inst_method; ret_type } + {(ProcAttributes.default proc_name) with ProcAttributes.formals; clang_method_kind; ret_type} in ignore (Cfg.create_proc_desc cfg proc_attributes) @@ -655,18 +660,20 @@ let create_procdesc_with_pointer context pointer class_name_opt name = | Some callee_ms -> ignore (create_local_procdesc context.translation_unit_context context.cfg context.tenv callee_ms - [] [] false) ; + [] []) ; CMethod_signature.ms_get_name callee_ms | None -> - let callee_name = + let callee_name, method_kind = match class_name_opt with | Some class_name -> - CProcname.NoAstDecl.cpp_method_of_string context.tenv class_name name + ( CProcname.NoAstDecl.cpp_method_of_string context.tenv class_name name + , ProcAttributes.CPP_INSTANCE ) | None -> - CProcname.NoAstDecl.c_function_of_string context.translation_unit_context context.tenv - name + ( CProcname.NoAstDecl.c_function_of_string context.translation_unit_context + context.tenv name + , ProcAttributes.C_FUNCTION ) in - create_external_procdesc context.cfg callee_name false None ; + create_external_procdesc context.cfg callee_name method_kind None ; callee_name diff --git a/infer/src/clang/cMethod_trans.mli b/infer/src/clang/cMethod_trans.mli index 7882f93a1..a6bffcb80 100644 --- a/infer/src/clang/cMethod_trans.mli +++ b/infer/src/clang/cMethod_trans.mli @@ -25,10 +25,10 @@ val should_add_return_param : Typ.t -> is_objc_method:bool -> bool val create_local_procdesc : ?set_objc_accessor_attr:bool -> CFrontend_config.translation_unit_context -> Cfg.t -> Tenv.t -> CMethod_signature.method_signature -> Clang_ast_t.stmt list -> (Pvar.t * Typ.t) list -> bool - -> bool val create_external_procdesc : - Cfg.t -> Typ.Procname.t -> bool -> (Typ.t * Typ.t list) option -> unit + Cfg.t -> Typ.Procname.t -> ProcAttributes.clang_method_kind -> (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 0413a0fa2..79b6cbf51 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -28,7 +28,10 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s CMethod_trans.get_objc_method_data obj_c_message_expr_info in let is_instance = mc_type <> CMethod_trans.MCStatic in - let method_kind = Typ.Procname.objc_method_kind_of_bool is_instance in + let objc_method_kind = Typ.Procname.objc_method_kind_of_bool is_instance in + let method_kind = + if is_instance then ProcAttributes.OBJC_INSTANCE else ProcAttributes.OBJC_CLASS + in let ms_opt = match method_pointer_opt with | Some pointer -> @@ -47,7 +50,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s CMethod_trans.get_class_name_method_call_from_receiver_kind context obj_c_message_expr_info act_params in - CProcname.NoAstDecl.objc_method_of_string_kind class_name selector method_kind + CProcname.NoAstDecl.objc_method_of_string_kind class_name selector objc_method_kind in let predefined_ms_opt = match proc_name with @@ -62,17 +65,17 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s | Some ms, _ -> ignore (CMethod_trans.create_local_procdesc context.translation_unit_context context.cfg - context.tenv ms [] [] is_instance) ; + context.tenv ms [] []) ; (CMethod_signature.ms_get_name ms, CMethod_trans.MCNoVirtual) | None, Some ms -> ignore (CMethod_trans.create_local_procdesc context.translation_unit_context context.cfg - context.tenv ms [] [] is_instance) ; + context.tenv ms [] []) ; if CMethod_signature.ms_is_getter ms || CMethod_signature.ms_is_setter ms then (proc_name, CMethod_trans.MCNoVirtual) else (proc_name, mc_type) | _ -> - CMethod_trans.create_external_procdesc context.cfg proc_name is_instance None ; + CMethod_trans.create_external_procdesc context.cfg proc_name method_kind None ; (proc_name, mc_type) @@ -560,7 +563,15 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s decl_ptr in let is_instance_method = - match ms_opt with Some ms -> CMethod_signature.ms_is_instance ms | _ -> true + match ms_opt with + | Some ms -> ( + match CMethod_signature.ms_get_method_kind ms with + | ProcAttributes.CPP_INSTANCE | ProcAttributes.OBJC_INSTANCE -> + true + | _ -> + false ) + | _ -> + true (* might happen for methods that are not exported yet (some templates). *) in let is_cpp_virtual = @@ -619,7 +630,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s in ignore (CMethod_trans.create_local_procdesc context.translation_unit_context context.cfg - context.tenv ms' [] [] false) ; + context.tenv ms' [] []) ; CMethod_signature.ms_get_name ms' | None -> CMethod_trans.create_procdesc_with_pointer context decl_ptr (Some class_typename) diff --git a/infer/src/clang/cTrans_models.ml b/infer/src/clang/cTrans_models.ml index 7ecf70cb6..4a25b50ca 100644 --- a/infer/src/clang/cTrans_models.ml +++ b/infer/src/clang/cTrans_models.ml @@ -77,7 +77,7 @@ let get_predefined_ms_method condition class_name method_name method_kind mk_pro let ms = CMethod_signature.make_ms procname arguments return_type attributes (CAst_utils.dummy_source_range ()) - false lang None None None `None + ProcAttributes.C_FUNCTION lang 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 a1d557fa5..8dafaf851 100644 --- a/infer/src/clang/cTrans_utils.ml +++ b/infer/src/clang/cTrans_utils.ml @@ -378,11 +378,12 @@ 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 pname = CProcname.NoAstDecl.objc_method_of_string_kind cls_name CFrontend_config.init Typ.Procname.ObjCInstanceMethod in - CMethod_trans.create_external_procdesc trans_state.context.CContext.cfg pname is_instance None ; + CMethod_trans.create_external_procdesc trans_state.context.CContext.cfg pname method_kind None ; let args = [(alloc_ret_exp, alloc_ret_type)] in let ret_id_typ = Some (init_ret_id, alloc_ret_type) in let init_stmt_call = diff --git a/infer/tests/codetoanalyze/objc/frontend/block/static.m.dot b/infer/tests/codetoanalyze/objc/frontend/block/static.m.dot index 170990ac5..dcdc2cf33 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/static.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/static.m.dot @@ -15,17 +15,6 @@ digraph cfg { "test#A#class.c69ae9e6be36a2eeb5dcbaa1187c354d_4" -> "test#A#class.c69ae9e6be36a2eeb5dcbaa1187c354d_3" ; -"objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_1" [label="1: Start objc_blockA_test_1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 20, column 3]\n " color=yellow style=filled] - - - "objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_1" -> "objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_3" ; -"objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_2" [label="2: Exit objc_blockA_test_1 \n " color=yellow style=filled] - - -"objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_3" [label="3: BinaryOperatorStmt: Assign \n n$1=_fun___objc_alloc_no_fail(sizeof(t=A):unsigned long) [line 21, column 23]\n n$2=_fun_NSBundleResourceRequest_init(n$1:A*) virtual [line 21, column 22]\n *&#GB$A_test_sharedInstance:objc_object*=n$2 [line 21, column 5]\n " shape="box"] - - - "objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_3" -> "objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_2" ; "test_leak#A#class.8240788aa53244827857be0e92d27671_1" [label="1: Start A_test_leak\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 28, column 1]\n " color=yellow style=filled] @@ -37,17 +26,6 @@ digraph cfg { "test_leak#A#class.8240788aa53244827857be0e92d27671_3" -> "test_leak#A#class.8240788aa53244827857be0e92d27671_2" ; -"objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_1" [label="1: Start objc_blockA_test_leak_2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 30, column 3]\n " color=yellow style=filled] - - - "objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_1" -> "objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_3" ; -"objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_2" [label="2: Exit objc_blockA_test_leak_2 \n " color=yellow style=filled] - - -"objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_3" [label="3: BinaryOperatorStmt: Assign \n n$3=_fun___objc_alloc_no_fail(sizeof(t=A):unsigned long) [line 31, column 23]\n n$4=_fun_NSBundleResourceRequest_init(n$3:A*) virtual [line 31, column 22]\n *&#GB$A_test_leak_sharedInstance:objc_object*=n$4 [line 31, column 5]\n " shape="box"] - - - "objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_3" -> "objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_2" ; "test2#A#class.ce50cb13c3345decc567dd4eb6124604_1" [label="1: Start A_test2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 36, column 1]\n " color=yellow style=filled] @@ -67,17 +45,6 @@ digraph cfg { "test2#A#class.ce50cb13c3345decc567dd4eb6124604_5" -> "test2#A#class.ce50cb13c3345decc567dd4eb6124604_4" ; -"objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_1" [label="1: Start objc_blockA_test2_3\nFormals: \nLocals: p:objc_object* \n DECLARE_LOCALS(&return,&p); [line 39, column 3]\n " color=yellow style=filled] - - - "objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_1" -> "objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_3" ; -"objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_2" [label="2: Exit objc_blockA_test2_3 \n " color=yellow style=filled] - - -"objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_3" [label="3: DeclStmt \n n$6=*&#GB$A_test2_sharedInstance:objc_object* [line 41, column 12]\n *&p:objc_object*=n$6 [line 41, column 5]\n " shape="box"] - - - "objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_3" -> "objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_2" ; "test3#A#class.041e0eaf033ae8cfa2af48253dfb07ee_1" [label="1: Start A_test3\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 47, column 1]\n " color=yellow style=filled] @@ -93,6 +60,39 @@ digraph cfg { "test3#A#class.041e0eaf033ae8cfa2af48253dfb07ee_4" -> "test3#A#class.041e0eaf033ae8cfa2af48253dfb07ee_3" ; +"objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_1" [label="1: Start objc_blockA_test_1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 20, column 3]\n " color=yellow style=filled] + + + "objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_1" -> "objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_3" ; +"objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_2" [label="2: Exit objc_blockA_test_1 \n " color=yellow style=filled] + + +"objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_3" [label="3: BinaryOperatorStmt: Assign \n n$1=_fun___objc_alloc_no_fail(sizeof(t=A):unsigned long) [line 21, column 23]\n n$2=_fun_NSBundleResourceRequest_init(n$1:A*) virtual [line 21, column 22]\n *&#GB$A_test_sharedInstance:objc_object*=n$2 [line 21, column 5]\n " shape="box"] + + + "objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_3" -> "objc_blockA_test_1.91b00d7c265c98d7bfda34cc42ad73ed_2" ; +"objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_1" [label="1: Start objc_blockA_test_leak_2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 30, column 3]\n " color=yellow style=filled] + + + "objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_1" -> "objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_3" ; +"objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_2" [label="2: Exit objc_blockA_test_leak_2 \n " color=yellow style=filled] + + +"objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_3" [label="3: BinaryOperatorStmt: Assign \n n$3=_fun___objc_alloc_no_fail(sizeof(t=A):unsigned long) [line 31, column 23]\n n$4=_fun_NSBundleResourceRequest_init(n$3:A*) virtual [line 31, column 22]\n *&#GB$A_test_leak_sharedInstance:objc_object*=n$4 [line 31, column 5]\n " shape="box"] + + + "objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_3" -> "objc_blockA_test_leak_2.5b3de3f9ef0695311853bace3ed320b8_2" ; +"objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_1" [label="1: Start objc_blockA_test2_3\nFormals: \nLocals: p:objc_object* \n DECLARE_LOCALS(&return,&p); [line 39, column 3]\n " color=yellow style=filled] + + + "objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_1" -> "objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_3" ; +"objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_2" [label="2: Exit objc_blockA_test2_3 \n " color=yellow style=filled] + + +"objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_3" [label="3: DeclStmt \n n$6=*&#GB$A_test2_sharedInstance:objc_object* [line 41, column 12]\n *&p:objc_object*=n$6 [line 41, column 5]\n " shape="box"] + + + "objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_3" -> "objc_blockA_test2_3.d73da2e84cb701fb03b2fbe656a01a1b_2" ; "objc_blockA_test3_4.645dc6f18a9ea7bd77a195ea083890a4_1" [label="1: Start objc_blockA_test3_4\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 50, column 3]\n " color=yellow style=filled] diff --git a/infer/tests/codetoanalyze/objc/frontend/types/testloop.m.dot b/infer/tests/codetoanalyze/objc/frontend/types/testloop.m.dot index b004d148d..6e7ecc928 100644 --- a/infer/tests/codetoanalyze/objc/frontend/types/testloop.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/types/testloop.m.dot @@ -1,5 +1,16 @@ /* @generated */ digraph cfg { +"layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_1" [label="1: Start FBScrollViewDelegateProxy_layoutToUse\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 44, column 1]\n " color=yellow style=filled] + + + "layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_1" -> "layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_3" ; +"layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_2" [label="2: Exit FBScrollViewDelegateProxy_layoutToUse \n " color=yellow style=filled] + + +"layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_3" [label="3: Return Stmt \n n$0=*&#GB$__iPhoneVideoAdLayout:FBVideoAdLayout [line 45, column 10]\n *&return:FBVideoAdLayout=n$0 [line 45, column 3]\n " shape="box"] + + + "layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_3" -> "layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_2" ; "__infer_globals_initializer___iPadVideoAdLayout#774934d200ab6ea201ea7444923ebf03.91a439a98050a5c80fe23fc56f573207_1" [label="1: Start __infer_globals_initializer___iPadVideoAdLayout\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 26, column 1]\n " color=yellow style=filled] @@ -22,15 +33,4 @@ digraph cfg { "__infer_globals_initializer___iPhoneVideoAdLayout#774934d200ab6ea201ea7444923ebf03.1e6bd750ce4ce65119ad54cee8ee01a8_3" -> "__infer_globals_initializer___iPhoneVideoAdLayout#774934d200ab6ea201ea7444923ebf03.1e6bd750ce4ce65119ad54cee8ee01a8_2" ; -"layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_1" [label="1: Start FBScrollViewDelegateProxy_layoutToUse\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 44, column 1]\n " color=yellow style=filled] - - - "layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_1" -> "layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_3" ; -"layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_2" [label="2: Exit FBScrollViewDelegateProxy_layoutToUse \n " color=yellow style=filled] - - -"layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_3" [label="3: Return Stmt \n n$0=*&#GB$__iPhoneVideoAdLayout:FBVideoAdLayout [line 45, column 10]\n *&return:FBVideoAdLayout=n$0 [line 45, column 3]\n " shape="box"] - - - "layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_3" -> "layoutToUse#FBScrollViewDelegateProxy#class.0fb14252876875c85e9253ab00bfb755_2" ; } diff --git a/infer/tests/codetoanalyze/objc/shared/block/dispatch.m.dot b/infer/tests/codetoanalyze/objc/shared/block/dispatch.m.dot index c276306f4..9722e1ac3 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/dispatch.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/dispatch.m.dot @@ -15,17 +15,6 @@ digraph cfg { "sharedInstance#DispatchA#class.8992c6086d1ce5c225093940f62386ac_4" -> "sharedInstance#DispatchA#class.8992c6086d1ce5c225093940f62386ac_3" ; -"objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_1" [label="1: Start objc_blockDispatchA_sharedInstance_1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 30, column 24]\n " color=yellow style=filled] - - - "objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_1" -> "objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_3" ; -"objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_2" [label="2: Exit objc_blockDispatchA_sharedInstance_1 \n " color=yellow style=filled] - - -"objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_3" [label="3: BinaryOperatorStmt: Assign \n n$2=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 31, column 23]\n n$3=_fun_NSBundleResourceRequest_init(n$2:DispatchA*) virtual [line 31, column 22]\n *&#GB$DispatchA_sharedInstance_sharedInstance:objc_object*=n$3 [line 31, column 5]\n " shape="box"] - - - "objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_3" -> "objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_2" ; "block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_1" [label="1: Start DispatchA_block_attribute\nFormals: \nLocals: a:DispatchA*(__block) \n DECLARE_LOCALS(&return,&a); [line 36, column 1]\n " color=yellow style=filled] @@ -64,17 +53,6 @@ digraph cfg { "trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_5" -> "trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_4" ; -"objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_1" [label="1: Start objc_blockDispatchA_trans_3\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 47, column 27]\n " color=yellow style=filled] - - - "objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_1" -> "objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_3" ; -"objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_2" [label="2: Exit objc_blockDispatchA_trans_3 \n " color=yellow style=filled] - - -"objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_3" [label="3: BinaryOperatorStmt: Assign \n n$12=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 48, column 23]\n n$13=_fun_NSBundleResourceRequest_init(n$12:DispatchA*) virtual [line 48, column 22]\n *&#GB$DispatchA_trans_sharedInstance:objc_object*=n$13 [line 48, column 5]\n " shape="box"] - - - "objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_3" -> "objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_2" ; "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_1" [label="1: Start DispatchA_dispatch_a_block_variable\nFormals: \nLocals: initialization_block__:_fn_(*) \n DECLARE_LOCALS(&return,&initialization_block__); [line 54, column 1]\n " color=yellow style=filled] @@ -94,17 +72,6 @@ digraph cfg { "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_5" -> "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_4" ; -"objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_1" [label="1: Start objc_blockDispatchA_dispatch_a_block_variable_4\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 56, column 38]\n " color=yellow style=filled] - - - "objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_1" -> "objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_3" ; -"objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_2" [label="2: Exit objc_blockDispatchA_dispatch_a_block_variable_4 \n " color=yellow style=filled] - - -"objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_3" [label="3: BinaryOperatorStmt: Assign \n n$16=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 57, column 25]\n n$17=_fun_NSObject_init(n$16:DispatchA*) virtual [line 57, column 25]\n *&#GB$DispatchA_dispatch_a_block_variable_static_storage__:objc_object*=n$17 [line 57, column 5]\n " shape="box"] - - - "objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_3" -> "objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_2" ; "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_1" [label="1: Start DispatchA_dispatch_a_block_variable_from_macro\nFormals: \nLocals: initialization_block__:_fn_(*) \n DECLARE_LOCALS(&return,&initialization_block__); [line 64, column 1]\n " color=yellow style=filled] @@ -128,17 +95,6 @@ digraph cfg { "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_6" -> "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_2" ; -"objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_1" [label="1: Start objc_blockDispatchA_dispatch_a_block_variable_from_macro_5\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 67, column 40]\n " color=yellow style=filled] - - - "objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_1" -> "objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_3" ; -"objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_2" [label="2: Exit objc_blockDispatchA_dispatch_a_block_variable_from_macro_5 \n " color=yellow style=filled] - - -"objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_3" [label="3: BinaryOperatorStmt: Assign \n n$20=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 68, column 27]\n n$21=_fun_NSObject_init(n$20:DispatchA*) virtual [line 68, column 27]\n *&#GB$DispatchA_dispatch_a_block_variable_from_macro_static_storage__:objc_object*=n$21 [line 68, column 7]\n " shape="box"] - - - "objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_3" -> "objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_2" ; "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_1" [label="1: Start DispatchA_dispatch_a_block_variable_from_macro_delivers_initialised_object\nFormals: \nLocals: a:DispatchA* \n DECLARE_LOCALS(&return,&a); [line 76, column 1]\n " color=yellow style=filled] @@ -158,6 +114,50 @@ digraph cfg { "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_5" -> "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_4" ; +"objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_1" [label="1: Start objc_blockDispatchA_sharedInstance_1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 30, column 24]\n " color=yellow style=filled] + + + "objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_1" -> "objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_3" ; +"objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_2" [label="2: Exit objc_blockDispatchA_sharedInstance_1 \n " color=yellow style=filled] + + +"objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_3" [label="3: BinaryOperatorStmt: Assign \n n$2=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 31, column 23]\n n$3=_fun_NSBundleResourceRequest_init(n$2:DispatchA*) virtual [line 31, column 22]\n *&#GB$DispatchA_sharedInstance_sharedInstance:objc_object*=n$3 [line 31, column 5]\n " shape="box"] + + + "objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_3" -> "objc_blockDispatchA_sharedInstance_1.0b8803e75b6a82e1a4530bcb953490e2_2" ; +"objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_1" [label="1: Start objc_blockDispatchA_trans_3\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 47, column 27]\n " color=yellow style=filled] + + + "objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_1" -> "objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_3" ; +"objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_2" [label="2: Exit objc_blockDispatchA_trans_3 \n " color=yellow style=filled] + + +"objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_3" [label="3: BinaryOperatorStmt: Assign \n n$12=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 48, column 23]\n n$13=_fun_NSBundleResourceRequest_init(n$12:DispatchA*) virtual [line 48, column 22]\n *&#GB$DispatchA_trans_sharedInstance:objc_object*=n$13 [line 48, column 5]\n " shape="box"] + + + "objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_3" -> "objc_blockDispatchA_trans_3.80c09fe69dc0d5591de63a0c525de29b_2" ; +"objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_1" [label="1: Start objc_blockDispatchA_dispatch_a_block_variable_4\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 56, column 38]\n " color=yellow style=filled] + + + "objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_1" -> "objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_3" ; +"objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_2" [label="2: Exit objc_blockDispatchA_dispatch_a_block_variable_4 \n " color=yellow style=filled] + + +"objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_3" [label="3: BinaryOperatorStmt: Assign \n n$16=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 57, column 25]\n n$17=_fun_NSObject_init(n$16:DispatchA*) virtual [line 57, column 25]\n *&#GB$DispatchA_dispatch_a_block_variable_static_storage__:objc_object*=n$17 [line 57, column 5]\n " shape="box"] + + + "objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_3" -> "objc_blockDispatchA_dispatch_a_block_variable_4.2eedc45fca2c35e6e8c11937ba7a2df8_2" ; +"objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_1" [label="1: Start objc_blockDispatchA_dispatch_a_block_variable_from_macro_5\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 67, column 40]\n " color=yellow style=filled] + + + "objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_1" -> "objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_3" ; +"objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_2" [label="2: Exit objc_blockDispatchA_dispatch_a_block_variable_from_macro_5 \n " color=yellow style=filled] + + +"objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_3" [label="3: BinaryOperatorStmt: Assign \n n$20=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 68, column 27]\n n$21=_fun_NSObject_init(n$20:DispatchA*) virtual [line 68, column 27]\n *&#GB$DispatchA_dispatch_a_block_variable_from_macro_static_storage__:objc_object*=n$21 [line 68, column 7]\n " shape="box"] + + + "objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_3" -> "objc_blockDispatchA_dispatch_a_block_variable_from_macro_5.e4f37df69df9d95138cb008e85eedab8_2" ; "DispatchMain.f6461dbdaeaf9a114cbe40f5f72fbb3f_1" [label="1: Start DispatchMain\nFormals: \nLocals: p:int* b:DispatchA* \n DECLARE_LOCALS(&return,&p,&b); [line 84, column 1]\n " color=yellow style=filled] diff --git a/infer/tests/codetoanalyze/objc/shared/block/dispatch_examples.m.dot b/infer/tests/codetoanalyze/objc/shared/block/dispatch_examples.m.dot index e2528add8..87e304878 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/dispatch_examples.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/dispatch_examples.m.dot @@ -19,21 +19,6 @@ digraph cfg { "dispatch_once_example#DispatchEx#class.d3456446b1a2d5355c1767887cc8b62c_5" -> "dispatch_once_example#DispatchEx#class.d3456446b1a2d5355c1767887cc8b62c_4" ; -"objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_1" [label="1: Start objc_blockDispatchEx_dispatch_once_example_1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 29, column 29]\n " color=yellow style=filled] - - - "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_1" -> "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_4" ; -"objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_2" [label="2: Exit objc_blockDispatchEx_dispatch_once_example_1 \n " color=yellow style=filled] - - -"objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_3" [label="3: BinaryOperatorStmt: Assign \n n$3=*&#GB$DispatchEx_dispatch_once_example_a:DispatchEx* [line 31, column 5]\n *n$3.x:int=10 [line 31, column 5]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_3" -> "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_2" ; -"objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_4" [label="4: BinaryOperatorStmt: Assign \n n$4=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 30, column 10]\n n$5=_fun_DispatchEx_init(n$4:DispatchEx*) virtual [line 30, column 9]\n *&#GB$DispatchEx_dispatch_once_example_a:DispatchEx*=n$5 [line 30, column 5]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_4" -> "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_3" ; "dispatch_async_example#DispatchEx#class.5c5d7347be2a9654ad7e32514189fe54_1" [label="1: Start DispatchEx_dispatch_async_example\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 36, column 1]\n " color=yellow style=filled] @@ -53,21 +38,6 @@ digraph cfg { "dispatch_async_example#DispatchEx#class.5c5d7347be2a9654ad7e32514189fe54_5" -> "dispatch_async_example#DispatchEx#class.5c5d7347be2a9654ad7e32514189fe54_4" ; -"objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_1" [label="1: Start objc_blockDispatchEx_dispatch_async_example_2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 39, column 18]\n " color=yellow style=filled] - - - "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_1" -> "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_4" ; -"objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_2" [label="2: Exit objc_blockDispatchEx_dispatch_async_example_2 \n " color=yellow style=filled] - - -"objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_3" [label="3: BinaryOperatorStmt: Assign \n n$9=*&#GB$DispatchEx_dispatch_async_example_a:DispatchEx* [line 41, column 20]\n *n$9.x:int=10 [line 41, column 20]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_3" -> "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_2" ; -"objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_4" [label="4: BinaryOperatorStmt: Assign \n n$10=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 40, column 25]\n n$11=_fun_DispatchEx_init(n$10:DispatchEx*) virtual [line 40, column 24]\n *&#GB$DispatchEx_dispatch_async_example_a:DispatchEx*=n$11 [line 40, column 20]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_4" -> "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_3" ; "dispatch_after_example#DispatchEx#class.1d25856bd99eb1ef683c8f65ff46d05d_1" [label="1: Start DispatchEx_dispatch_after_example\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 46, column 1]\n " color=yellow style=filled] @@ -87,21 +57,6 @@ digraph cfg { "dispatch_after_example#DispatchEx#class.1d25856bd99eb1ef683c8f65ff46d05d_5" -> "dispatch_after_example#DispatchEx#class.1d25856bd99eb1ef683c8f65ff46d05d_4" ; -"objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_1" [label="1: Start objc_blockDispatchEx_dispatch_after_example_3\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 50, column 18]\n " color=yellow style=filled] - - - "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_1" -> "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_4" ; -"objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_2" [label="2: Exit objc_blockDispatchEx_dispatch_after_example_3 \n " color=yellow style=filled] - - -"objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_3" [label="3: BinaryOperatorStmt: Assign \n n$16=*&#GB$DispatchEx_dispatch_after_example_a:DispatchEx* [line 52, column 20]\n *n$16.x:int=10 [line 52, column 20]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_3" -> "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_2" ; -"objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_4" [label="4: BinaryOperatorStmt: Assign \n n$17=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 51, column 25]\n n$18=_fun_DispatchEx_init(n$17:DispatchEx*) virtual [line 51, column 24]\n *&#GB$DispatchEx_dispatch_after_example_a:DispatchEx*=n$18 [line 51, column 20]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_4" -> "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_3" ; "dispatch_group_example#DispatchEx#class.f420a75c58eda6d3f0e5e05fadabfc18_1" [label="1: Start DispatchEx_dispatch_group_example\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 57, column 1]\n " color=yellow style=filled] @@ -121,21 +76,6 @@ digraph cfg { "dispatch_group_example#DispatchEx#class.f420a75c58eda6d3f0e5e05fadabfc18_5" -> "dispatch_group_example#DispatchEx#class.f420a75c58eda6d3f0e5e05fadabfc18_4" ; -"objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_1" [label="1: Start objc_blockDispatchEx_dispatch_group_example_4\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 59, column 57]\n " color=yellow style=filled] - - - "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_1" -> "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_4" ; -"objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_2" [label="2: Exit objc_blockDispatchEx_dispatch_group_example_4 \n " color=yellow style=filled] - - -"objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_3" [label="3: BinaryOperatorStmt: Assign \n n$22=*&#GB$DispatchEx_dispatch_group_example_a:DispatchEx* [line 61, column 5]\n *n$22.x:int=10 [line 61, column 5]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_3" -> "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_2" ; -"objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_4" [label="4: BinaryOperatorStmt: Assign \n n$23=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 60, column 10]\n n$24=_fun_DispatchEx_init(n$23:DispatchEx*) virtual [line 60, column 9]\n *&#GB$DispatchEx_dispatch_group_example_a:DispatchEx*=n$24 [line 60, column 5]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_4" -> "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_3" ; "dispatch_group_notify_example#DispatchEx#class.f5cf54b07621c319cf7ead3b217760ed_1" [label="1: Start DispatchEx_dispatch_group_notify_example\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 66, column 1]\n " color=yellow style=filled] @@ -155,21 +95,6 @@ digraph cfg { "dispatch_group_notify_example#DispatchEx#class.f5cf54b07621c319cf7ead3b217760ed_5" -> "dispatch_group_notify_example#DispatchEx#class.f5cf54b07621c319cf7ead3b217760ed_4" ; -"objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_1" [label="1: Start objc_blockDispatchEx_dispatch_group_notify_example_5\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 68, column 57]\n " color=yellow style=filled] - - - "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_1" -> "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_4" ; -"objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_2" [label="2: Exit objc_blockDispatchEx_dispatch_group_notify_example_5 \n " color=yellow style=filled] - - -"objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_3" [label="3: BinaryOperatorStmt: Assign \n n$28=*&#GB$DispatchEx_dispatch_group_notify_example_a:DispatchEx* [line 70, column 5]\n *n$28.x:int=10 [line 70, column 5]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_3" -> "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_2" ; -"objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_4" [label="4: BinaryOperatorStmt: Assign \n n$29=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 69, column 10]\n n$30=_fun_DispatchEx_init(n$29:DispatchEx*) virtual [line 69, column 9]\n *&#GB$DispatchEx_dispatch_group_notify_example_a:DispatchEx*=n$30 [line 69, column 5]\n " shape="box"] - - - "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_4" -> "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_3" ; "dispatch_barrier_example#DispatchEx#class.a541a40f2f04e29019c58e563f7544d8_1" [label="1: Start DispatchEx_dispatch_barrier_example\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 75, column 1]\n " color=yellow style=filled] @@ -189,6 +114,81 @@ digraph cfg { "dispatch_barrier_example#DispatchEx#class.a541a40f2f04e29019c58e563f7544d8_5" -> "dispatch_barrier_example#DispatchEx#class.a541a40f2f04e29019c58e563f7544d8_4" ; +"objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_1" [label="1: Start objc_blockDispatchEx_dispatch_once_example_1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 29, column 29]\n " color=yellow style=filled] + + + "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_1" -> "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_4" ; +"objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_2" [label="2: Exit objc_blockDispatchEx_dispatch_once_example_1 \n " color=yellow style=filled] + + +"objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_3" [label="3: BinaryOperatorStmt: Assign \n n$3=*&#GB$DispatchEx_dispatch_once_example_a:DispatchEx* [line 31, column 5]\n *n$3.x:int=10 [line 31, column 5]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_3" -> "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_2" ; +"objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_4" [label="4: BinaryOperatorStmt: Assign \n n$4=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 30, column 10]\n n$5=_fun_DispatchEx_init(n$4:DispatchEx*) virtual [line 30, column 9]\n *&#GB$DispatchEx_dispatch_once_example_a:DispatchEx*=n$5 [line 30, column 5]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_4" -> "objc_blockDispatchEx_dispatch_once_example_1.4b4341cb61d8b8d8f01e95edf36e4961_3" ; +"objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_1" [label="1: Start objc_blockDispatchEx_dispatch_async_example_2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 39, column 18]\n " color=yellow style=filled] + + + "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_1" -> "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_4" ; +"objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_2" [label="2: Exit objc_blockDispatchEx_dispatch_async_example_2 \n " color=yellow style=filled] + + +"objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_3" [label="3: BinaryOperatorStmt: Assign \n n$9=*&#GB$DispatchEx_dispatch_async_example_a:DispatchEx* [line 41, column 20]\n *n$9.x:int=10 [line 41, column 20]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_3" -> "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_2" ; +"objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_4" [label="4: BinaryOperatorStmt: Assign \n n$10=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 40, column 25]\n n$11=_fun_DispatchEx_init(n$10:DispatchEx*) virtual [line 40, column 24]\n *&#GB$DispatchEx_dispatch_async_example_a:DispatchEx*=n$11 [line 40, column 20]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_4" -> "objc_blockDispatchEx_dispatch_async_example_2.6510e5756fbcdafec0a18e8d5493346b_3" ; +"objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_1" [label="1: Start objc_blockDispatchEx_dispatch_after_example_3\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 50, column 18]\n " color=yellow style=filled] + + + "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_1" -> "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_4" ; +"objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_2" [label="2: Exit objc_blockDispatchEx_dispatch_after_example_3 \n " color=yellow style=filled] + + +"objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_3" [label="3: BinaryOperatorStmt: Assign \n n$16=*&#GB$DispatchEx_dispatch_after_example_a:DispatchEx* [line 52, column 20]\n *n$16.x:int=10 [line 52, column 20]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_3" -> "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_2" ; +"objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_4" [label="4: BinaryOperatorStmt: Assign \n n$17=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 51, column 25]\n n$18=_fun_DispatchEx_init(n$17:DispatchEx*) virtual [line 51, column 24]\n *&#GB$DispatchEx_dispatch_after_example_a:DispatchEx*=n$18 [line 51, column 20]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_4" -> "objc_blockDispatchEx_dispatch_after_example_3.380a17f45400d49d71ce1ba1c29a6ba4_3" ; +"objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_1" [label="1: Start objc_blockDispatchEx_dispatch_group_example_4\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 59, column 57]\n " color=yellow style=filled] + + + "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_1" -> "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_4" ; +"objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_2" [label="2: Exit objc_blockDispatchEx_dispatch_group_example_4 \n " color=yellow style=filled] + + +"objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_3" [label="3: BinaryOperatorStmt: Assign \n n$22=*&#GB$DispatchEx_dispatch_group_example_a:DispatchEx* [line 61, column 5]\n *n$22.x:int=10 [line 61, column 5]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_3" -> "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_2" ; +"objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_4" [label="4: BinaryOperatorStmt: Assign \n n$23=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 60, column 10]\n n$24=_fun_DispatchEx_init(n$23:DispatchEx*) virtual [line 60, column 9]\n *&#GB$DispatchEx_dispatch_group_example_a:DispatchEx*=n$24 [line 60, column 5]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_4" -> "objc_blockDispatchEx_dispatch_group_example_4.65d6b4827e06dfbede68939492105a46_3" ; +"objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_1" [label="1: Start objc_blockDispatchEx_dispatch_group_notify_example_5\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 68, column 57]\n " color=yellow style=filled] + + + "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_1" -> "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_4" ; +"objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_2" [label="2: Exit objc_blockDispatchEx_dispatch_group_notify_example_5 \n " color=yellow style=filled] + + +"objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_3" [label="3: BinaryOperatorStmt: Assign \n n$28=*&#GB$DispatchEx_dispatch_group_notify_example_a:DispatchEx* [line 70, column 5]\n *n$28.x:int=10 [line 70, column 5]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_3" -> "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_2" ; +"objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_4" [label="4: BinaryOperatorStmt: Assign \n n$29=_fun___objc_alloc_no_fail(sizeof(t=DispatchEx):unsigned long) [line 69, column 10]\n n$30=_fun_DispatchEx_init(n$29:DispatchEx*) virtual [line 69, column 9]\n *&#GB$DispatchEx_dispatch_group_notify_example_a:DispatchEx*=n$30 [line 69, column 5]\n " shape="box"] + + + "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_4" -> "objc_blockDispatchEx_dispatch_group_notify_example_5.ded89d749d973a9d57680f9d68afb8a0_3" ; "objc_blockDispatchEx_dispatch_barrier_example_6.644987ff1e6d0e0008d4ccdb7e8538ee_1" [label="1: Start objc_blockDispatchEx_dispatch_barrier_example_6\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 77, column 53]\n " color=yellow style=filled] diff --git a/infer/tests/codetoanalyze/objc/shared/block/dispatch_in_macro.m.dot b/infer/tests/codetoanalyze/objc/shared/block/dispatch_in_macro.m.dot index de6ebd8fd..f1926a502 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/dispatch_in_macro.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/dispatch_in_macro.m.dot @@ -1,5 +1,16 @@ /* @generated */ digraph cfg { +"objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_1" [label="1: Start objc_blockDispatchInMacroTest_1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 23, column 10]\n " color=yellow style=filled] + + + "objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_1" -> "objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_3" ; +"objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_2" [label="2: Exit objc_blockDispatchInMacroTest_1 \n " color=yellow style=filled] + + +"objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_3" [label="3: BinaryOperatorStmt: Assign \n n$1=_fun___objc_alloc_no_fail(sizeof(t=NSObject):unsigned long) [line 23, column 10]\n n$2=_fun_NSObject_init(n$1:NSObject*) virtual [line 23, column 10]\n *&#GB$DispatchInMacroTest_static_storage:NSObject*=n$2 [line 23, column 10]\n " shape="box"] + + + "objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_3" -> "objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_2" ; "DispatchInMacroTest.f5d56763274a479d06265a2f9562bef1_1" [label="1: Start DispatchInMacroTest\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 22, column 1]\n " color=yellow style=filled] @@ -19,15 +30,4 @@ digraph cfg { "DispatchInMacroTest.f5d56763274a479d06265a2f9562bef1_5" -> "DispatchInMacroTest.f5d56763274a479d06265a2f9562bef1_2" ; -"objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_1" [label="1: Start objc_blockDispatchInMacroTest_1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 23, column 10]\n " color=yellow style=filled] - - - "objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_1" -> "objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_3" ; -"objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_2" [label="2: Exit objc_blockDispatchInMacroTest_1 \n " color=yellow style=filled] - - -"objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_3" [label="3: BinaryOperatorStmt: Assign \n n$1=_fun___objc_alloc_no_fail(sizeof(t=NSObject):unsigned long) [line 23, column 10]\n n$2=_fun_NSObject_init(n$1:NSObject*) virtual [line 23, column 10]\n *&#GB$DispatchInMacroTest_static_storage:NSObject*=n$2 [line 23, column 10]\n " shape="box"] - - - "objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_3" -> "objc_blockDispatchInMacroTest_1.0a2ff27838c52acc175e58f653e6eaad_2" ; }