diff --git a/infer/src/backend/localise.ml b/infer/src/backend/localise.ml index 9e93d0fea..d7809d7ce 100644 --- a/infer/src/backend/localise.ml +++ b/infer/src/backend/localise.ml @@ -743,12 +743,13 @@ let desc_retain_cycle prop cycle loc cycle_dotty = !str_cycle (at_line tags loc) in { no_desc with descriptions = [desc]; tags = !tags; dotty = cycle_dotty } +let registered_observer_being_deallocated_str obj_str = + "Object " ^ obj_str ^ " is registered in a notification center but not being removed before deallocation" + let desc_registered_observer_being_deallocated pvar loc = let tags = Tags.create () in let obj_str = Sil.pvar_to_string pvar in - { no_desc with descriptions = ["Object " ^ obj_str ^ - " has not been unregistered from a notification " ^ - "center and is being deallocated " ^ at_line tags loc ^ + { no_desc with descriptions = [ registered_observer_being_deallocated_str obj_str ^ at_line tags loc ^ ". Being still registered as observer of the notification " ^ "center, the deallocated object " ^ obj_str ^ " may be notified in the future." ]; tags = !tags } diff --git a/infer/src/backend/localise.mli b/infer/src/backend/localise.mli index 9338d3c9f..9b40d2c5f 100644 --- a/infer/src/backend/localise.mli +++ b/infer/src/backend/localise.mli @@ -229,6 +229,8 @@ val desc_retain_cycle : Prop.normal Prop.t -> ((Sil.strexp * Sil.typ) * Ident.fieldname * Sil.strexp) list -> Location.t -> string option -> error_desc +val registered_observer_being_deallocated_str : string -> string + val desc_registered_observer_being_deallocated : Sil.pvar -> Location.t -> error_desc val desc_return_statement_missing : Location.t -> error_desc diff --git a/infer/src/clang/cFrontend_checkers.ml b/infer/src/clang/cFrontend_checkers.ml index e640e7326..381e367b9 100644 --- a/infer/src/clang/cFrontend_checkers.ml +++ b/infer/src/clang/cFrontend_checkers.ml @@ -44,6 +44,45 @@ let location_from_dinfo info = let proc_name_from_context context = Cfg.Procdesc.get_proc_name (CContext.get_procdesc context) +let rec is_self s = + let open Clang_ast_t in + match s with + | ImplicitCastExpr(_, [s], _, _) -> is_self s + | DeclRefExpr(_, _, _, dr) -> + (match dr.drti_decl_ref with + | Some decl_ref -> + (match decl_ref.dr_name with + | Some n -> n.ni_name = CFrontend_config.self + | _ -> false) + | _ -> false) + | _ -> false + +(* Call method m and on the pn parameter pred holds *) +(* st |= call_method(m(p1,...,pn,...pk)) /\ pred(pn) *) +let call_method_on_nth pred pn m st = + match st with + | Clang_ast_t.ObjCMessageExpr (_, params, _, omei) when omei.omei_selector = m -> + (try + let p = IList.nth params pn in + pred p + with _ -> false) + | _ -> false + +(* st |= EF (atomic_pred param) *) +let rec exists_eventually_st atomic_pred param st = + if atomic_pred param st then true + else + let _, st_list = Clang_ast_proj.get_stmt_tuple st in + IList.exists (exists_eventually_st atomic_pred param) st_list + +let dec_body_eventually atomic_pred param dec = + match dec with + | Clang_ast_t.ObjCMethodDecl (_, _, omdi) -> + (match omdi.Clang_ast_t.omdi_body with + | Some body -> exists_eventually_st atomic_pred param body + | _ -> false) + | _ -> false + (* === Warnings on properties === *) (* Strong Delegate Warning: a property with name delegate should not be declared strong *) @@ -112,3 +151,27 @@ let captured_cxx_ref_in_objc_block_warning stmt_info captured_vars = "by the time the block executes."; loc = location_from_sinfo stmt_info; } else None + + +(* exist m1: m1.body|- EF call_method(addObserver:) => exists m2 : m2.body |- EF call_method(removeObserver:) *) +let checker_NSNotificationCenter decl_info decls = + let exists_method_calling_addObserver = + IList.exists (dec_body_eventually (call_method_on_nth is_self 1) "addObserver:selector:name:object:") decls in + let exists_method_calling_addObserverForName = + IList.exists (dec_body_eventually (call_method_on_nth is_self 1) "addObserverForName:object:queue:usingBlock:") decls in + let eventually_addObserver = exists_method_calling_addObserver + || exists_method_calling_addObserverForName in + let exists_method_calling_removeObserver = + IList.exists (dec_body_eventually (call_method_on_nth is_self 1) "removeObserver:") decls in + let exists_method_calling_removeObserverName = + IList.exists (dec_body_eventually (call_method_on_nth is_self 1) "removeObserver:name:object:") decls in + let eventually_removeObserver = exists_method_calling_removeObserver + || exists_method_calling_removeObserverName in + let condition = eventually_addObserver && (not eventually_removeObserver) in + if condition then + Some { + name = Localise.to_string (Localise.registered_observer_being_deallocated); + description = Localise.registered_observer_being_deallocated_str CFrontend_config.self; + suggestion = "Consider removing the object from the notification center before its deallocation."; + loc = location_from_dinfo decl_info; } + else None diff --git a/infer/src/clang/cFrontend_checkers.mli b/infer/src/clang/cFrontend_checkers.mli index 077e733d8..424896ea3 100644 --- a/infer/src/clang/cFrontend_checkers.mli +++ b/infer/src/clang/cFrontend_checkers.mli @@ -30,3 +30,7 @@ val direct_atomic_property_access_warning : should not be captured in blocks. *) val captured_cxx_ref_in_objc_block_warning : Clang_ast_t.stmt_info -> (Sil.pvar * Sil.typ) list -> warning_desc option + +(* REGISTERED_OBSERVER_BEING_DEALLOCATED: an object is registered in a notification center + but not removed before deallocation *) +val checker_NSNotificationCenter : Clang_ast_t.decl_info -> Clang_ast_t.decl list -> warning_desc option diff --git a/infer/src/clang/cFrontend_errors.ml b/infer/src/clang/cFrontend_errors.ml index 1b0925dee..3498d2680 100644 --- a/infer/src/clang/cFrontend_errors.ml +++ b/infer/src/clang/cFrontend_errors.ml @@ -30,6 +30,13 @@ let captured_vars_checker_list = [CFrontend_checkers.captured_cxx_ref_in_objc_bl let checkers_for_capture_vars stmt_info captured_vars checker = checker stmt_info captured_vars +(* List of checkers on NSNotificationCenter *) +let ns_notification_checker_list = [CFrontend_checkers.checker_NSNotificationCenter] + +(* Invocation of checker belonging to ns_notification_center_list *) +let checkers_for_ns decl_info decls checker = + checker decl_info decls + (* Add a frontend warning with a description desc at location loc to the errlog of a proc desc *) let log_frontend_warning pdesc warn_desc = let open CFrontend_checkers in @@ -58,20 +65,18 @@ let invoke_set_of_checkers f pdesc checkers = | None -> ()) checkers (* Call all checkers on properties of class c *) -let rec check_for_property_errors cfg cg tenv class_name decl_list = +let rec check_for_property_errors cfg cg tenv pdesc decl_list = let open Clang_ast_t in let do_one_property decl_info pname_info pdi = - let pdesc = - CMethod_trans.get_method_for_frontend_checks cfg cg tenv class_name decl_info in let call_property_checker = checkers_for_property decl_info pname_info pdi in invoke_set_of_checkers call_property_checker pdesc property_checkers_list in match decl_list with | [] -> () | ObjCPropertyDecl (decl_info, pname_info, pdi) :: rest -> do_one_property decl_info pname_info pdi; - check_for_property_errors cfg cg tenv class_name rest + check_for_property_errors cfg cg tenv pdesc rest | _ :: rest -> - check_for_property_errors cfg cg tenv class_name rest + check_for_property_errors cfg cg tenv pdesc rest let get_categories_decls decl_ref = match Ast_utils.get_decl_opt_with_decl_ref decl_ref with @@ -95,18 +100,26 @@ let run_frontend_checkers_on_stmt trans_state instr = invoke_set_of_checkers call_captured_vars_checker pdesc captured_vars_checker_list | _ -> () -let run_frontend_checkers_on_decl tenv cg cfg dec = +let rec run_frontend_checkers_on_decl tenv cg cfg dec = + let pdesc_checker curr_class = + let name = CContext.get_curr_class_name curr_class in + let di = Clang_ast_proj.get_decl_tuple dec in + CMethod_trans.get_method_for_frontend_checks cfg cg tenv name di in let open Clang_ast_t in match dec with | ObjCCategoryImplDecl(_, name_info, decl_list, _, ocidi) -> let name = Ast_utils.get_qualified_name name_info in let curr_class = ObjcCategory_decl.get_curr_class_from_category_impl name ocidi in + let pdesc = pdesc_checker curr_class in let decls = (get_categories_decls ocidi.Clang_ast_t.ocidi_category_decl) @ decl_list in - let name = CContext.get_curr_class_name curr_class in - check_for_property_errors cfg cg tenv name decls - | ObjCImplementationDecl(_, _, decl_list, _, idi) -> + check_for_property_errors cfg cg tenv pdesc decls; + IList.iter (run_frontend_checkers_on_decl tenv cg cfg) decl_list + | ObjCImplementationDecl(decl_info, _, decl_list, _, idi) -> let curr_class = ObjcInterface_decl.get_curr_class_impl idi in - let name = CContext.get_curr_class_name curr_class in + let pdesc = pdesc_checker curr_class in let decls = (get_categories_decls idi.Clang_ast_t.oidi_class_interface) @ decl_list in - check_for_property_errors cfg cg tenv name decls + check_for_property_errors cfg cg tenv pdesc decls; + let call_ns_checker = checkers_for_ns decl_info decl_list in + invoke_set_of_checkers call_ns_checker pdesc ns_notification_checker_list; + IList.iter (run_frontend_checkers_on_decl tenv cg cfg) decl_list | _ -> () diff --git a/infer/tests/codetoanalyze/objc/errors/category_procdesc/EOCPerson.dot b/infer/tests/codetoanalyze/objc/errors/category_procdesc/EOCPerson.dot index ea392e410..c6a5872eb 100644 --- a/infer/tests/codetoanalyze/objc/errors/category_procdesc/EOCPerson.dot +++ b/infer/tests/codetoanalyze/objc/errors/category_procdesc/EOCPerson.dot @@ -1,24 +1,31 @@ digraph iCFG { -6 [label="6: Call _fun_NSLog \n n$1=_fun_NSString_stringWithUTF8String:(\"BTaking vacations\":char *) [line 19]\n _fun_NSLog(n$1:struct objc_object *) [line 19]\n REMOVE_TEMPS(n$1); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] +8 [label="8: Call _fun_NSLog \n n$1=_fun_NSString_stringWithUTF8String:(\"BTaking vacations\":char *) [line 19]\n _fun_NSLog(n$1:struct objc_object *) [line 19]\n REMOVE_TEMPS(n$1); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] - 6 -> 5 ; -5 [label="5: Exit EOCPerson_takeVacationFromWork \n " color=yellow style=filled] + 8 -> 7 ; +7 [label="7: Exit EOCPerson_takeVacationFromWork \n " color=yellow style=filled] -4 [label="4: Start EOCPerson_takeVacationFromWork\nFormals: self:class EOCPerson *\nLocals: \n DECLARE_LOCALS(&return); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled] +6 [label="6: Start EOCPerson_takeVacationFromWork\nFormals: self:class EOCPerson *\nLocals: \n DECLARE_LOCALS(&return); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled] - 4 -> 6 ; -3 [label="3: Call _fun_NSLog \n n$0=_fun_NSString_stringWithUTF8String:(\"Performing days at work\":char *) [line 15]\n _fun_NSLog(n$0:struct objc_object *) [line 15]\n REMOVE_TEMPS(n$0); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] + 6 -> 8 ; +5 [label="5: Call _fun_NSLog \n n$0=_fun_NSString_stringWithUTF8String:(\"Performing days at work\":char *) [line 15]\n _fun_NSLog(n$0:struct objc_object *) [line 15]\n REMOVE_TEMPS(n$0); [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit EOCPerson_performDaysWork \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit EOCPerson_performDaysWork \n " color=yellow style=filled] -1 [label="1: Start EOCPerson_performDaysWork\nFormals: self:class EOCPerson *\nLocals: \n DECLARE_LOCALS(&return); [line 14]\n NULLIFY(&self,false); [line 14]\n " color=yellow style=filled] +3 [label="3: Start EOCPerson_performDaysWork\nFormals: self:class EOCPerson *\nLocals: \n DECLARE_LOCALS(&return); [line 14]\n NULLIFY(&self,false); [line 14]\n " color=yellow style=filled] - 1 -> 3 ; + 3 -> 5 ; +2 [label="2: Exit EOCPerson_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start EOCPerson_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/errors/field_superclass/SuperExample.dot b/infer/tests/codetoanalyze/objc/errors/field_superclass/SuperExample.dot index c822e3ce0..c66012417 100644 --- a/infer/tests/codetoanalyze/objc/errors/field_superclass/SuperExample.dot +++ b/infer/tests/codetoanalyze/objc/errors/field_superclass/SuperExample.dot @@ -1,47 +1,61 @@ digraph iCFG { -12 [label="12: DeclStmt \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 42]\n n$2=_fun_NSObject_init(n$1:class A *) virtual [line 42]\n *&a:struct objc_object *=n$2 [line 42]\n REMOVE_TEMPS(n$1,n$2); [line 42]\n NULLIFY(&a,false); [line 42]\n " shape="box"] +16 [label="16: DeclStmt \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 42]\n n$2=_fun_NSObject_init(n$1:class A *) virtual [line 42]\n *&a:struct objc_object *=n$2 [line 42]\n REMOVE_TEMPS(n$1,n$2); [line 42]\n NULLIFY(&a,false); [line 42]\n " shape="box"] + + + 16 -> 15 ; +15 [label="15: Release the autorelease pool \n n$0=_fun___objc_release_autorelease_pool() [line 41]\n REMOVE_TEMPS(n$0); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] + + + 15 -> 14 ; +14 [label="14: Exit main \n " color=yellow style=filled] + + +13 [label="13: Start main\nFormals: argc:int argv:char **\nLocals: a:struct objc_object * \n DECLARE_LOCALS(&return,&a); [line 40]\n NULLIFY(&a,false); [line 40]\n NULLIFY(&argc,false); [line 40]\n NULLIFY(&argv,false); [line 40]\n " color=yellow style=filled] + + + 13 -> 16 ; +12 [label="12: BinaryOperatorStmt: Assign \n n$2=*&self:class A * [line 33]\n n$3=_fun_B_init(n$2:class A *) [line 33]\n *&self:class A *=n$3 [line 33]\n REMOVE_TEMPS(n$2,n$3); [line 33]\n " shape="box"] 12 -> 11 ; -11 [label="11: Release the autorelease pool \n n$0=_fun___objc_release_autorelease_pool() [line 41]\n REMOVE_TEMPS(n$0); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] +11 [label="11: BinaryOperatorStmt: Assign \n n$1=*&self:class A * [line 34]\n *n$1.a:int =4 [line 34]\n REMOVE_TEMPS(n$1); [line 34]\n " shape="box"] 11 -> 10 ; -10 [label="10: Exit main \n " color=yellow style=filled] +10 [label="10: Return Stmt \n n$0=*&self:class A * [line 35]\n *&return:struct objc_object *=n$0 [line 35]\n REMOVE_TEMPS(n$0); [line 35]\n NULLIFY(&self,false); [line 35]\n APPLY_ABSTRACTION; [line 35]\n " shape="box"] -9 [label="9: Start main\nFormals: argc:int argv:char **\nLocals: a:struct objc_object * \n DECLARE_LOCALS(&return,&a); [line 40]\n NULLIFY(&a,false); [line 40]\n NULLIFY(&argc,false); [line 40]\n NULLIFY(&argv,false); [line 40]\n " color=yellow style=filled] + 10 -> 9 ; +9 [label="9: Exit A_init \n " color=yellow style=filled] - 9 -> 12 ; -8 [label="8: BinaryOperatorStmt: Assign \n n$2=*&self:class A * [line 33]\n n$3=_fun_B_init(n$2:class A *) [line 33]\n *&self:class A *=n$3 [line 33]\n REMOVE_TEMPS(n$2,n$3); [line 33]\n " shape="box"] +8 [label="8: Start A_init\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 32]\n " color=yellow style=filled] - 8 -> 7 ; -7 [label="7: BinaryOperatorStmt: Assign \n n$1=*&self:class A * [line 34]\n *n$1.a:int =4 [line 34]\n REMOVE_TEMPS(n$1); [line 34]\n " shape="box"] + 8 -> 12 ; +7 [label="7: Exit A_frontendChecks \n " color=yellow style=filled] - 7 -> 6 ; -6 [label="6: Return Stmt \n n$0=*&self:class A * [line 35]\n *&return:struct objc_object *=n$0 [line 35]\n REMOVE_TEMPS(n$0); [line 35]\n NULLIFY(&self,false); [line 35]\n APPLY_ABSTRACTION; [line 35]\n " shape="box"] +6 [label="6: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 6 -> 5 ; -5 [label="5: Exit A_init \n " color=yellow style=filled] + 6 -> 7 ; +5 [label="5: Return Stmt \n *&return:struct objc_object *=0 [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] -4 [label="4: Start A_init\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 32]\n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit B_init \n " color=yellow style=filled] - 4 -> 8 ; -3 [label="3: Return Stmt \n *&return:struct objc_object *=0 [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] +3 [label="3: Start B_init\nFormals: self:class B *\nLocals: \n DECLARE_LOCALS(&return); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit B_init \n " color=yellow style=filled] + 3 -> 5 ; +2 [label="2: Exit B_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start B_init\nFormals: self:class B *\nLocals: \n DECLARE_LOCALS(&return); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled] +1 [label="1: Start B_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 3 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/RetainReleaseExample.dot b/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/RetainReleaseExample.dot index c6074171e..d40579273 100644 --- a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/RetainReleaseExample.dot +++ b/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/RetainReleaseExample.dot @@ -1,21 +1,28 @@ digraph iCFG { -5 [label="5: DeclStmt \n n$3=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 21]\n n$4=_fun_NSObject_init(n$3:class A *) virtual [line 21]\n *&a:class A *=n$4 [line 21]\n REMOVE_TEMPS(n$3,n$4); [line 21]\n " shape="box"] +7 [label="7: DeclStmt \n n$3=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 21]\n n$4=_fun_NSObject_init(n$3:class A *) virtual [line 21]\n *&a:class A *=n$4 [line 21]\n REMOVE_TEMPS(n$3,n$4); [line 21]\n " shape="box"] + + + 7 -> 6 ; +6 [label="6: Message Call: retain \n n$1=*&a:class A * [line 22]\n n$2=_fun___objc_retain(n$1:class A *) [line 22]\n REMOVE_TEMPS(n$1,n$2); [line 22]\n " shape="box"] + + + 6 -> 5 ; +5 [label="5: Message Call: release \n n$0=*&a:class A * [line 23]\n _fun___objc_release(n$0:class A *) [line 23]\n REMOVE_TEMPS(n$0); [line 23]\n NULLIFY(&a,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] 5 -> 4 ; -4 [label="4: Message Call: retain \n n$1=*&a:class A * [line 22]\n n$2=_fun___objc_retain(n$1:class A *) [line 22]\n REMOVE_TEMPS(n$1,n$2); [line 22]\n " shape="box"] +4 [label="4: Exit test \n " color=yellow style=filled] - 4 -> 3 ; -3 [label="3: Message Call: release \n n$0=*&a:class A * [line 23]\n _fun___objc_release(n$0:class A *) [line 23]\n REMOVE_TEMPS(n$0); [line 23]\n NULLIFY(&a,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] +3 [label="3: Start test\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 20]\n NULLIFY(&a,false); [line 20]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit test \n " color=yellow style=filled] + 3 -> 7 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start test\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 20]\n NULLIFY(&a,false); [line 20]\n " color=yellow style=filled] +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 5 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/RetainReleaseExample2.dot b/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/RetainReleaseExample2.dot index 7e4af8274..238587bc9 100644 --- a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/RetainReleaseExample2.dot +++ b/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/RetainReleaseExample2.dot @@ -1,124 +1,131 @@ digraph iCFG { -32 [label="32: Call _fun___objc_release \n n$1=*&a:class A * [line 65]\n _fun___objc_release(n$1:class A *) [line 65]\n REMOVE_TEMPS(n$1); [line 65]\n NULLIFY(&a,false); [line 65]\n APPLY_ABSTRACTION; [line 65]\n " shape="box"] +34 [label="34: Call _fun___objc_release \n n$1=*&a:class A * [line 65]\n _fun___objc_release(n$1:class A *) [line 65]\n REMOVE_TEMPS(n$1); [line 65]\n NULLIFY(&a,false); [line 65]\n APPLY_ABSTRACTION; [line 65]\n " shape="box"] - 32 -> 29 ; -31 [label="31: Prune (false branch) \n n$0=*&a:class A * [line 64]\n PRUNE((n$0 == 0), false); [line 64]\n REMOVE_TEMPS(n$0); [line 64]\n APPLY_ABSTRACTION; [line 64]\n " shape="invhouse"] + 34 -> 31 ; +33 [label="33: Prune (false branch) \n n$0=*&a:class A * [line 64]\n PRUNE((n$0 == 0), false); [line 64]\n REMOVE_TEMPS(n$0); [line 64]\n APPLY_ABSTRACTION; [line 64]\n " shape="invhouse"] - 31 -> 29 ; -30 [label="30: Prune (true branch) \n n$0=*&a:class A * [line 64]\n PRUNE((n$0 != 0), true); [line 64]\n REMOVE_TEMPS(n$0); [line 64]\n " shape="invhouse"] + 33 -> 31 ; +32 [label="32: Prune (true branch) \n n$0=*&a:class A * [line 64]\n PRUNE((n$0 != 0), true); [line 64]\n REMOVE_TEMPS(n$0); [line 64]\n " shape="invhouse"] - 30 -> 32 ; -29 [label="29: + \n NULLIFY(&a,false); [line 64]\n " ] + 32 -> 34 ; +31 [label="31: + \n NULLIFY(&a,false); [line 64]\n " ] - 29 -> 28 ; -28 [label="28: Exit test7 \n " color=yellow style=filled] + 31 -> 30 ; +30 [label="30: Exit test7 \n " color=yellow style=filled] -27 [label="27: Start test7\nFormals: a:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 63]\n " color=yellow style=filled] +29 [label="29: Start test7\nFormals: a:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 63]\n " color=yellow style=filled] - 27 -> 30 ; - 27 -> 31 ; -26 [label="26: DeclStmt \n n$3=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 57]\n n$4=_fun_NSObject_init(n$3:class A *) virtual [line 57]\n *&a:class A *=n$4 [line 57]\n REMOVE_TEMPS(n$3,n$4); [line 57]\n " shape="box"] + 29 -> 32 ; + 29 -> 33 ; +28 [label="28: DeclStmt \n n$3=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 57]\n n$4=_fun_NSObject_init(n$3:class A *) virtual [line 57]\n *&a:class A *=n$4 [line 57]\n REMOVE_TEMPS(n$3,n$4); [line 57]\n " shape="box"] + + + 28 -> 27 ; +27 [label="27: Message Call: retain \n n$1=*&a:class A * [line 58]\n n$2=_fun___objc_retain(n$1:class A *) [line 58]\n REMOVE_TEMPS(n$1,n$2); [line 58]\n " shape="box"] + + + 27 -> 26 ; +26 [label="26: Message Call: release \n n$0=*&a:class A * [line 59]\n _fun___objc_release(n$0:class A *) [line 59]\n REMOVE_TEMPS(n$0); [line 59]\n NULLIFY(&a,false); [line 59]\n APPLY_ABSTRACTION; [line 59]\n " shape="box"] 26 -> 25 ; -25 [label="25: Message Call: retain \n n$1=*&a:class A * [line 58]\n n$2=_fun___objc_retain(n$1:class A *) [line 58]\n REMOVE_TEMPS(n$1,n$2); [line 58]\n " shape="box"] +25 [label="25: Exit test6 \n " color=yellow style=filled] - 25 -> 24 ; -24 [label="24: Message Call: release \n n$0=*&a:class A * [line 59]\n _fun___objc_release(n$0:class A *) [line 59]\n REMOVE_TEMPS(n$0); [line 59]\n NULLIFY(&a,false); [line 59]\n APPLY_ABSTRACTION; [line 59]\n " shape="box"] +24 [label="24: Start test6\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 56]\n NULLIFY(&a,false); [line 56]\n " color=yellow style=filled] - 24 -> 23 ; -23 [label="23: Exit test6 \n " color=yellow style=filled] + 24 -> 28 ; +23 [label="23: DeclStmt \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 51]\n n$2=_fun_NSObject_init(n$1:class A *) virtual [line 51]\n *&a:class A *=n$2 [line 51]\n REMOVE_TEMPS(n$1,n$2); [line 51]\n " shape="box"] -22 [label="22: Start test6\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 56]\n NULLIFY(&a,false); [line 56]\n " color=yellow style=filled] + 23 -> 22 ; +22 [label="22: Message Call: release \n n$0=*&a:class A * [line 52]\n _fun___objc_release(n$0:class A *) [line 52]\n REMOVE_TEMPS(n$0); [line 52]\n NULLIFY(&a,false); [line 52]\n APPLY_ABSTRACTION; [line 52]\n " shape="box"] - 22 -> 26 ; -21 [label="21: DeclStmt \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 51]\n n$2=_fun_NSObject_init(n$1:class A *) virtual [line 51]\n *&a:class A *=n$2 [line 51]\n REMOVE_TEMPS(n$1,n$2); [line 51]\n " shape="box"] + 22 -> 21 ; +21 [label="21: Exit test5 \n " color=yellow style=filled] - 21 -> 20 ; -20 [label="20: Message Call: release \n n$0=*&a:class A * [line 52]\n _fun___objc_release(n$0:class A *) [line 52]\n REMOVE_TEMPS(n$0); [line 52]\n NULLIFY(&a,false); [line 52]\n APPLY_ABSTRACTION; [line 52]\n " shape="box"] +20 [label="20: Start test5\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 50]\n NULLIFY(&a,false); [line 50]\n " color=yellow style=filled] - 20 -> 19 ; -19 [label="19: Exit test5 \n " color=yellow style=filled] + 20 -> 23 ; +19 [label="19: DeclStmt \n n$1=_fun_test() [line 45]\n *&b:class A *=n$1 [line 45]\n REMOVE_TEMPS(n$1); [line 45]\n " shape="box"] -18 [label="18: Start test5\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 50]\n NULLIFY(&a,false); [line 50]\n " color=yellow style=filled] + 19 -> 18 ; +18 [label="18: Message Call: release \n n$0=*&b:class A * [line 46]\n _fun___objc_release(n$0:class A *) [line 46]\n REMOVE_TEMPS(n$0); [line 46]\n NULLIFY(&b,false); [line 46]\n APPLY_ABSTRACTION; [line 46]\n " shape="box"] - 18 -> 21 ; -17 [label="17: DeclStmt \n n$1=_fun_test() [line 45]\n *&b:class A *=n$1 [line 45]\n REMOVE_TEMPS(n$1); [line 45]\n " shape="box"] + 18 -> 17 ; +17 [label="17: Exit test4 \n " color=yellow style=filled] - 17 -> 16 ; -16 [label="16: Message Call: release \n n$0=*&b:class A * [line 46]\n _fun___objc_release(n$0:class A *) [line 46]\n REMOVE_TEMPS(n$0); [line 46]\n NULLIFY(&b,false); [line 46]\n APPLY_ABSTRACTION; [line 46]\n " shape="box"] +16 [label="16: Start test4\nFormals: \nLocals: b:class A * \n DECLARE_LOCALS(&return,&b); [line 43]\n NULLIFY(&b,false); [line 43]\n " color=yellow style=filled] - 16 -> 15 ; -15 [label="15: Exit test4 \n " color=yellow style=filled] + 16 -> 19 ; +15 [label="15: DeclStmt \n n$0=_fun_test() [line 40]\n *&b:class A *=n$0 [line 40]\n REMOVE_TEMPS(n$0); [line 40]\n NULLIFY(&b,false); [line 40]\n APPLY_ABSTRACTION; [line 40]\n " shape="box"] -14 [label="14: Start test4\nFormals: \nLocals: b:class A * \n DECLARE_LOCALS(&return,&b); [line 43]\n NULLIFY(&b,false); [line 43]\n " color=yellow style=filled] + 15 -> 14 ; +14 [label="14: Exit test3 \n " color=yellow style=filled] - 14 -> 17 ; -13 [label="13: DeclStmt \n n$0=_fun_test() [line 40]\n *&b:class A *=n$0 [line 40]\n REMOVE_TEMPS(n$0); [line 40]\n NULLIFY(&b,false); [line 40]\n APPLY_ABSTRACTION; [line 40]\n " shape="box"] +13 [label="13: Start test3\nFormals: \nLocals: b:class A * \n DECLARE_LOCALS(&return,&b); [line 40]\n NULLIFY(&b,false); [line 40]\n " color=yellow style=filled] - 13 -> 12 ; -12 [label="12: Exit test3 \n " color=yellow style=filled] + 13 -> 15 ; +12 [label="12: DeclStmt \n n$1=_fun_test() [line 35]\n *&b:class A *=n$1 [line 35]\n REMOVE_TEMPS(n$1); [line 35]\n " shape="box"] -11 [label="11: Start test3\nFormals: \nLocals: b:class A * \n DECLARE_LOCALS(&return,&b); [line 40]\n NULLIFY(&b,false); [line 40]\n " color=yellow style=filled] + 12 -> 11 ; +11 [label="11: BinaryOperatorStmt: Assign \n n$0=*&b:class A * [line 36]\n *&#GB$g:class A *=n$0 [line 36]\n REMOVE_TEMPS(n$0); [line 36]\n NULLIFY(&b,false); [line 36]\n APPLY_ABSTRACTION; [line 36]\n " shape="box"] - 11 -> 13 ; -10 [label="10: DeclStmt \n n$1=_fun_test() [line 35]\n *&b:class A *=n$1 [line 35]\n REMOVE_TEMPS(n$1); [line 35]\n " shape="box"] + 11 -> 10 ; +10 [label="10: Exit test2 \n " color=yellow style=filled] - 10 -> 9 ; -9 [label="9: BinaryOperatorStmt: Assign \n n$0=*&b:class A * [line 36]\n *&#GB$g:class A *=n$0 [line 36]\n REMOVE_TEMPS(n$0); [line 36]\n NULLIFY(&b,false); [line 36]\n APPLY_ABSTRACTION; [line 36]\n " shape="box"] +9 [label="9: Start test2\nFormals: \nLocals: b:class A * \n DECLARE_LOCALS(&return,&b); [line 33]\n NULLIFY(&b,false); [line 33]\n " color=yellow style=filled] - 9 -> 8 ; -8 [label="8: Exit test2 \n " color=yellow style=filled] + 9 -> 12 ; +8 [label="8: DeclStmt \n n$4=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 25]\n n$5=_fun_NSObject_init(n$4:class A *) virtual [line 25]\n *&a:class A *=n$5 [line 25]\n REMOVE_TEMPS(n$4,n$5); [line 25]\n " shape="box"] -7 [label="7: Start test2\nFormals: \nLocals: b:class A * \n DECLARE_LOCALS(&return,&b); [line 33]\n NULLIFY(&b,false); [line 33]\n " color=yellow style=filled] + 8 -> 7 ; +7 [label="7: Message Call: retain \n n$2=*&a:class A * [line 26]\n n$3=_fun___objc_retain(n$2:class A *) [line 26]\n REMOVE_TEMPS(n$2,n$3); [line 26]\n " shape="box"] - 7 -> 10 ; -6 [label="6: DeclStmt \n n$4=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 25]\n n$5=_fun_NSObject_init(n$4:class A *) virtual [line 25]\n *&a:class A *=n$5 [line 25]\n REMOVE_TEMPS(n$4,n$5); [line 25]\n " shape="box"] + 7 -> 6 ; +6 [label="6: Message Call: release \n n$1=*&a:class A * [line 27]\n _fun___objc_release(n$1:class A *) [line 27]\n REMOVE_TEMPS(n$1); [line 27]\n " shape="box"] 6 -> 5 ; -5 [label="5: Message Call: retain \n n$2=*&a:class A * [line 26]\n n$3=_fun___objc_retain(n$2:class A *) [line 26]\n REMOVE_TEMPS(n$2,n$3); [line 26]\n " shape="box"] +5 [label="5: Return Stmt \n n$0=*&a:class A * [line 29]\n *&return:class A *=n$0 [line 29]\n REMOVE_TEMPS(n$0); [line 29]\n NULLIFY(&a,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] 5 -> 4 ; -4 [label="4: Message Call: release \n n$1=*&a:class A * [line 27]\n _fun___objc_release(n$1:class A *) [line 27]\n REMOVE_TEMPS(n$1); [line 27]\n " shape="box"] +4 [label="4: Exit test \n " color=yellow style=filled] - 4 -> 3 ; -3 [label="3: Return Stmt \n n$0=*&a:class A * [line 29]\n *&return:class A *=n$0 [line 29]\n REMOVE_TEMPS(n$0); [line 29]\n NULLIFY(&a,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] +3 [label="3: Start test\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 24]\n NULLIFY(&a,false); [line 24]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit test \n " color=yellow style=filled] + 3 -> 8 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start test\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 24]\n NULLIFY(&a,false); [line 24]\n " color=yellow style=filled] +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 6 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/TollBridgeExample.dot b/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/TollBridgeExample.dot index e0769049a..749035e1d 100644 --- a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/TollBridgeExample.dot +++ b/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/TollBridgeExample.dot @@ -1,73 +1,80 @@ digraph iCFG { -19 [label="19: Return Stmt \n n$0=_fun___builtin___CFStringMakeConstantString(\"Icon\":char *) [line 41]\n n$1=_fun_CTFontCreateWithName(n$0:struct __CFString *,17.000000:double ,0:struct CGAffineTransform *) [line 41]\n n$2=_fun___objc_cast(n$1:void *,sizeof(void ):unsigned long ) [line 41]\n *&return:struct __CTFont *=n$2 [line 41]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] +21 [label="21: Return Stmt \n n$0=_fun___builtin___CFStringMakeConstantString(\"Icon\":char *) [line 41]\n n$1=_fun_CTFontCreateWithName(n$0:struct __CFString *,17.000000:double ,0:struct CGAffineTransform *) [line 41]\n n$2=_fun___objc_cast(n$1:void *,sizeof(void ):unsigned long ) [line 41]\n *&return:struct __CTFont *=n$2 [line 41]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] - 19 -> 18 ; -18 [label="18: Exit cfautorelease_test \n " color=yellow style=filled] + 21 -> 20 ; +20 [label="20: Exit cfautorelease_test \n " color=yellow style=filled] -17 [label="17: Start cfautorelease_test\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 40]\n " color=yellow style=filled] +19 [label="19: Start cfautorelease_test\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 40]\n " color=yellow style=filled] - 17 -> 19 ; -16 [label="16: DeclStmt \n n$8=_fun_CFHTTPMessageCopyAllHeaderFields(0:struct __CFHTTPMessage *) [line 36]\n *&ref:struct __CFDictionary *=n$8 [line 36]\n REMOVE_TEMPS(n$8); [line 36]\n " shape="box"] + 19 -> 21 ; +18 [label="18: DeclStmt \n n$8=_fun_CFHTTPMessageCopyAllHeaderFields(0:struct __CFHTTPMessage *) [line 36]\n *&ref:struct __CFDictionary *=n$8 [line 36]\n REMOVE_TEMPS(n$8); [line 36]\n " shape="box"] - 16 -> 15 ; -15 [label="15: Call _fun_CFBridgingRelease \n n$6=*&ref:struct __CFDictionary * [line 37]\n n$7=_fun___objc_cast(n$6:void *,sizeof(struct objc_object ):unsigned long ) [line 37]\n REMOVE_TEMPS(n$6,n$7); [line 37]\n NULLIFY(&ref,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] + 18 -> 17 ; +17 [label="17: Call _fun_CFBridgingRelease \n n$6=*&ref:struct __CFDictionary * [line 37]\n n$7=_fun___objc_cast(n$6:void *,sizeof(struct objc_object ):unsigned long ) [line 37]\n REMOVE_TEMPS(n$6,n$7); [line 37]\n NULLIFY(&ref,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] - 15 -> 14 ; -14 [label="14: Exit TollBridgeExample__readHTTPHeader \n " color=yellow style=filled] + 17 -> 16 ; +16 [label="16: Exit TollBridgeExample__readHTTPHeader \n " color=yellow style=filled] -13 [label="13: Start TollBridgeExample__readHTTPHeader\nFormals: self:class TollBridgeExample *\nLocals: ref:struct __CFDictionary * \n DECLARE_LOCALS(&return,&ref); [line 34]\n NULLIFY(&ref,false); [line 34]\n NULLIFY(&self,false); [line 34]\n " color=yellow style=filled] +15 [label="15: Start TollBridgeExample__readHTTPHeader\nFormals: self:class TollBridgeExample *\nLocals: ref:struct __CFDictionary * \n DECLARE_LOCALS(&return,&ref); [line 34]\n NULLIFY(&ref,false); [line 34]\n NULLIFY(&self,false); [line 34]\n " color=yellow style=filled] - 13 -> 16 ; -12 [label="12: DeclStmt \n n$5=_fun___objc_alloc_no_fail(sizeof(class NSLocale ):unsigned long ) [line 30]\n *&observer:struct objc_object *=n$5 [line 30]\n REMOVE_TEMPS(n$5); [line 30]\n " shape="box"] + 15 -> 18 ; +14 [label="14: DeclStmt \n n$5=_fun___objc_alloc_no_fail(sizeof(class NSLocale ):unsigned long ) [line 30]\n *&observer:struct objc_object *=n$5 [line 30]\n REMOVE_TEMPS(n$5); [line 30]\n " shape="box"] - 12 -> 11 ; -11 [label="11: DeclStmt \n n$4=*&observer:struct objc_object * [line 31]\n *&a:struct __CFLocale *=n$4 [line 31]\n REMOVE_TEMPS(n$4); [line 31]\n NULLIFY(&a,false); [line 31]\n NULLIFY(&observer,false); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] + 14 -> 13 ; +13 [label="13: DeclStmt \n n$4=*&observer:struct objc_object * [line 31]\n *&a:struct __CFLocale *=n$4 [line 31]\n REMOVE_TEMPS(n$4); [line 31]\n NULLIFY(&a,false); [line 31]\n NULLIFY(&observer,false); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] - 11 -> 10 ; -10 [label="10: Exit TollBridgeExample_brideRetained \n " color=yellow style=filled] + 13 -> 12 ; +12 [label="12: Exit TollBridgeExample_brideRetained \n " color=yellow style=filled] -9 [label="9: Start TollBridgeExample_brideRetained\nFormals: self:class TollBridgeExample *\nLocals: a:struct __CFLocale * observer:struct objc_object * \n DECLARE_LOCALS(&return,&a,&observer); [line 29]\n NULLIFY(&a,false); [line 29]\n NULLIFY(&observer,false); [line 29]\n NULLIFY(&self,false); [line 29]\n " color=yellow style=filled] +11 [label="11: Start TollBridgeExample_brideRetained\nFormals: self:class TollBridgeExample *\nLocals: a:struct __CFLocale * observer:struct objc_object * \n DECLARE_LOCALS(&return,&a,&observer); [line 29]\n NULLIFY(&a,false); [line 29]\n NULLIFY(&observer,false); [line 29]\n NULLIFY(&self,false); [line 29]\n " color=yellow style=filled] - 9 -> 12 ; -8 [label="8: DeclStmt \n n$3=_fun_CFLocaleCreate(0:struct __CFAllocator *,0:struct __CFString *) [line 25]\n *&nameRef:struct __CFLocale *=n$3 [line 25]\n REMOVE_TEMPS(n$3); [line 25]\n " shape="box"] + 11 -> 14 ; +10 [label="10: DeclStmt \n n$3=_fun_CFLocaleCreate(0:struct __CFAllocator *,0:struct __CFString *) [line 25]\n *&nameRef:struct __CFLocale *=n$3 [line 25]\n REMOVE_TEMPS(n$3); [line 25]\n " shape="box"] - 8 -> 7 ; -7 [label="7: DeclStmt \n n$2=*&nameRef:struct __CFLocale * [line 26]\n *&a:class NSLocale *=(struct __CFLocale *)n$2 [line 26]\n REMOVE_TEMPS(n$2); [line 26]\n NULLIFY(&a,false); [line 26]\n NULLIFY(&nameRef,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] + 10 -> 9 ; +9 [label="9: DeclStmt \n n$2=*&nameRef:struct __CFLocale * [line 26]\n *&a:class NSLocale *=(struct __CFLocale *)n$2 [line 26]\n REMOVE_TEMPS(n$2); [line 26]\n NULLIFY(&a,false); [line 26]\n NULLIFY(&nameRef,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] - 7 -> 6 ; -6 [label="6: Exit TollBridgeExample_bridge \n " color=yellow style=filled] + 9 -> 8 ; +8 [label="8: Exit TollBridgeExample_bridge \n " color=yellow style=filled] -5 [label="5: Start TollBridgeExample_bridge\nFormals: self:class TollBridgeExample *\nLocals: a:class NSLocale * nameRef:struct __CFLocale * \n DECLARE_LOCALS(&return,&a,&nameRef); [line 24]\n NULLIFY(&a,false); [line 24]\n NULLIFY(&nameRef,false); [line 24]\n NULLIFY(&self,false); [line 24]\n " color=yellow style=filled] +7 [label="7: Start TollBridgeExample_bridge\nFormals: self:class TollBridgeExample *\nLocals: a:class NSLocale * nameRef:struct __CFLocale * \n DECLARE_LOCALS(&return,&a,&nameRef); [line 24]\n NULLIFY(&a,false); [line 24]\n NULLIFY(&nameRef,false); [line 24]\n NULLIFY(&self,false); [line 24]\n " color=yellow style=filled] - 5 -> 8 ; -4 [label="4: DeclStmt \n n$1=_fun_CFLocaleCreate(0:struct __CFAllocator *,0:struct __CFString *) [line 20]\n *&nameRef:struct __CFLocale *=n$1 [line 20]\n REMOVE_TEMPS(n$1); [line 20]\n " shape="box"] + 7 -> 10 ; +6 [label="6: DeclStmt \n n$1=_fun_CFLocaleCreate(0:struct __CFAllocator *,0:struct __CFString *) [line 20]\n *&nameRef:struct __CFLocale *=n$1 [line 20]\n REMOVE_TEMPS(n$1); [line 20]\n " shape="box"] - 4 -> 3 ; -3 [label="3: DeclStmt \n n$0=*&nameRef:struct __CFLocale * [line 21]\n *&a:class NSLocale *=(struct __CFLocale *)n$0 [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n NULLIFY(&a,false); [line 21]\n NULLIFY(&nameRef,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] + 6 -> 5 ; +5 [label="5: DeclStmt \n n$0=*&nameRef:struct __CFLocale * [line 21]\n *&a:class NSLocale *=(struct __CFLocale *)n$0 [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n NULLIFY(&a,false); [line 21]\n NULLIFY(&nameRef,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit TollBridgeExample_bridgeTransfer \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit TollBridgeExample_bridgeTransfer \n " color=yellow style=filled] -1 [label="1: Start TollBridgeExample_bridgeTransfer\nFormals: self:class TollBridgeExample *\nLocals: a:class NSLocale * nameRef:struct __CFLocale * \n DECLARE_LOCALS(&return,&a,&nameRef); [line 19]\n NULLIFY(&a,false); [line 19]\n NULLIFY(&nameRef,false); [line 19]\n NULLIFY(&self,false); [line 19]\n " color=yellow style=filled] +3 [label="3: Start TollBridgeExample_bridgeTransfer\nFormals: self:class TollBridgeExample *\nLocals: a:class NSLocale * nameRef:struct __CFLocale * \n DECLARE_LOCALS(&return,&a,&nameRef); [line 19]\n NULLIFY(&a,false); [line 19]\n NULLIFY(&nameRef,false); [line 19]\n NULLIFY(&self,false); [line 19]\n " color=yellow style=filled] - 1 -> 4 ; + 3 -> 6 ; +2 [label="2: Exit TollBridgeExample_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start TollBridgeExample_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/arc_methods.dot b/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/arc_methods.dot index a61b92c81..84e15d776 100644 --- a/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/arc_methods.dot +++ b/infer/tests/codetoanalyze/objc/errors/memory_leaks_benchmark/arc_methods.dot @@ -1,59 +1,66 @@ digraph iCFG { -15 [label="15: DeclStmt \n n$3=_fun_A_newA() [line 42]\n *&a1:class A *=n$3 [line 42]\n REMOVE_TEMPS(n$3); [line 42]\n " shape="box"] +17 [label="17: DeclStmt \n n$3=_fun_A_newA() [line 42]\n *&a1:class A *=n$3 [line 42]\n REMOVE_TEMPS(n$3); [line 42]\n " shape="box"] + + + 17 -> 16 ; +16 [label="16: DeclStmt \n n$2=*&a1:class A * [line 43]\n _fun___objc_retain(n$2:class A *) [line 43]\n *&aa:class A *=n$2 [line 43]\n REMOVE_TEMPS(n$2); [line 43]\n NULLIFY(&a1,false); [line 43]\n NULLIFY(&aa,false); [line 43]\n " shape="box"] + + + 16 -> 15 ; +15 [label="15: DeclStmt \n n$1=_fun_A_someA() [line 44]\n _fun___objc_retain(n$1:class A *) [line 44]\n *&a2:class A *=n$1 [line 44]\n REMOVE_TEMPS(n$1); [line 44]\n " shape="box"] 15 -> 14 ; -14 [label="14: DeclStmt \n n$2=*&a1:class A * [line 43]\n _fun___objc_retain(n$2:class A *) [line 43]\n *&aa:class A *=n$2 [line 43]\n REMOVE_TEMPS(n$2); [line 43]\n NULLIFY(&a1,false); [line 43]\n NULLIFY(&aa,false); [line 43]\n " shape="box"] +14 [label="14: DeclStmt \n n$0=*&a2:class A * [line 45]\n _fun___objc_retain(n$0:class A *) [line 45]\n *&ab:class A *=n$0 [line 45]\n REMOVE_TEMPS(n$0); [line 45]\n NULLIFY(&a2,false); [line 45]\n NULLIFY(&ab,false); [line 45]\n " shape="box"] 14 -> 13 ; -13 [label="13: DeclStmt \n n$1=_fun_A_someA() [line 44]\n _fun___objc_retain(n$1:class A *) [line 44]\n *&a2:class A *=n$1 [line 44]\n REMOVE_TEMPS(n$1); [line 44]\n " shape="box"] +13 [label="13: Return Stmt \n *&return:int =0 [line 46]\n APPLY_ABSTRACTION; [line 46]\n " shape="box"] 13 -> 12 ; -12 [label="12: DeclStmt \n n$0=*&a2:class A * [line 45]\n _fun___objc_retain(n$0:class A *) [line 45]\n *&ab:class A *=n$0 [line 45]\n REMOVE_TEMPS(n$0); [line 45]\n NULLIFY(&a2,false); [line 45]\n NULLIFY(&ab,false); [line 45]\n " shape="box"] +12 [label="12: Exit main \n " color=yellow style=filled] - 12 -> 11 ; -11 [label="11: Return Stmt \n *&return:int =0 [line 46]\n APPLY_ABSTRACTION; [line 46]\n " shape="box"] +11 [label="11: Start main\nFormals: \nLocals: ab:class A * a2:class A * aa:class A * a1:class A * \n DECLARE_LOCALS(&return,&ab,&a2,&aa,&a1); [line 35]\n NULLIFY(&a1,false); [line 35]\n NULLIFY(&a2,false); [line 35]\n NULLIFY(&aa,false); [line 35]\n NULLIFY(&ab,false); [line 35]\n " color=yellow style=filled] - 11 -> 10 ; -10 [label="10: Exit main \n " color=yellow style=filled] + 11 -> 17 ; +10 [label="10: DeclStmt \n n$5=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 28]\n n$6=_fun_NSObject_init(n$5:class A *) virtual [line 28]\n *&a:class A *=n$6 [line 28]\n REMOVE_TEMPS(n$5,n$6); [line 28]\n " shape="box"] -9 [label="9: Start main\nFormals: \nLocals: ab:class A * a2:class A * aa:class A * a1:class A * \n DECLARE_LOCALS(&return,&ab,&a2,&aa,&a1); [line 35]\n NULLIFY(&a1,false); [line 35]\n NULLIFY(&a2,false); [line 35]\n NULLIFY(&aa,false); [line 35]\n NULLIFY(&ab,false); [line 35]\n " color=yellow style=filled] + 10 -> 9 ; +9 [label="9: Return Stmt \n n$3=*&a:class A * [line 30]\n *&return:class A *=n$3 [line 30]\n n$4=_fun___set_autorelease_attribute(n$3:class A *) [line 30]\n REMOVE_TEMPS(n$3,n$4); [line 30]\n NULLIFY(&a,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] - 9 -> 15 ; -8 [label="8: DeclStmt \n n$5=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 28]\n n$6=_fun_NSObject_init(n$5:class A *) virtual [line 28]\n *&a:class A *=n$6 [line 28]\n REMOVE_TEMPS(n$5,n$6); [line 28]\n " shape="box"] + 9 -> 8 ; +8 [label="8: Exit A_someA \n " color=yellow style=filled] - 8 -> 7 ; -7 [label="7: Return Stmt \n n$3=*&a:class A * [line 30]\n *&return:class A *=n$3 [line 30]\n n$4=_fun___set_autorelease_attribute(n$3:class A *) [line 30]\n REMOVE_TEMPS(n$3,n$4); [line 30]\n NULLIFY(&a,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] +7 [label="7: Start A_someA\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 27]\n NULLIFY(&a,false); [line 27]\n " color=yellow style=filled] - 7 -> 6 ; -6 [label="6: Exit A_someA \n " color=yellow style=filled] + 7 -> 10 ; +6 [label="6: DeclStmt \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 23]\n n$2=_fun_NSObject_init(n$1:class A *) virtual [line 23]\n *&a:class A *=n$2 [line 23]\n REMOVE_TEMPS(n$1,n$2); [line 23]\n " shape="box"] -5 [label="5: Start A_someA\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 27]\n NULLIFY(&a,false); [line 27]\n " color=yellow style=filled] + 6 -> 5 ; +5 [label="5: Return Stmt \n n$0=*&a:class A * [line 24]\n *&return:class A *=n$0 [line 24]\n REMOVE_TEMPS(n$0); [line 24]\n NULLIFY(&a,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] - 5 -> 8 ; -4 [label="4: DeclStmt \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 23]\n n$2=_fun_NSObject_init(n$1:class A *) virtual [line 23]\n *&a:class A *=n$2 [line 23]\n REMOVE_TEMPS(n$1,n$2); [line 23]\n " shape="box"] + 5 -> 4 ; +4 [label="4: Exit A_newA \n " color=yellow style=filled] - 4 -> 3 ; -3 [label="3: Return Stmt \n n$0=*&a:class A * [line 24]\n *&return:class A *=n$0 [line 24]\n REMOVE_TEMPS(n$0); [line 24]\n NULLIFY(&a,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] +3 [label="3: Start A_newA\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 22]\n NULLIFY(&a,false); [line 22]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit A_newA \n " color=yellow style=filled] + 3 -> 6 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start A_newA\nFormals: \nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 22]\n NULLIFY(&a,false); [line 22]\n " color=yellow style=filled] +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 4 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/errors/npe/Nonnull_attribute_example.dot b/infer/tests/codetoanalyze/objc/errors/npe/Nonnull_attribute_example.dot index 5c93dc972..bf2df6237 100644 --- a/infer/tests/codetoanalyze/objc/errors/npe/Nonnull_attribute_example.dot +++ b/infer/tests/codetoanalyze/objc/errors/npe/Nonnull_attribute_example.dot @@ -1,58 +1,65 @@ digraph iCFG { -15 [label="15: Call _fun___infer_assume \n n$1=*&callback:_fn_ (*) [line 46]\n n$2=_fun___infer_assume((n$1 != 0):_fn_ (*)) [line 46]\n REMOVE_TEMPS(n$1,n$2); [line 46]\n " shape="box"] +17 [label="17: Call _fun___infer_assume \n n$1=*&callback:_fn_ (*) [line 46]\n n$2=_fun___infer_assume((n$1 != 0):_fn_ (*)) [line 46]\n REMOVE_TEMPS(n$1,n$2); [line 46]\n " shape="box"] - 15 -> 14 ; -14 [label="14: Call n$0 \n n$0=*&callback:_fn_ (*) [line 46]\n n$0(0:class NSError *,0:struct objc_object *) [line 46]\n REMOVE_TEMPS(n$0); [line 46]\n NULLIFY(&callback,false); [line 46]\n APPLY_ABSTRACTION; [line 46]\n " shape="box"] + 17 -> 16 ; +16 [label="16: Call n$0 \n n$0=*&callback:_fn_ (*) [line 46]\n n$0(0:class NSError *,0:struct objc_object *) [line 46]\n REMOVE_TEMPS(n$0); [line 46]\n NULLIFY(&callback,false); [line 46]\n APPLY_ABSTRACTION; [line 46]\n " shape="box"] - 14 -> 13 ; -13 [label="13: Exit test \n " color=yellow style=filled] + 16 -> 15 ; +15 [label="15: Exit test \n " color=yellow style=filled] -12 [label="12: Start test\nFormals: callback:_fn_ (*)\nLocals: \n DECLARE_LOCALS(&return); [line 46]\n " color=yellow style=filled] +14 [label="14: Start test\nFormals: callback:_fn_ (*)\nLocals: \n DECLARE_LOCALS(&return); [line 46]\n " color=yellow style=filled] - 12 -> 15 ; -11 [label="11: Call _fun___infer_assume \n n$5=*&a:class A * [line 38]\n n$6=_fun___infer_assume((n$5 != 0):class A *) [line 38]\n REMOVE_TEMPS(n$5,n$6); [line 38]\n " shape="box"] + 14 -> 17 ; +13 [label="13: Call _fun___infer_assume \n n$5=*&a:class A * [line 38]\n n$6=_fun___infer_assume((n$5 != 0):class A *) [line 38]\n REMOVE_TEMPS(n$5,n$6); [line 38]\n " shape="box"] + + + 13 -> 12 ; +12 [label="12: DeclStmt \n n$3=*&a:class A * [line 39]\n n$4=_fun_A_getA(n$3:class A *) virtual [line 39]\n _fun___objc_retain(n$4:class A *) [line 39]\n *&a1:class A *=n$4 [line 39]\n REMOVE_TEMPS(n$3,n$4); [line 39]\n NULLIFY(&a,false); [line 39]\n " shape="box"] + + + 12 -> 11 ; +11 [label="11: DeclStmt \n n$1=*&a1:class A * [line 40]\n n$2=*n$1.x:int [line 40]\n *&y:int =n$2 [line 40]\n REMOVE_TEMPS(n$1,n$2); [line 40]\n NULLIFY(&a1,false); [line 40]\n NULLIFY(&y,false); [line 40]\n " shape="box"] 11 -> 10 ; -10 [label="10: DeclStmt \n n$3=*&a:class A * [line 39]\n n$4=_fun_A_getA(n$3:class A *) virtual [line 39]\n _fun___objc_retain(n$4:class A *) [line 39]\n *&a1:class A *=n$4 [line 39]\n REMOVE_TEMPS(n$3,n$4); [line 39]\n NULLIFY(&a,false); [line 39]\n " shape="box"] +10 [label="10: Return Stmt \n n$0=*&self:class C * [line 41]\n *&return:struct objc_object *=n$0 [line 41]\n REMOVE_TEMPS(n$0); [line 41]\n NULLIFY(&self,false); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] 10 -> 9 ; -9 [label="9: DeclStmt \n n$1=*&a1:class A * [line 40]\n n$2=*n$1.x:int [line 40]\n *&y:int =n$2 [line 40]\n REMOVE_TEMPS(n$1,n$2); [line 40]\n NULLIFY(&a1,false); [line 40]\n NULLIFY(&y,false); [line 40]\n " shape="box"] +9 [label="9: Exit C_initWithCoder:and: \n " color=yellow style=filled] - 9 -> 8 ; -8 [label="8: Return Stmt \n n$0=*&self:class C * [line 41]\n *&return:struct objc_object *=n$0 [line 41]\n REMOVE_TEMPS(n$0); [line 41]\n NULLIFY(&self,false); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] +8 [label="8: Start C_initWithCoder:and:\nFormals: self:class C * aDecoder:class NSString * a:class A *\nLocals: y:int a1:class A * \n DECLARE_LOCALS(&return,&y,&a1); [line 38]\n NULLIFY(&a1,false); [line 38]\n NULLIFY(&aDecoder,false); [line 38]\n NULLIFY(&y,false); [line 38]\n " color=yellow style=filled] - 8 -> 7 ; -7 [label="7: Exit C_initWithCoder:and: \n " color=yellow style=filled] + 8 -> 13 ; +7 [label="7: Exit C_frontendChecks \n " color=yellow style=filled] -6 [label="6: Start C_initWithCoder:and:\nFormals: self:class C * aDecoder:class NSString * a:class A *\nLocals: y:int a1:class A * \n DECLARE_LOCALS(&return,&y,&a1); [line 38]\n NULLIFY(&a1,false); [line 38]\n NULLIFY(&aDecoder,false); [line 38]\n NULLIFY(&y,false); [line 38]\n " color=yellow style=filled] +6 [label="6: Start C_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 6 -> 11 ; -5 [label="5: Exit C_frontendChecks \n " color=yellow style=filled] + 6 -> 7 ; +5 [label="5: Return Stmt \n n$0=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 26]\n n$1=_fun_NSObject_init(n$0:class A *) virtual [line 26]\n *&return:class A *=n$1 [line 26]\n n$2=_fun___set_autorelease_attribute(n$1:class A *) [line 26]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] -4 [label="4: Start C_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit A_getA \n " color=yellow style=filled] - 4 -> 5 ; -3 [label="3: Return Stmt \n n$0=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 26]\n n$1=_fun_NSObject_init(n$0:class A *) virtual [line 26]\n *&return:class A *=n$1 [line 26]\n n$2=_fun___set_autorelease_attribute(n$1:class A *) [line 26]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] +3 [label="3: Start A_getA\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 25]\n NULLIFY(&self,false); [line 25]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit A_getA \n " color=yellow style=filled] + 3 -> 5 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start A_getA\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 25]\n NULLIFY(&self,false); [line 25]\n " color=yellow style=filled] +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 3 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/errors/npe/npe_malloc.dot b/infer/tests/codetoanalyze/objc/errors/npe/npe_malloc.dot index ca1a7e105..42c532c07 100644 --- a/infer/tests/codetoanalyze/objc/errors/npe/npe_malloc.dot +++ b/infer/tests/codetoanalyze/objc/errors/npe/npe_malloc.dot @@ -1,21 +1,28 @@ digraph iCFG { -5 [label="5: DeclStmt \n n$2=_fun_malloc_no_fail(sizeof(struct Person ):struct Person ) [line 25]\n *&person:struct Person *=n$2 [line 25]\n REMOVE_TEMPS(n$2); [line 25]\n " shape="box"] +7 [label="7: DeclStmt \n n$2=_fun_malloc_no_fail(sizeof(struct Person ):struct Person ) [line 25]\n *&person:struct Person *=n$2 [line 25]\n REMOVE_TEMPS(n$2); [line 25]\n " shape="box"] + + + 7 -> 6 ; +6 [label="6: BinaryOperatorStmt: Assign \n n$1=*&person:struct Person * [line 26]\n *n$1.x:int =10 [line 26]\n REMOVE_TEMPS(n$1); [line 26]\n " shape="box"] + + + 6 -> 5 ; +5 [label="5: Return Stmt \n n$0=*&person:struct Person * [line 27]\n *&return:struct Person *=n$0 [line 27]\n REMOVE_TEMPS(n$0); [line 27]\n NULLIFY(&person,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] 5 -> 4 ; -4 [label="4: BinaryOperatorStmt: Assign \n n$1=*&person:struct Person * [line 26]\n *n$1.x:int =10 [line 26]\n REMOVE_TEMPS(n$1); [line 26]\n " shape="box"] +4 [label="4: Exit C_test \n " color=yellow style=filled] - 4 -> 3 ; -3 [label="3: Return Stmt \n n$0=*&person:struct Person * [line 27]\n *&return:struct Person *=n$0 [line 27]\n REMOVE_TEMPS(n$0); [line 27]\n NULLIFY(&person,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] +3 [label="3: Start C_test\nFormals: self:class C *\nLocals: person:struct Person * \n DECLARE_LOCALS(&return,&person); [line 24]\n NULLIFY(&person,false); [line 24]\n NULLIFY(&self,false); [line 24]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit C_test \n " color=yellow style=filled] + 3 -> 7 ; +2 [label="2: Exit C_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start C_test\nFormals: self:class C *\nLocals: person:struct Person * \n DECLARE_LOCALS(&return,&person); [line 24]\n NULLIFY(&person,false); [line 24]\n NULLIFY(&self,false); [line 24]\n " color=yellow style=filled] +1 [label="1: Start C_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 5 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/errors/registered_observer/ViewController2.m b/infer/tests/codetoanalyze/objc/errors/registered_observer/ViewController2.m new file mode 100644 index 000000000..1a3bc14ae --- /dev/null +++ b/infer/tests/codetoanalyze/objc/errors/registered_observer/ViewController2.m @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import +@interface ViewController : NSViewController +@end +@implementation ViewController + +- (instancetype)init { + if (self = [super init]) { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(fired) + name:@"some_notification" + object:nil]; + } + return self; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self + name:@"some_notification" + object:nil]; +} +@end diff --git a/infer/tests/codetoanalyze/objc/errors/registered_observer/ViewController3.m b/infer/tests/codetoanalyze/objc/errors/registered_observer/ViewController3.m new file mode 100644 index 000000000..c13d2f80a --- /dev/null +++ b/infer/tests/codetoanalyze/objc/errors/registered_observer/ViewController3.m @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2016 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +@interface ViewControllerError : NSViewController +@end +@implementation ViewControllerError + +- (instancetype)init { + if (self = [super init]) { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(fired) + name:@"some_notification" + object:nil]; + } + return self; +} +@end diff --git a/infer/tests/codetoanalyze/objc/frontend/block/BlockVar.dot b/infer/tests/codetoanalyze/objc/frontend/block/BlockVar.dot index d1fb4ab88..39e3ff6bf 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/BlockVar.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/BlockVar.dot @@ -1,76 +1,83 @@ digraph iCFG { -19 [label="19: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1); [line 19]\n n$10=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_BlockVar_navigateToURLInBackground______1 ):unsigned long ) [line 19]\n *&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1:class __objc_anonymous_block_BlockVar_navigateToURLInBackground______1 =n$10 [line 19]\n *&addBlock:_fn_ (*)=(_fun___objc_anonymous_block_BlockVar_navigateToURLInBackground______1) [line 19]\n REMOVE_TEMPS(n$10); [line 19]\n " shape="box"] +21 [label="21: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1); [line 19]\n n$10=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_BlockVar_navigateToURLInBackground______1 ):unsigned long ) [line 19]\n *&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1:class __objc_anonymous_block_BlockVar_navigateToURLInBackground______1 =n$10 [line 19]\n *&addBlock:_fn_ (*)=(_fun___objc_anonymous_block_BlockVar_navigateToURLInBackground______1) [line 19]\n REMOVE_TEMPS(n$10); [line 19]\n " shape="box"] - 19 -> 13 ; -18 [label="18: DeclStmt \n *&error:class NSError *=0 [line 20]\n NULLIFY(&error,false); [line 20]\n " shape="box"] + 21 -> 15 ; +20 [label="20: DeclStmt \n *&error:class NSError *=0 [line 20]\n NULLIFY(&error,false); [line 20]\n " shape="box"] + + + 20 -> 19 ; +19 [label="19: DeclStmt \n n$9=_fun_BlockVar_test() [line 21]\n *&res:int =n$9 [line 21]\n REMOVE_TEMPS(n$9); [line 21]\n " shape="box"] + + + 19 -> 18 ; +18 [label="18: Return Stmt \n n$6=*&a:int [line 22]\n n$7=*&b:int [line 22]\n n$8=*&res:int [line 22]\n *&return:int =((n$6 + n$7) + n$8) [line 22]\n REMOVE_TEMPS(n$6,n$7,n$8); [line 22]\n NULLIFY(&a,false); [line 22]\n NULLIFY(&b,false); [line 22]\n NULLIFY(&res,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] 18 -> 17 ; -17 [label="17: DeclStmt \n n$9=_fun_BlockVar_test() [line 21]\n *&res:int =n$9 [line 21]\n REMOVE_TEMPS(n$9); [line 21]\n " shape="box"] +17 [label="17: Exit __objc_anonymous_block_BlockVar_navigateToURLInBackground______1 \n " color=yellow style=filled] - 17 -> 16 ; -16 [label="16: Return Stmt \n n$6=*&a:int [line 22]\n n$7=*&b:int [line 22]\n n$8=*&res:int [line 22]\n *&return:int =((n$6 + n$7) + n$8) [line 22]\n REMOVE_TEMPS(n$6,n$7,n$8); [line 22]\n NULLIFY(&a,false); [line 22]\n NULLIFY(&b,false); [line 22]\n NULLIFY(&res,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] +16 [label="16: Start __objc_anonymous_block_BlockVar_navigateToURLInBackground______1\nFormals: a:int b:int \nLocals: res:int error:class NSError * \n DECLARE_LOCALS(&return,&res,&error); [line 19]\n NULLIFY(&error,false); [line 19]\n NULLIFY(&res,false); [line 19]\n " color=yellow style=filled] - 16 -> 15 ; -15 [label="15: Exit __objc_anonymous_block_BlockVar_navigateToURLInBackground______1 \n " color=yellow style=filled] + 16 -> 20 ; +15 [label="15: DeclStmt \n n$4=*&addBlock:_fn_ (*) [line 24]\n n$5=n$4(1:int ,2:int ) [line 24]\n *&x:int =n$5 [line 24]\n REMOVE_TEMPS(n$4,n$5); [line 24]\n NULLIFY(&addBlock,false); [line 24]\n " shape="box"] -14 [label="14: Start __objc_anonymous_block_BlockVar_navigateToURLInBackground______1\nFormals: a:int b:int \nLocals: res:int error:class NSError * \n DECLARE_LOCALS(&return,&res,&error); [line 19]\n NULLIFY(&error,false); [line 19]\n NULLIFY(&res,false); [line 19]\n " color=yellow style=filled] + 15 -> 14 ; +14 [label="14: DeclStmt \n *&p:int *=0 [line 25]\n " shape="box"] - 14 -> 18 ; -13 [label="13: DeclStmt \n n$4=*&addBlock:_fn_ (*) [line 24]\n n$5=n$4(1:int ,2:int ) [line 24]\n *&x:int =n$5 [line 24]\n REMOVE_TEMPS(n$4,n$5); [line 24]\n NULLIFY(&addBlock,false); [line 24]\n " shape="box"] + 14 -> 9 ; +13 [label="13: Return Stmt \n NULLIFY(&p,false); [line 29]\n n$3=*&x:int [line 29]\n *&return:int =n$3 [line 29]\n REMOVE_TEMPS(n$3); [line 29]\n NULLIFY(&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1,true); [line 29]\n NULLIFY(&x,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] - 13 -> 12 ; -12 [label="12: DeclStmt \n *&p:int *=0 [line 25]\n " shape="box"] + 13 -> 7 ; +12 [label="12: Return Stmt \n NULLIFY(&x,false); [line 27]\n n$1=*&p:int * [line 27]\n n$2=*n$1:int [line 27]\n *&return:int =n$2 [line 27]\n REMOVE_TEMPS(n$1,n$2); [line 27]\n NULLIFY(&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1,true); [line 27]\n NULLIFY(&p,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] 12 -> 7 ; -11 [label="11: Return Stmt \n NULLIFY(&p,false); [line 29]\n n$3=*&x:int [line 29]\n *&return:int =n$3 [line 29]\n REMOVE_TEMPS(n$3); [line 29]\n NULLIFY(&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1,true); [line 29]\n NULLIFY(&x,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] +11 [label="11: Prune (false branch) \n PRUNE(((n$0 == 8) == 0), false); [line 26]\n REMOVE_TEMPS(n$0); [line 26]\n " shape="invhouse"] - 11 -> 5 ; -10 [label="10: Return Stmt \n NULLIFY(&x,false); [line 27]\n n$1=*&p:int * [line 27]\n n$2=*n$1:int [line 27]\n *&return:int =n$2 [line 27]\n REMOVE_TEMPS(n$1,n$2); [line 27]\n NULLIFY(&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1,true); [line 27]\n NULLIFY(&p,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] + 11 -> 13 ; +10 [label="10: Prune (true branch) \n PRUNE(((n$0 == 8) != 0), true); [line 26]\n REMOVE_TEMPS(n$0); [line 26]\n " shape="invhouse"] - 10 -> 5 ; -9 [label="9: Prune (false branch) \n PRUNE(((n$0 == 8) == 0), false); [line 26]\n REMOVE_TEMPS(n$0); [line 26]\n " shape="invhouse"] + 10 -> 12 ; +9 [label="9: BinaryOperatorStmt: EQ \n n$0=*&x:int [line 26]\n " shape="box"] + 9 -> 10 ; 9 -> 11 ; -8 [label="8: Prune (true branch) \n PRUNE(((n$0 == 8) != 0), true); [line 26]\n REMOVE_TEMPS(n$0); [line 26]\n " shape="invhouse"] +8 [label="8: + \n NULLIFY(&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1,true); [line 26]\n NULLIFY(&addBlock,false); [line 26]\n NULLIFY(&p,false); [line 26]\n NULLIFY(&x,false); [line 26]\n " ] - 8 -> 10 ; -7 [label="7: BinaryOperatorStmt: EQ \n n$0=*&x:int [line 26]\n " shape="box"] + 8 -> 7 ; +7 [label="7: Exit BlockVar_navigateToURLInBackground \n " color=yellow style=filled] - 7 -> 8 ; - 7 -> 9 ; -6 [label="6: + \n NULLIFY(&__objc_anonymous_block_BlockVar_navigateToURLInBackground______1,true); [line 26]\n NULLIFY(&addBlock,false); [line 26]\n NULLIFY(&p,false); [line 26]\n NULLIFY(&x,false); [line 26]\n " ] +6 [label="6: Start BlockVar_navigateToURLInBackground\nFormals: \nLocals: p:int * x:int addBlock:_fn_ (*) \n DECLARE_LOCALS(&return,&p,&x,&addBlock); [line 18]\n NULLIFY(&addBlock,false); [line 18]\n NULLIFY(&p,false); [line 18]\n NULLIFY(&x,false); [line 18]\n " color=yellow style=filled] - 6 -> 5 ; -5 [label="5: Exit BlockVar_navigateToURLInBackground \n " color=yellow style=filled] + 6 -> 21 ; +5 [label="5: Return Stmt \n *&return:int =5 [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] -4 [label="4: Start BlockVar_navigateToURLInBackground\nFormals: \nLocals: p:int * x:int addBlock:_fn_ (*) \n DECLARE_LOCALS(&return,&p,&x,&addBlock); [line 18]\n NULLIFY(&addBlock,false); [line 18]\n NULLIFY(&p,false); [line 18]\n NULLIFY(&x,false); [line 18]\n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit BlockVar_test \n " color=yellow style=filled] - 4 -> 19 ; -3 [label="3: Return Stmt \n *&return:int =5 [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] +3 [label="3: Start BlockVar_test\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 14]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit BlockVar_test \n " color=yellow style=filled] + 3 -> 5 ; +2 [label="2: Exit BlockVar_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start BlockVar_test\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 14]\n " color=yellow style=filled] +1 [label="1: Start BlockVar_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 3 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/block/block-it.dot b/infer/tests/codetoanalyze/objc/frontend/block/block-it.dot index 248791575..ac6a46b41 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/block-it.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/block-it.dot @@ -1,212 +1,219 @@ digraph iCFG { -52 [label="52: DeclStmt \n n$44=_fun___objc_alloc_no_fail(sizeof(class NSArray ):unsigned long ) [line 34]\n n$45=_fun_NSArray_init(n$44:class NSArray *) virtual [line 34]\n *&a:class NSArray *=n$45 [line 34]\n REMOVE_TEMPS(n$44,n$45); [line 34]\n " shape="box"] +54 [label="54: DeclStmt \n n$44=_fun___objc_alloc_no_fail(sizeof(class NSArray ):unsigned long ) [line 34]\n n$45=_fun_NSArray_init(n$44:class NSArray *) virtual [line 34]\n *&a:class NSArray *=n$45 [line 34]\n REMOVE_TEMPS(n$44,n$45); [line 34]\n " shape="box"] - 52 -> 51 ; -51 [label="51: DeclStmt \n n$43=*&a:class NSArray * [line 36]\n *&objects:class NSArray *=n$43 [line 36]\n REMOVE_TEMPS(n$43); [line 36]\n NULLIFY(&a,false); [line 36]\n " shape="box"] + 54 -> 53 ; +53 [label="53: DeclStmt \n n$43=*&a:class NSArray * [line 36]\n *&objects:class NSArray *=n$43 [line 36]\n REMOVE_TEMPS(n$43); [line 36]\n NULLIFY(&a,false); [line 36]\n " shape="box"] - 51 -> 50 ; -50 [label="50: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_MyBlock_array_trans______2); [line 40]\n n$42=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_MyBlock_array_trans______2 ):unsigned long ) [line 40]\n *&__objc_anonymous_block_MyBlock_array_trans______2:class __objc_anonymous_block_MyBlock_array_trans______2 =n$42 [line 40]\n *&enumerateObjectsUsingBlock:_fn_ (*)=(_fun___objc_anonymous_block_MyBlock_array_trans______2) [line 40]\n REMOVE_TEMPS(n$42); [line 40]\n " shape="box"] + 53 -> 52 ; +52 [label="52: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_MyBlock_array_trans______2); [line 40]\n n$42=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_MyBlock_array_trans______2 ):unsigned long ) [line 40]\n *&__objc_anonymous_block_MyBlock_array_trans______2:class __objc_anonymous_block_MyBlock_array_trans______2 =n$42 [line 40]\n *&enumerateObjectsUsingBlock:_fn_ (*)=(_fun___objc_anonymous_block_MyBlock_array_trans______2) [line 40]\n REMOVE_TEMPS(n$42); [line 40]\n " shape="box"] - 50 -> 43 ; -49 [label="49: BinaryOperatorStmt: Assign \n NULLIFY(&ShouldStop,false); [line 45]\n n$41=*&stop:_Bool * [line 45]\n *n$41:_Bool =1 [line 45]\n REMOVE_TEMPS(n$41); [line 45]\n NULLIFY(&stop,false); [line 45]\n APPLY_ABSTRACTION; [line 45]\n " shape="box"] + 52 -> 45 ; +51 [label="51: BinaryOperatorStmt: Assign \n NULLIFY(&ShouldStop,false); [line 45]\n n$41=*&stop:_Bool * [line 45]\n *n$41:_Bool =1 [line 45]\n REMOVE_TEMPS(n$41); [line 45]\n NULLIFY(&stop,false); [line 45]\n APPLY_ABSTRACTION; [line 45]\n " shape="box"] - 49 -> 46 ; -48 [label="48: Prune (false branch) \n n$40=*&ShouldStop:int [line 44]\n PRUNE((n$40 == 0), false); [line 44]\n REMOVE_TEMPS(n$40); [line 44]\n APPLY_ABSTRACTION; [line 44]\n " shape="invhouse"] + 51 -> 48 ; +50 [label="50: Prune (false branch) \n n$40=*&ShouldStop:int [line 44]\n PRUNE((n$40 == 0), false); [line 44]\n REMOVE_TEMPS(n$40); [line 44]\n APPLY_ABSTRACTION; [line 44]\n " shape="invhouse"] - 48 -> 46 ; -47 [label="47: Prune (true branch) \n n$40=*&ShouldStop:int [line 44]\n PRUNE((n$40 != 0), true); [line 44]\n REMOVE_TEMPS(n$40); [line 44]\n " shape="invhouse"] + 50 -> 48 ; +49 [label="49: Prune (true branch) \n n$40=*&ShouldStop:int [line 44]\n PRUNE((n$40 != 0), true); [line 44]\n REMOVE_TEMPS(n$40); [line 44]\n " shape="invhouse"] - 47 -> 49 ; -46 [label="46: + \n NULLIFY(&ShouldStop,false); [line 44]\n NULLIFY(&stop,false); [line 44]\n " ] + 49 -> 51 ; +48 [label="48: + \n NULLIFY(&ShouldStop,false); [line 44]\n NULLIFY(&stop,false); [line 44]\n " ] - 46 -> 45 ; -45 [label="45: Exit __objc_anonymous_block_MyBlock_array_trans______2 \n " color=yellow style=filled] + 48 -> 47 ; +47 [label="47: Exit __objc_anonymous_block_MyBlock_array_trans______2 \n " color=yellow style=filled] -44 [label="44: Start __objc_anonymous_block_MyBlock_array_trans______2\nFormals: object:struct objc_object * idx:unsigned long stop:_Bool *\nLocals: ShouldStop:int \n DECLARE_LOCALS(&return,&ShouldStop); [line 40]\n NULLIFY(&idx,false); [line 40]\n NULLIFY(&object,false); [line 40]\n " color=yellow style=filled] +46 [label="46: Start __objc_anonymous_block_MyBlock_array_trans______2\nFormals: object:struct objc_object * idx:unsigned long stop:_Bool *\nLocals: ShouldStop:int \n DECLARE_LOCALS(&return,&ShouldStop); [line 40]\n NULLIFY(&idx,false); [line 40]\n NULLIFY(&object,false); [line 40]\n " color=yellow style=filled] - 44 -> 47 ; - 44 -> 48 ; -43 [label="43: DeclStmt \n n$39=_fun_malloc_no_fail(sizeof(_Bool ):_Bool ) [line 48]\n *&stop:_Bool *=n$39 [line 48]\n REMOVE_TEMPS(n$39); [line 48]\n " shape="box"] + 46 -> 49 ; + 46 -> 50 ; +45 [label="45: DeclStmt \n n$39=_fun_malloc_no_fail(sizeof(_Bool ):_Bool ) [line 48]\n *&stop:_Bool *=n$39 [line 48]\n REMOVE_TEMPS(n$39); [line 48]\n " shape="box"] + + + 45 -> 44 ; +44 [label="44: BinaryOperatorStmt: Assign \n n$38=*&stop:_Bool * [line 49]\n *n$38:_Bool =0 [line 49]\n REMOVE_TEMPS(n$38); [line 49]\n " shape="box"] + + + 44 -> 33 ; +43 [label="43: DeclStmt \n n$35=*&objects:class NSArray * [line 53]\n n$36=*&idx:unsigned long [line 53]\n n$37=_fun_NSArray_objectAtIndexedSubscript:(n$35:class NSArray *,n$36:unsigned long ) virtual [line 53]\n *&object:struct objc_object *=n$37 [line 53]\n REMOVE_TEMPS(n$35,n$36,n$37); [line 53]\n " shape="box"] 43 -> 42 ; -42 [label="42: BinaryOperatorStmt: Assign \n n$38=*&stop:_Bool * [line 49]\n *n$38:_Bool =0 [line 49]\n REMOVE_TEMPS(n$38); [line 49]\n " shape="box"] +42 [label="42: Call n$31 \n n$31=*&enumerateObjectsUsingBlock:_fn_ (*) [line 54]\n n$32=*&object:struct objc_object * [line 54]\n n$33=*&idx:unsigned long [line 54]\n n$34=*&stop:_Bool * [line 54]\n n$31(n$32:struct objc_object *,n$33:unsigned long ,n$34:_Bool *) [line 54]\n REMOVE_TEMPS(n$31,n$32,n$33,n$34); [line 54]\n NULLIFY(&object,false); [line 54]\n " shape="box"] - 42 -> 31 ; -41 [label="41: DeclStmt \n n$35=*&objects:class NSArray * [line 53]\n n$36=*&idx:unsigned long [line 53]\n n$37=_fun_NSArray_objectAtIndexedSubscript:(n$35:class NSArray *,n$36:unsigned long ) virtual [line 53]\n *&object:struct objc_object *=n$37 [line 53]\n REMOVE_TEMPS(n$35,n$36,n$37); [line 53]\n " shape="box"] + 42 -> 39 ; +41 [label="41: Prune (false branch) \n PRUNE(((n$30 == 1) == 0), false); [line 55]\n REMOVE_TEMPS(n$29,n$30); [line 55]\n " shape="invhouse"] - 41 -> 40 ; -40 [label="40: Call n$31 \n n$31=*&enumerateObjectsUsingBlock:_fn_ (*) [line 54]\n n$32=*&object:struct objc_object * [line 54]\n n$33=*&idx:unsigned long [line 54]\n n$34=*&stop:_Bool * [line 54]\n n$31(n$32:struct objc_object *,n$33:unsigned long ,n$34:_Bool *) [line 54]\n REMOVE_TEMPS(n$31,n$32,n$33,n$34); [line 54]\n NULLIFY(&object,false); [line 54]\n " shape="box"] + 41 -> 38 ; +40 [label="40: Prune (true branch) \n PRUNE(((n$30 == 1) != 0), true); [line 55]\n REMOVE_TEMPS(n$29,n$30); [line 55]\n APPLY_ABSTRACTION; [line 55]\n " shape="invhouse"] - 40 -> 37 ; -39 [label="39: Prune (false branch) \n PRUNE(((n$30 == 1) == 0), false); [line 55]\n REMOVE_TEMPS(n$29,n$30); [line 55]\n " shape="invhouse"] + 40 -> 31 ; +39 [label="39: BinaryOperatorStmt: EQ \n n$29=*&stop:_Bool * [line 55]\n n$30=*n$29:_Bool [line 55]\n " shape="box"] - 39 -> 36 ; -38 [label="38: Prune (true branch) \n PRUNE(((n$30 == 1) != 0), true); [line 55]\n REMOVE_TEMPS(n$29,n$30); [line 55]\n APPLY_ABSTRACTION; [line 55]\n " shape="invhouse"] + 39 -> 40 ; + 39 -> 41 ; +38 [label="38: + \n " ] - 38 -> 29 ; -37 [label="37: BinaryOperatorStmt: EQ \n n$29=*&stop:_Bool * [line 55]\n n$30=*n$29:_Bool [line 55]\n " shape="box"] + 38 -> 34 ; +37 [label="37: Prune (false branch) \n PRUNE(((n$26 < n$28) == 0), false); [line 51]\n REMOVE_TEMPS(n$26,n$27,n$28); [line 51]\n APPLY_ABSTRACTION; [line 51]\n " shape="invhouse"] - 37 -> 38 ; - 37 -> 39 ; -36 [label="36: + \n " ] + 37 -> 31 ; +36 [label="36: Prune (true branch) \n PRUNE(((n$26 < n$28) != 0), true); [line 51]\n REMOVE_TEMPS(n$26,n$27,n$28); [line 51]\n " shape="invhouse"] - 36 -> 32 ; -35 [label="35: Prune (false branch) \n PRUNE(((n$26 < n$28) == 0), false); [line 51]\n REMOVE_TEMPS(n$26,n$27,n$28); [line 51]\n APPLY_ABSTRACTION; [line 51]\n " shape="invhouse"] + 36 -> 43 ; +35 [label="35: BinaryOperatorStmt: LT \n n$26=*&idx:unsigned long [line 51]\n n$27=*&objects:class NSArray * [line 51]\n n$28=_fun_NSArray_count(n$27:class NSArray *) [line 51]\n " shape="box"] - 35 -> 29 ; -34 [label="34: Prune (true branch) \n PRUNE(((n$26 < n$28) != 0), true); [line 51]\n REMOVE_TEMPS(n$26,n$27,n$28); [line 51]\n " shape="invhouse"] + 35 -> 36 ; + 35 -> 37 ; +34 [label="34: UnaryOperator \n n$25=*&idx:unsigned long [line 51]\n *&idx:unsigned long =(n$25 + 1) [line 51]\n REMOVE_TEMPS(n$25); [line 51]\n APPLY_ABSTRACTION; [line 51]\n " shape="box"] - 34 -> 41 ; -33 [label="33: BinaryOperatorStmt: LT \n n$26=*&idx:unsigned long [line 51]\n n$27=*&objects:class NSArray * [line 51]\n n$28=_fun_NSArray_count(n$27:class NSArray *) [line 51]\n " shape="box"] + 34 -> 32 ; +33 [label="33: DeclStmt \n *&idx:unsigned long =0 [line 51]\n APPLY_ABSTRACTION; [line 51]\n " shape="box"] - 33 -> 34 ; - 33 -> 35 ; -32 [label="32: UnaryOperator \n n$25=*&idx:unsigned long [line 51]\n *&idx:unsigned long =(n$25 + 1) [line 51]\n REMOVE_TEMPS(n$25); [line 51]\n APPLY_ABSTRACTION; [line 51]\n " shape="box"] + 33 -> 32 ; +32 [label="32: + \n " ] - 32 -> 30 ; -31 [label="31: DeclStmt \n *&idx:unsigned long =0 [line 51]\n APPLY_ABSTRACTION; [line 51]\n " shape="box"] + 32 -> 35 ; +31 [label="31: Call _fun_free \n NULLIFY(&enumerateObjectsUsingBlock,false); [line 58]\n NULLIFY(&idx,false); [line 58]\n NULLIFY(&objects,false); [line 58]\n n$24=*&stop:_Bool * [line 58]\n _fun_free(n$24:void *) [line 58]\n REMOVE_TEMPS(n$24); [line 58]\n NULLIFY(&__objc_anonymous_block_MyBlock_array_trans______2,true); [line 58]\n NULLIFY(&stop,false); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] 31 -> 30 ; -30 [label="30: + \n " ] +30 [label="30: Exit MyBlock_array_trans \n " color=yellow style=filled] - 30 -> 33 ; -29 [label="29: Call _fun_free \n NULLIFY(&enumerateObjectsUsingBlock,false); [line 58]\n NULLIFY(&idx,false); [line 58]\n NULLIFY(&objects,false); [line 58]\n n$24=*&stop:_Bool * [line 58]\n _fun_free(n$24:void *) [line 58]\n REMOVE_TEMPS(n$24); [line 58]\n NULLIFY(&__objc_anonymous_block_MyBlock_array_trans______2,true); [line 58]\n NULLIFY(&stop,false); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] +29 [label="29: Start MyBlock_array_trans\nFormals: self:class MyBlock *\nLocals: idx:unsigned long object:struct objc_object * stop:_Bool * enumerateObjectsUsingBlock:_fn_ (*) objects:class NSArray * a:class NSArray * \n DECLARE_LOCALS(&return,&idx,&object,&stop,&enumerateObjectsUsingBlock,&objects,&a); [line 32]\n NULLIFY(&a,false); [line 32]\n NULLIFY(&enumerateObjectsUsingBlock,false); [line 32]\n NULLIFY(&idx,false); [line 32]\n NULLIFY(&object,false); [line 32]\n NULLIFY(&objects,false); [line 32]\n NULLIFY(&self,false); [line 32]\n NULLIFY(&stop,false); [line 32]\n " color=yellow style=filled] - 29 -> 28 ; -28 [label="28: Exit MyBlock_array_trans \n " color=yellow style=filled] + 29 -> 54 ; +28 [label="28: DeclStmt \n n$22=_fun___objc_alloc_no_fail(sizeof(class NSArray ):unsigned long ) [line 20]\n n$23=_fun_NSArray_init(n$22:class NSArray *) virtual [line 20]\n *&a:class NSArray *=n$23 [line 20]\n REMOVE_TEMPS(n$22,n$23); [line 20]\n " shape="box"] -27 [label="27: Start MyBlock_array_trans\nFormals: self:class MyBlock *\nLocals: idx:unsigned long object:struct objc_object * stop:_Bool * enumerateObjectsUsingBlock:_fn_ (*) objects:class NSArray * a:class NSArray * \n DECLARE_LOCALS(&return,&idx,&object,&stop,&enumerateObjectsUsingBlock,&objects,&a); [line 32]\n NULLIFY(&a,false); [line 32]\n NULLIFY(&enumerateObjectsUsingBlock,false); [line 32]\n NULLIFY(&idx,false); [line 32]\n NULLIFY(&object,false); [line 32]\n NULLIFY(&objects,false); [line 32]\n NULLIFY(&self,false); [line 32]\n NULLIFY(&stop,false); [line 32]\n " color=yellow style=filled] + 28 -> 27 ; +27 [label="27: DeclStmt \n n$21=*&a:class NSArray * [line 21]\n *&objects:class NSArray *=n$21 [line 21]\n REMOVE_TEMPS(n$21); [line 21]\n NULLIFY(&a,false); [line 21]\n " shape="box"] - 27 -> 52 ; -26 [label="26: DeclStmt \n n$22=_fun___objc_alloc_no_fail(sizeof(class NSArray ):unsigned long ) [line 20]\n n$23=_fun_NSArray_init(n$22:class NSArray *) virtual [line 20]\n *&a:class NSArray *=n$23 [line 20]\n REMOVE_TEMPS(n$22,n$23); [line 20]\n " shape="box"] + 27 -> 26 ; +26 [label="26: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_MyBlock_array______1); [line 21]\n n$20=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_MyBlock_array______1 ):unsigned long ) [line 21]\n *&__objc_anonymous_block_MyBlock_array______1:class __objc_anonymous_block_MyBlock_array______1 =n$20 [line 21]\n *&infer___objc_anonymous_block_MyBlock_array______1:_fn_ (*)=(_fun___objc_anonymous_block_MyBlock_array______1) [line 21]\n REMOVE_TEMPS(n$20); [line 21]\n " shape="box"] - 26 -> 25 ; -25 [label="25: DeclStmt \n n$21=*&a:class NSArray * [line 21]\n *&objects:class NSArray *=n$21 [line 21]\n REMOVE_TEMPS(n$21); [line 21]\n NULLIFY(&a,false); [line 21]\n " shape="box"] + 26 -> 19 ; +25 [label="25: BinaryOperatorStmt: Assign \n NULLIFY(&ShouldStop,false); [line 27]\n n$19=*&stop:_Bool * [line 27]\n *n$19:_Bool =1 [line 27]\n REMOVE_TEMPS(n$19); [line 27]\n NULLIFY(&stop,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] - 25 -> 24 ; -24 [label="24: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_MyBlock_array______1); [line 21]\n n$20=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_MyBlock_array______1 ):unsigned long ) [line 21]\n *&__objc_anonymous_block_MyBlock_array______1:class __objc_anonymous_block_MyBlock_array______1 =n$20 [line 21]\n *&infer___objc_anonymous_block_MyBlock_array______1:_fn_ (*)=(_fun___objc_anonymous_block_MyBlock_array______1) [line 21]\n REMOVE_TEMPS(n$20); [line 21]\n " shape="box"] + 25 -> 22 ; +24 [label="24: Prune (false branch) \n n$18=*&ShouldStop:int [line 26]\n PRUNE((n$18 == 0), false); [line 26]\n REMOVE_TEMPS(n$18); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="invhouse"] - 24 -> 17 ; -23 [label="23: BinaryOperatorStmt: Assign \n NULLIFY(&ShouldStop,false); [line 27]\n n$19=*&stop:_Bool * [line 27]\n *n$19:_Bool =1 [line 27]\n REMOVE_TEMPS(n$19); [line 27]\n NULLIFY(&stop,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] + 24 -> 22 ; +23 [label="23: Prune (true branch) \n n$18=*&ShouldStop:int [line 26]\n PRUNE((n$18 != 0), true); [line 26]\n REMOVE_TEMPS(n$18); [line 26]\n " shape="invhouse"] - 23 -> 20 ; -22 [label="22: Prune (false branch) \n n$18=*&ShouldStop:int [line 26]\n PRUNE((n$18 == 0), false); [line 26]\n REMOVE_TEMPS(n$18); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="invhouse"] + 23 -> 25 ; +22 [label="22: + \n NULLIFY(&ShouldStop,false); [line 26]\n NULLIFY(&stop,false); [line 26]\n " ] - 22 -> 20 ; -21 [label="21: Prune (true branch) \n n$18=*&ShouldStop:int [line 26]\n PRUNE((n$18 != 0), true); [line 26]\n REMOVE_TEMPS(n$18); [line 26]\n " shape="invhouse"] + 22 -> 21 ; +21 [label="21: Exit __objc_anonymous_block_MyBlock_array______1 \n " color=yellow style=filled] - 21 -> 23 ; -20 [label="20: + \n NULLIFY(&ShouldStop,false); [line 26]\n NULLIFY(&stop,false); [line 26]\n " ] +20 [label="20: Start __objc_anonymous_block_MyBlock_array______1\nFormals: object:struct objc_object * idx:unsigned long stop:_Bool *\nLocals: ShouldStop:int \n DECLARE_LOCALS(&return,&ShouldStop); [line 21]\n NULLIFY(&idx,false); [line 21]\n NULLIFY(&object,false); [line 21]\n " color=yellow style=filled] - 20 -> 19 ; -19 [label="19: Exit __objc_anonymous_block_MyBlock_array______1 \n " color=yellow style=filled] + 20 -> 23 ; + 20 -> 24 ; +19 [label="19: DeclStmt \n n$17=_fun_malloc_no_fail(sizeof(signed char ):signed char ) [line 21]\n *&stop:_Bool *=n$17 [line 21]\n REMOVE_TEMPS(n$17); [line 21]\n " shape="box"] -18 [label="18: Start __objc_anonymous_block_MyBlock_array______1\nFormals: object:struct objc_object * idx:unsigned long stop:_Bool *\nLocals: ShouldStop:int \n DECLARE_LOCALS(&return,&ShouldStop); [line 21]\n NULLIFY(&idx,false); [line 21]\n NULLIFY(&object,false); [line 21]\n " color=yellow style=filled] + 19 -> 18 ; +18 [label="18: BinaryOperatorStmt: Assign \n n$16=*&stop:_Bool * [line 21]\n *n$16:void =0 [line 21]\n REMOVE_TEMPS(n$16); [line 21]\n " shape="box"] - 18 -> 21 ; - 18 -> 22 ; -17 [label="17: DeclStmt \n n$17=_fun_malloc_no_fail(sizeof(signed char ):signed char ) [line 21]\n *&stop:_Bool *=n$17 [line 21]\n REMOVE_TEMPS(n$17); [line 21]\n " shape="box"] + 18 -> 7 ; +17 [label="17: DeclStmt \n n$13=*&objects:class NSArray * [line 21]\n n$14=*&idx:unsigned long [line 21]\n n$15=_fun_NSArray_objectAtIndexedSubscript:(n$13:class NSArray *,n$14:unsigned long ) virtual [line 21]\n *&object:struct objc_object *=n$15 [line 21]\n REMOVE_TEMPS(n$13,n$14,n$15); [line 21]\n NULLIFY(&object,false); [line 21]\n " shape="box"] 17 -> 16 ; -16 [label="16: BinaryOperatorStmt: Assign \n n$16=*&stop:_Bool * [line 21]\n *n$16:void =0 [line 21]\n REMOVE_TEMPS(n$16); [line 21]\n " shape="box"] +16 [label="16: Call n$8 \n n$8=*&infer___objc_anonymous_block_MyBlock_array______1:_fn_ (*) [line 21]\n n$9=*&object:struct objc_object * [line 21]\n n$10=*&idx:unsigned long [line 21]\n n$11=*&stop:_Bool * [line 21]\n n$12=n$8(n$9:struct objc_object *,n$10:unsigned long ,n$11:_Bool *) [line 21]\n REMOVE_TEMPS(n$8,n$9,n$10,n$11,n$12); [line 21]\n " shape="box"] - 16 -> 5 ; -15 [label="15: DeclStmt \n n$13=*&objects:class NSArray * [line 21]\n n$14=*&idx:unsigned long [line 21]\n n$15=_fun_NSArray_objectAtIndexedSubscript:(n$13:class NSArray *,n$14:unsigned long ) virtual [line 21]\n *&object:struct objc_object *=n$15 [line 21]\n REMOVE_TEMPS(n$13,n$14,n$15); [line 21]\n NULLIFY(&object,false); [line 21]\n " shape="box"] + 16 -> 13 ; +15 [label="15: Prune (false branch) \n n$7=*n$6:signed char [line 21]\n PRUNE((n$7 == 0), false); [line 21]\n REMOVE_TEMPS(n$6,n$7); [line 21]\n " shape="invhouse"] - 15 -> 14 ; -14 [label="14: Call n$8 \n n$8=*&infer___objc_anonymous_block_MyBlock_array______1:_fn_ (*) [line 21]\n n$9=*&object:struct objc_object * [line 21]\n n$10=*&idx:unsigned long [line 21]\n n$11=*&stop:_Bool * [line 21]\n n$12=n$8(n$9:struct objc_object *,n$10:unsigned long ,n$11:_Bool *) [line 21]\n REMOVE_TEMPS(n$8,n$9,n$10,n$11,n$12); [line 21]\n " shape="box"] + 15 -> 12 ; +14 [label="14: Prune (true branch) \n n$7=*n$6:signed char [line 21]\n PRUNE((n$7 != 0), true); [line 21]\n REMOVE_TEMPS(n$6,n$7); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="invhouse"] - 14 -> 11 ; -13 [label="13: Prune (false branch) \n n$7=*n$6:signed char [line 21]\n PRUNE((n$7 == 0), false); [line 21]\n REMOVE_TEMPS(n$6,n$7); [line 21]\n " shape="invhouse"] + 14 -> 5 ; +13 [label="13: UnaryOperator \n n$6=*&stop:_Bool * [line 21]\n " shape="box"] - 13 -> 10 ; -12 [label="12: Prune (true branch) \n n$7=*n$6:signed char [line 21]\n PRUNE((n$7 != 0), true); [line 21]\n REMOVE_TEMPS(n$6,n$7); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="invhouse"] + 13 -> 14 ; + 13 -> 15 ; +12 [label="12: + \n " ] - 12 -> 3 ; -11 [label="11: UnaryOperator \n n$6=*&stop:_Bool * [line 21]\n " shape="box"] + 12 -> 8 ; +11 [label="11: Prune (false branch) \n PRUNE(((n$3 < n$5) == 0), false); [line 21]\n REMOVE_TEMPS(n$3,n$4,n$5); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="invhouse"] - 11 -> 12 ; - 11 -> 13 ; -10 [label="10: + \n " ] + 11 -> 5 ; +10 [label="10: Prune (true branch) \n PRUNE(((n$3 < n$5) != 0), true); [line 21]\n REMOVE_TEMPS(n$3,n$4,n$5); [line 21]\n " shape="invhouse"] - 10 -> 6 ; -9 [label="9: Prune (false branch) \n PRUNE(((n$3 < n$5) == 0), false); [line 21]\n REMOVE_TEMPS(n$3,n$4,n$5); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="invhouse"] + 10 -> 17 ; +9 [label="9: BinaryOperatorStmt: LT \n n$3=*&idx:unsigned long [line 21]\n n$4=*&objects:class NSArray * [line 21]\n n$5=_fun_NSArray_count(n$4:class NSArray *) virtual [line 21]\n " shape="box"] - 9 -> 3 ; -8 [label="8: Prune (true branch) \n PRUNE(((n$3 < n$5) != 0), true); [line 21]\n REMOVE_TEMPS(n$3,n$4,n$5); [line 21]\n " shape="invhouse"] + 9 -> 10 ; + 9 -> 11 ; +8 [label="8: UnaryOperator \n n$2=*&idx:unsigned long [line 21]\n *&idx:unsigned long =(n$2 + 1) [line 21]\n REMOVE_TEMPS(n$2); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] - 8 -> 15 ; -7 [label="7: BinaryOperatorStmt: LT \n n$3=*&idx:unsigned long [line 21]\n n$4=*&objects:class NSArray * [line 21]\n n$5=_fun_NSArray_count(n$4:class NSArray *) virtual [line 21]\n " shape="box"] + 8 -> 6 ; +7 [label="7: DeclStmt \n *&idx:unsigned long =0 [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] - 7 -> 8 ; - 7 -> 9 ; -6 [label="6: UnaryOperator \n n$2=*&idx:unsigned long [line 21]\n *&idx:unsigned long =(n$2 + 1) [line 21]\n REMOVE_TEMPS(n$2); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] + 7 -> 6 ; +6 [label="6: + \n " ] - 6 -> 4 ; -5 [label="5: DeclStmt \n *&idx:unsigned long =0 [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] + 6 -> 9 ; +5 [label="5: Call _fun_free \n NULLIFY(&idx,false); [line 21]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,false); [line 21]\n NULLIFY(&objects,false); [line 21]\n n$0=*&stop:_Bool * [line 21]\n n$1=_fun_free(n$0:void *) [line 21]\n NULLIFY(&object,true); [line 21]\n NULLIFY(&idx,true); [line 21]\n NULLIFY(&stop,true); [line 21]\n NULLIFY(&objects,true); [line 21]\n REMOVE_TEMPS(n$0,n$1); [line 21]\n NULLIFY(&__objc_anonymous_block_MyBlock_array______1,true); [line 21]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,true); [line 21]\n NULLIFY(&idx,false); [line 21]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,false); [line 21]\n NULLIFY(&objects,false); [line 21]\n NULLIFY(&stop,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] 5 -> 4 ; -4 [label="4: + \n " ] +4 [label="4: Exit MyBlock_array \n " color=yellow style=filled] - 4 -> 7 ; -3 [label="3: Call _fun_free \n NULLIFY(&idx,false); [line 21]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,false); [line 21]\n NULLIFY(&objects,false); [line 21]\n n$0=*&stop:_Bool * [line 21]\n n$1=_fun_free(n$0:void *) [line 21]\n NULLIFY(&object,true); [line 21]\n NULLIFY(&idx,true); [line 21]\n NULLIFY(&stop,true); [line 21]\n NULLIFY(&objects,true); [line 21]\n REMOVE_TEMPS(n$0,n$1); [line 21]\n NULLIFY(&__objc_anonymous_block_MyBlock_array______1,true); [line 21]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,true); [line 21]\n NULLIFY(&idx,false); [line 21]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,false); [line 21]\n NULLIFY(&objects,false); [line 21]\n NULLIFY(&stop,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] +3 [label="3: Start MyBlock_array\nFormals: self:class MyBlock *\nLocals: idx:unsigned long object:struct objc_object * stop:_Bool * infer___objc_anonymous_block_MyBlock_array______1:_fn_ (*) objects:class NSArray * a:class NSArray * \n DECLARE_LOCALS(&return,&idx,&object,&stop,&infer___objc_anonymous_block_MyBlock_array______1,&objects,&a); [line 18]\n NULLIFY(&a,false); [line 18]\n NULLIFY(&idx,false); [line 18]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,false); [line 18]\n NULLIFY(&object,false); [line 18]\n NULLIFY(&objects,false); [line 18]\n NULLIFY(&self,false); [line 18]\n NULLIFY(&stop,false); [line 18]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit MyBlock_array \n " color=yellow style=filled] + 3 -> 28 ; +2 [label="2: Exit MyBlock_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start MyBlock_array\nFormals: self:class MyBlock *\nLocals: idx:unsigned long object:struct objc_object * stop:_Bool * infer___objc_anonymous_block_MyBlock_array______1:_fn_ (*) objects:class NSArray * a:class NSArray * \n DECLARE_LOCALS(&return,&idx,&object,&stop,&infer___objc_anonymous_block_MyBlock_array______1,&objects,&a); [line 18]\n NULLIFY(&a,false); [line 18]\n NULLIFY(&idx,false); [line 18]\n NULLIFY(&infer___objc_anonymous_block_MyBlock_array______1,false); [line 18]\n NULLIFY(&object,false); [line 18]\n NULLIFY(&objects,false); [line 18]\n NULLIFY(&self,false); [line 18]\n NULLIFY(&stop,false); [line 18]\n " color=yellow style=filled] +1 [label="1: Start MyBlock_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 26 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/block/block_no_args.dot b/infer/tests/codetoanalyze/objc/frontend/block/block_no_args.dot index cf450798c..4a90c63b4 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/block_no_args.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/block_no_args.dot @@ -1,65 +1,72 @@ digraph iCFG { -16 [label="16: BinaryOperatorStmt: Assign \n *&#GB$g:int =7 [line 22]\n " shape="box"] +18 [label="18: BinaryOperatorStmt: Assign \n *&#GB$g:int =7 [line 22]\n " shape="box"] - 16 -> 15 ; -15 [label="15: DeclStmt \n *&z:int =3 [line 24]\n " shape="box"] + 18 -> 17 ; +17 [label="17: DeclStmt \n *&z:int =3 [line 24]\n " shape="box"] + + + 17 -> 16 ; +16 [label="16: BinaryOperatorStmt: Assign \n DECLARE_LOCALS(&__objc_anonymous_block_My_manager_m______1); [line 25]\n n$7=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_My_manager_m______1 ):unsigned long ) [line 25]\n *&__objc_anonymous_block_My_manager_m______1:class __objc_anonymous_block_My_manager_m______1 =n$7 [line 25]\n n$8=*&z:int [line 25]\n n$9=*&#GB$g:int [line 25]\n *n$7.z:int =n$8 [line 25]\n *n$7.g:int =n$9 [line 25]\n n$5=*&z:int [line 25]\n *&b:_fn_ (*)=(_fun___objc_anonymous_block_My_manager_m______1,n$5) [line 25]\n REMOVE_TEMPS(n$7,n$8,n$9,n$5); [line 25]\n " shape="box"] + + + 16 -> 12 ; +15 [label="15: BinaryOperatorStmt: Assign \n n$6=*&z:int [line 26]\n *&#GB$g:int =(n$6 + 3) [line 26]\n REMOVE_TEMPS(n$6); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] 15 -> 14 ; -14 [label="14: BinaryOperatorStmt: Assign \n DECLARE_LOCALS(&__objc_anonymous_block_My_manager_m______1); [line 25]\n n$7=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_My_manager_m______1 ):unsigned long ) [line 25]\n *&__objc_anonymous_block_My_manager_m______1:class __objc_anonymous_block_My_manager_m______1 =n$7 [line 25]\n n$8=*&z:int [line 25]\n n$9=*&#GB$g:int [line 25]\n *n$7.z:int =n$8 [line 25]\n *n$7.g:int =n$9 [line 25]\n n$5=*&z:int [line 25]\n *&b:_fn_ (*)=(_fun___objc_anonymous_block_My_manager_m______1,n$5) [line 25]\n REMOVE_TEMPS(n$7,n$8,n$9,n$5); [line 25]\n " shape="box"] +14 [label="14: Exit __objc_anonymous_block_My_manager_m______1 \n " color=yellow style=filled] - 14 -> 10 ; -13 [label="13: BinaryOperatorStmt: Assign \n n$6=*&z:int [line 26]\n *&#GB$g:int =(n$6 + 3) [line 26]\n REMOVE_TEMPS(n$6); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] +13 [label="13: Start __objc_anonymous_block_My_manager_m______1\nFormals: z:int \nLocals: \nCaptured: z:int \n DECLARE_LOCALS(&return); [line 25]\n " color=yellow style=filled] - 13 -> 12 ; -12 [label="12: Exit __objc_anonymous_block_My_manager_m______1 \n " color=yellow style=filled] + 13 -> 15 ; +12 [label="12: Call n$4 \n n$4=*&b:_fn_ (*) [line 28]\n n$4() [line 28]\n REMOVE_TEMPS(n$4); [line 28]\n NULLIFY(&b,false); [line 28]\n " shape="box"] -11 [label="11: Start __objc_anonymous_block_My_manager_m______1\nFormals: z:int \nLocals: \nCaptured: z:int \n DECLARE_LOCALS(&return); [line 25]\n " color=yellow style=filled] + 12 -> 11 ; +11 [label="11: DeclStmt \n *&p:int *=0 [line 29]\n " shape="box"] - 11 -> 13 ; -10 [label="10: Call n$4 \n n$4=*&b:_fn_ (*) [line 28]\n n$4() [line 28]\n REMOVE_TEMPS(n$4); [line 28]\n NULLIFY(&b,false); [line 28]\n " shape="box"] + 11 -> 6 ; +10 [label="10: Return Stmt \n NULLIFY(&p,false); [line 33]\n n$3=*&z:int [line 33]\n *&return:int =n$3 [line 33]\n REMOVE_TEMPS(n$3); [line 33]\n NULLIFY(&__objc_anonymous_block_My_manager_m______1,true); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] - 10 -> 9 ; -9 [label="9: DeclStmt \n *&p:int *=0 [line 29]\n " shape="box"] + 10 -> 4 ; +9 [label="9: Return Stmt \n n$1=*&p:int * [line 31]\n n$2=*n$1:int [line 31]\n *&return:int =n$2 [line 31]\n REMOVE_TEMPS(n$1,n$2); [line 31]\n NULLIFY(&__objc_anonymous_block_My_manager_m______1,true); [line 31]\n NULLIFY(&p,false); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] 9 -> 4 ; -8 [label="8: Return Stmt \n NULLIFY(&p,false); [line 33]\n n$3=*&z:int [line 33]\n *&return:int =n$3 [line 33]\n REMOVE_TEMPS(n$3); [line 33]\n NULLIFY(&__objc_anonymous_block_My_manager_m______1,true); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] +8 [label="8: Prune (false branch) \n PRUNE(((n$0 == 6) == 0), false); [line 30]\n REMOVE_TEMPS(n$0); [line 30]\n " shape="invhouse"] - 8 -> 2 ; -7 [label="7: Return Stmt \n n$1=*&p:int * [line 31]\n n$2=*n$1:int [line 31]\n *&return:int =n$2 [line 31]\n REMOVE_TEMPS(n$1,n$2); [line 31]\n NULLIFY(&__objc_anonymous_block_My_manager_m______1,true); [line 31]\n NULLIFY(&p,false); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] + 8 -> 10 ; +7 [label="7: Prune (true branch) \n PRUNE(((n$0 == 6) != 0), true); [line 30]\n REMOVE_TEMPS(n$0); [line 30]\n " shape="invhouse"] - 7 -> 2 ; -6 [label="6: Prune (false branch) \n PRUNE(((n$0 == 6) == 0), false); [line 30]\n REMOVE_TEMPS(n$0); [line 30]\n " shape="invhouse"] + 7 -> 9 ; +6 [label="6: BinaryOperatorStmt: EQ \n n$0=*&#GB$g:int [line 30]\n " shape="box"] + 6 -> 7 ; 6 -> 8 ; -5 [label="5: Prune (true branch) \n PRUNE(((n$0 == 6) != 0), true); [line 30]\n REMOVE_TEMPS(n$0); [line 30]\n " shape="invhouse"] +5 [label="5: + \n NULLIFY(&__objc_anonymous_block_My_manager_m______1,true); [line 30]\n NULLIFY(&b,false); [line 30]\n NULLIFY(&p,false); [line 30]\n NULLIFY(&self,false); [line 30]\n " ] - 5 -> 7 ; -4 [label="4: BinaryOperatorStmt: EQ \n n$0=*&#GB$g:int [line 30]\n " shape="box"] + 5 -> 4 ; +4 [label="4: Exit My_manager_m \n " color=yellow style=filled] - 4 -> 5 ; - 4 -> 6 ; -3 [label="3: + \n NULLIFY(&__objc_anonymous_block_My_manager_m______1,true); [line 30]\n NULLIFY(&b,false); [line 30]\n NULLIFY(&p,false); [line 30]\n NULLIFY(&self,false); [line 30]\n " ] +3 [label="3: Start My_manager_m\nFormals: self:class My_manager *\nLocals: p:int * z:int b:_fn_ (*) \n DECLARE_LOCALS(&return,&p,&z,&b); [line 21]\n NULLIFY(&b,false); [line 21]\n NULLIFY(&p,false); [line 21]\n NULLIFY(&self,false); [line 21]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit My_manager_m \n " color=yellow style=filled] + 3 -> 18 ; +2 [label="2: Exit My_manager_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start My_manager_m\nFormals: self:class My_manager *\nLocals: p:int * z:int b:_fn_ (*) \n DECLARE_LOCALS(&return,&p,&z,&b); [line 21]\n NULLIFY(&b,false); [line 21]\n NULLIFY(&p,false); [line 21]\n NULLIFY(&self,false); [line 21]\n " color=yellow style=filled] +1 [label="1: Start My_manager_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 16 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/block/dispatch_examples.dot b/infer/tests/codetoanalyze/objc/frontend/block/dispatch_examples.dot index 5f638b1e5..8520d4057 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/dispatch_examples.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/dispatch_examples.dot @@ -1,230 +1,237 @@ digraph iCFG { -60 [label="60: DeclStmt \n *&#GB$A_dispatch_barrier_example_a:class A *=0 [line 72]\n " shape="box"] +62 [label="62: DeclStmt \n *&#GB$A_dispatch_barrier_example_a:class A *=0 [line 72]\n " shape="box"] + + + 62 -> 61 ; +61 [label="61: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_barrier_example______6); [line 73]\n n$52=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_barrier_example______6 ):unsigned long ) [line 73]\n *&__objc_anonymous_block_A_dispatch_barrier_example______6:class __objc_anonymous_block_A_dispatch_barrier_example______6 =n$52 [line 73]\n n$53=*&#GB$A_dispatch_barrier_example_a:class A * [line 73]\n *n$52.A_dispatch_barrier_example_a:class A *=n$53 [line 73]\n *&infer___objc_anonymous_block_A_dispatch_barrier_example______6:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_barrier_example______6) [line 73]\n REMOVE_TEMPS(n$52,n$53); [line 73]\n " shape="box"] + + + 61 -> 56 ; +60 [label="60: BinaryOperatorStmt: Assign \n n$50=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 74]\n n$51=_fun_NSObject_init(n$50:class A *) virtual [line 74]\n *&#GB$A_dispatch_barrier_example_a:class A *=n$51 [line 74]\n REMOVE_TEMPS(n$50,n$51); [line 74]\n " shape="box"] 60 -> 59 ; -59 [label="59: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_barrier_example______6); [line 73]\n n$52=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_barrier_example______6 ):unsigned long ) [line 73]\n *&__objc_anonymous_block_A_dispatch_barrier_example______6:class __objc_anonymous_block_A_dispatch_barrier_example______6 =n$52 [line 73]\n n$53=*&#GB$A_dispatch_barrier_example_a:class A * [line 73]\n *n$52.A_dispatch_barrier_example_a:class A *=n$53 [line 73]\n *&infer___objc_anonymous_block_A_dispatch_barrier_example______6:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_barrier_example______6) [line 73]\n REMOVE_TEMPS(n$52,n$53); [line 73]\n " shape="box"] +59 [label="59: BinaryOperatorStmt: Assign \n n$49=*&#GB$A_dispatch_barrier_example_a:class A * [line 75]\n *n$49.x:int =10 [line 75]\n REMOVE_TEMPS(n$49); [line 75]\n APPLY_ABSTRACTION; [line 75]\n " shape="box"] - 59 -> 54 ; -58 [label="58: BinaryOperatorStmt: Assign \n n$50=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 74]\n n$51=_fun_NSObject_init(n$50:class A *) virtual [line 74]\n *&#GB$A_dispatch_barrier_example_a:class A *=n$51 [line 74]\n REMOVE_TEMPS(n$50,n$51); [line 74]\n " shape="box"] + 59 -> 58 ; +58 [label="58: Exit __objc_anonymous_block_A_dispatch_barrier_example______6 \n " color=yellow style=filled] - 58 -> 57 ; -57 [label="57: BinaryOperatorStmt: Assign \n n$49=*&#GB$A_dispatch_barrier_example_a:class A * [line 75]\n *n$49.x:int =10 [line 75]\n REMOVE_TEMPS(n$49); [line 75]\n APPLY_ABSTRACTION; [line 75]\n " shape="box"] +57 [label="57: Start __objc_anonymous_block_A_dispatch_barrier_example______6\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 73]\n " color=yellow style=filled] - 57 -> 56 ; -56 [label="56: Exit __objc_anonymous_block_A_dispatch_barrier_example______6 \n " color=yellow style=filled] + 57 -> 60 ; +56 [label="56: Call n$47 \n n$47=*&infer___objc_anonymous_block_A_dispatch_barrier_example______6:_fn_ (*) [line 73]\n n$48=n$47() [line 73]\n REMOVE_TEMPS(n$47,n$48); [line 73]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_barrier_example______6,false); [line 73]\n " shape="box"] -55 [label="55: Start __objc_anonymous_block_A_dispatch_barrier_example______6\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 73]\n " color=yellow style=filled] + 56 -> 55 ; +55 [label="55: Return Stmt \n n$45=*&#GB$A_dispatch_barrier_example_a:class A * [line 77]\n n$46=*n$45.x:int [line 77]\n *&return:int =n$46 [line 77]\n REMOVE_TEMPS(n$45,n$46); [line 77]\n NULLIFY(&__objc_anonymous_block_A_dispatch_barrier_example______6,true); [line 77]\n APPLY_ABSTRACTION; [line 77]\n " shape="box"] - 55 -> 58 ; -54 [label="54: Call n$47 \n n$47=*&infer___objc_anonymous_block_A_dispatch_barrier_example______6:_fn_ (*) [line 73]\n n$48=n$47() [line 73]\n REMOVE_TEMPS(n$47,n$48); [line 73]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_barrier_example______6,false); [line 73]\n " shape="box"] + 55 -> 54 ; +54 [label="54: Exit A_dispatch_barrier_example \n " color=yellow style=filled] - 54 -> 53 ; -53 [label="53: Return Stmt \n n$45=*&#GB$A_dispatch_barrier_example_a:class A * [line 77]\n n$46=*n$45.x:int [line 77]\n *&return:int =n$46 [line 77]\n REMOVE_TEMPS(n$45,n$46); [line 77]\n NULLIFY(&__objc_anonymous_block_A_dispatch_barrier_example______6,true); [line 77]\n APPLY_ABSTRACTION; [line 77]\n " shape="box"] +53 [label="53: Start A_dispatch_barrier_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_barrier_example______6:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_barrier_example______6); [line 71]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_barrier_example______6,false); [line 71]\n " color=yellow style=filled] - 53 -> 52 ; -52 [label="52: Exit A_dispatch_barrier_example \n " color=yellow style=filled] + 53 -> 62 ; +52 [label="52: DeclStmt \n *&#GB$A_dispatch_group_notify_example_a:class A *=0 [line 63]\n " shape="box"] -51 [label="51: Start A_dispatch_barrier_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_barrier_example______6:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_barrier_example______6); [line 71]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_barrier_example______6,false); [line 71]\n " color=yellow style=filled] + 52 -> 51 ; +51 [label="51: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_group_notify_example______5); [line 64]\n n$43=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_group_notify_example______5 ):unsigned long ) [line 64]\n *&__objc_anonymous_block_A_dispatch_group_notify_example______5:class __objc_anonymous_block_A_dispatch_group_notify_example______5 =n$43 [line 64]\n n$44=*&#GB$A_dispatch_group_notify_example_a:class A * [line 64]\n *n$43.A_dispatch_group_notify_example_a:class A *=n$44 [line 64]\n *&infer___objc_anonymous_block_A_dispatch_group_notify_example______5:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_group_notify_example______5) [line 64]\n REMOVE_TEMPS(n$43,n$44); [line 64]\n " shape="box"] - 51 -> 60 ; -50 [label="50: DeclStmt \n *&#GB$A_dispatch_group_notify_example_a:class A *=0 [line 63]\n " shape="box"] + 51 -> 46 ; +50 [label="50: BinaryOperatorStmt: Assign \n n$41=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 65]\n n$42=_fun_NSObject_init(n$41:class A *) virtual [line 65]\n *&#GB$A_dispatch_group_notify_example_a:class A *=n$42 [line 65]\n REMOVE_TEMPS(n$41,n$42); [line 65]\n " shape="box"] 50 -> 49 ; -49 [label="49: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_group_notify_example______5); [line 64]\n n$43=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_group_notify_example______5 ):unsigned long ) [line 64]\n *&__objc_anonymous_block_A_dispatch_group_notify_example______5:class __objc_anonymous_block_A_dispatch_group_notify_example______5 =n$43 [line 64]\n n$44=*&#GB$A_dispatch_group_notify_example_a:class A * [line 64]\n *n$43.A_dispatch_group_notify_example_a:class A *=n$44 [line 64]\n *&infer___objc_anonymous_block_A_dispatch_group_notify_example______5:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_group_notify_example______5) [line 64]\n REMOVE_TEMPS(n$43,n$44); [line 64]\n " shape="box"] +49 [label="49: BinaryOperatorStmt: Assign \n n$40=*&#GB$A_dispatch_group_notify_example_a:class A * [line 66]\n *n$40.x:int =10 [line 66]\n REMOVE_TEMPS(n$40); [line 66]\n APPLY_ABSTRACTION; [line 66]\n " shape="box"] - 49 -> 44 ; -48 [label="48: BinaryOperatorStmt: Assign \n n$41=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 65]\n n$42=_fun_NSObject_init(n$41:class A *) virtual [line 65]\n *&#GB$A_dispatch_group_notify_example_a:class A *=n$42 [line 65]\n REMOVE_TEMPS(n$41,n$42); [line 65]\n " shape="box"] + 49 -> 48 ; +48 [label="48: Exit __objc_anonymous_block_A_dispatch_group_notify_example______5 \n " color=yellow style=filled] - 48 -> 47 ; -47 [label="47: BinaryOperatorStmt: Assign \n n$40=*&#GB$A_dispatch_group_notify_example_a:class A * [line 66]\n *n$40.x:int =10 [line 66]\n REMOVE_TEMPS(n$40); [line 66]\n APPLY_ABSTRACTION; [line 66]\n " shape="box"] +47 [label="47: Start __objc_anonymous_block_A_dispatch_group_notify_example______5\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 64]\n " color=yellow style=filled] - 47 -> 46 ; -46 [label="46: Exit __objc_anonymous_block_A_dispatch_group_notify_example______5 \n " color=yellow style=filled] + 47 -> 50 ; +46 [label="46: Call n$38 \n n$38=*&infer___objc_anonymous_block_A_dispatch_group_notify_example______5:_fn_ (*) [line 64]\n n$39=n$38() [line 64]\n REMOVE_TEMPS(n$38,n$39); [line 64]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_group_notify_example______5,false); [line 64]\n " shape="box"] -45 [label="45: Start __objc_anonymous_block_A_dispatch_group_notify_example______5\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 64]\n " color=yellow style=filled] + 46 -> 45 ; +45 [label="45: Return Stmt \n n$36=*&#GB$A_dispatch_group_notify_example_a:class A * [line 68]\n n$37=*n$36.x:int [line 68]\n *&return:int =n$37 [line 68]\n REMOVE_TEMPS(n$36,n$37); [line 68]\n NULLIFY(&__objc_anonymous_block_A_dispatch_group_notify_example______5,true); [line 68]\n APPLY_ABSTRACTION; [line 68]\n " shape="box"] - 45 -> 48 ; -44 [label="44: Call n$38 \n n$38=*&infer___objc_anonymous_block_A_dispatch_group_notify_example______5:_fn_ (*) [line 64]\n n$39=n$38() [line 64]\n REMOVE_TEMPS(n$38,n$39); [line 64]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_group_notify_example______5,false); [line 64]\n " shape="box"] + 45 -> 44 ; +44 [label="44: Exit A_dispatch_group_notify_example \n " color=yellow style=filled] - 44 -> 43 ; -43 [label="43: Return Stmt \n n$36=*&#GB$A_dispatch_group_notify_example_a:class A * [line 68]\n n$37=*n$36.x:int [line 68]\n *&return:int =n$37 [line 68]\n REMOVE_TEMPS(n$36,n$37); [line 68]\n NULLIFY(&__objc_anonymous_block_A_dispatch_group_notify_example______5,true); [line 68]\n APPLY_ABSTRACTION; [line 68]\n " shape="box"] +43 [label="43: Start A_dispatch_group_notify_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_group_notify_example______5:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_group_notify_example______5); [line 62]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_group_notify_example______5,false); [line 62]\n " color=yellow style=filled] - 43 -> 42 ; -42 [label="42: Exit A_dispatch_group_notify_example \n " color=yellow style=filled] + 43 -> 52 ; +42 [label="42: DeclStmt \n *&#GB$A_dispatch_group_example_a:class A *=0 [line 54]\n " shape="box"] -41 [label="41: Start A_dispatch_group_notify_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_group_notify_example______5:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_group_notify_example______5); [line 62]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_group_notify_example______5,false); [line 62]\n " color=yellow style=filled] + 42 -> 41 ; +41 [label="41: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_group_example______4); [line 55]\n n$34=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_group_example______4 ):unsigned long ) [line 55]\n *&__objc_anonymous_block_A_dispatch_group_example______4:class __objc_anonymous_block_A_dispatch_group_example______4 =n$34 [line 55]\n n$35=*&#GB$A_dispatch_group_example_a:class A * [line 55]\n *n$34.A_dispatch_group_example_a:class A *=n$35 [line 55]\n *&infer___objc_anonymous_block_A_dispatch_group_example______4:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_group_example______4) [line 55]\n REMOVE_TEMPS(n$34,n$35); [line 55]\n " shape="box"] - 41 -> 50 ; -40 [label="40: DeclStmt \n *&#GB$A_dispatch_group_example_a:class A *=0 [line 54]\n " shape="box"] + 41 -> 36 ; +40 [label="40: BinaryOperatorStmt: Assign \n n$32=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 56]\n n$33=_fun_NSObject_init(n$32:class A *) virtual [line 56]\n *&#GB$A_dispatch_group_example_a:class A *=n$33 [line 56]\n REMOVE_TEMPS(n$32,n$33); [line 56]\n " shape="box"] 40 -> 39 ; -39 [label="39: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_group_example______4); [line 55]\n n$34=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_group_example______4 ):unsigned long ) [line 55]\n *&__objc_anonymous_block_A_dispatch_group_example______4:class __objc_anonymous_block_A_dispatch_group_example______4 =n$34 [line 55]\n n$35=*&#GB$A_dispatch_group_example_a:class A * [line 55]\n *n$34.A_dispatch_group_example_a:class A *=n$35 [line 55]\n *&infer___objc_anonymous_block_A_dispatch_group_example______4:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_group_example______4) [line 55]\n REMOVE_TEMPS(n$34,n$35); [line 55]\n " shape="box"] +39 [label="39: BinaryOperatorStmt: Assign \n n$31=*&#GB$A_dispatch_group_example_a:class A * [line 57]\n *n$31.x:int =10 [line 57]\n REMOVE_TEMPS(n$31); [line 57]\n APPLY_ABSTRACTION; [line 57]\n " shape="box"] - 39 -> 34 ; -38 [label="38: BinaryOperatorStmt: Assign \n n$32=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 56]\n n$33=_fun_NSObject_init(n$32:class A *) virtual [line 56]\n *&#GB$A_dispatch_group_example_a:class A *=n$33 [line 56]\n REMOVE_TEMPS(n$32,n$33); [line 56]\n " shape="box"] + 39 -> 38 ; +38 [label="38: Exit __objc_anonymous_block_A_dispatch_group_example______4 \n " color=yellow style=filled] - 38 -> 37 ; -37 [label="37: BinaryOperatorStmt: Assign \n n$31=*&#GB$A_dispatch_group_example_a:class A * [line 57]\n *n$31.x:int =10 [line 57]\n REMOVE_TEMPS(n$31); [line 57]\n APPLY_ABSTRACTION; [line 57]\n " shape="box"] +37 [label="37: Start __objc_anonymous_block_A_dispatch_group_example______4\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 55]\n " color=yellow style=filled] - 37 -> 36 ; -36 [label="36: Exit __objc_anonymous_block_A_dispatch_group_example______4 \n " color=yellow style=filled] + 37 -> 40 ; +36 [label="36: Call n$29 \n n$29=*&infer___objc_anonymous_block_A_dispatch_group_example______4:_fn_ (*) [line 55]\n n$30=n$29() [line 55]\n REMOVE_TEMPS(n$29,n$30); [line 55]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_group_example______4,false); [line 55]\n " shape="box"] -35 [label="35: Start __objc_anonymous_block_A_dispatch_group_example______4\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 55]\n " color=yellow style=filled] + 36 -> 35 ; +35 [label="35: Return Stmt \n n$27=*&#GB$A_dispatch_group_example_a:class A * [line 59]\n n$28=*n$27.x:int [line 59]\n *&return:int =n$28 [line 59]\n REMOVE_TEMPS(n$27,n$28); [line 59]\n NULLIFY(&__objc_anonymous_block_A_dispatch_group_example______4,true); [line 59]\n APPLY_ABSTRACTION; [line 59]\n " shape="box"] - 35 -> 38 ; -34 [label="34: Call n$29 \n n$29=*&infer___objc_anonymous_block_A_dispatch_group_example______4:_fn_ (*) [line 55]\n n$30=n$29() [line 55]\n REMOVE_TEMPS(n$29,n$30); [line 55]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_group_example______4,false); [line 55]\n " shape="box"] + 35 -> 34 ; +34 [label="34: Exit A_dispatch_group_example \n " color=yellow style=filled] - 34 -> 33 ; -33 [label="33: Return Stmt \n n$27=*&#GB$A_dispatch_group_example_a:class A * [line 59]\n n$28=*n$27.x:int [line 59]\n *&return:int =n$28 [line 59]\n REMOVE_TEMPS(n$27,n$28); [line 59]\n NULLIFY(&__objc_anonymous_block_A_dispatch_group_example______4,true); [line 59]\n APPLY_ABSTRACTION; [line 59]\n " shape="box"] +33 [label="33: Start A_dispatch_group_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_group_example______4:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_group_example______4); [line 53]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_group_example______4,false); [line 53]\n " color=yellow style=filled] - 33 -> 32 ; -32 [label="32: Exit A_dispatch_group_example \n " color=yellow style=filled] + 33 -> 42 ; +32 [label="32: DeclStmt \n *&#GB$A_dispatch_after_example_a:class A *=0 [line 43]\n " shape="box"] -31 [label="31: Start A_dispatch_group_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_group_example______4:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_group_example______4); [line 53]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_group_example______4,false); [line 53]\n " color=yellow style=filled] + 32 -> 31 ; +31 [label="31: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_after_example______3); [line 46]\n n$25=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_after_example______3 ):unsigned long ) [line 46]\n *&__objc_anonymous_block_A_dispatch_after_example______3:class __objc_anonymous_block_A_dispatch_after_example______3 =n$25 [line 46]\n n$26=*&#GB$A_dispatch_after_example_a:class A * [line 46]\n *n$25.A_dispatch_after_example_a:class A *=n$26 [line 46]\n *&infer___objc_anonymous_block_A_dispatch_after_example______3:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_after_example______3) [line 44]\n REMOVE_TEMPS(n$25,n$26); [line 44]\n " shape="box"] - 31 -> 40 ; -30 [label="30: DeclStmt \n *&#GB$A_dispatch_after_example_a:class A *=0 [line 43]\n " shape="box"] + 31 -> 26 ; +30 [label="30: BinaryOperatorStmt: Assign \n n$23=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 47]\n n$24=_fun_NSObject_init(n$23:class A *) virtual [line 47]\n *&#GB$A_dispatch_after_example_a:class A *=n$24 [line 47]\n REMOVE_TEMPS(n$23,n$24); [line 47]\n " shape="box"] 30 -> 29 ; -29 [label="29: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_after_example______3); [line 46]\n n$25=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_after_example______3 ):unsigned long ) [line 46]\n *&__objc_anonymous_block_A_dispatch_after_example______3:class __objc_anonymous_block_A_dispatch_after_example______3 =n$25 [line 46]\n n$26=*&#GB$A_dispatch_after_example_a:class A * [line 46]\n *n$25.A_dispatch_after_example_a:class A *=n$26 [line 46]\n *&infer___objc_anonymous_block_A_dispatch_after_example______3:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_after_example______3) [line 44]\n REMOVE_TEMPS(n$25,n$26); [line 44]\n " shape="box"] +29 [label="29: BinaryOperatorStmt: Assign \n n$22=*&#GB$A_dispatch_after_example_a:class A * [line 48]\n *n$22.x:int =10 [line 48]\n REMOVE_TEMPS(n$22); [line 48]\n APPLY_ABSTRACTION; [line 48]\n " shape="box"] - 29 -> 24 ; -28 [label="28: BinaryOperatorStmt: Assign \n n$23=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 47]\n n$24=_fun_NSObject_init(n$23:class A *) virtual [line 47]\n *&#GB$A_dispatch_after_example_a:class A *=n$24 [line 47]\n REMOVE_TEMPS(n$23,n$24); [line 47]\n " shape="box"] + 29 -> 28 ; +28 [label="28: Exit __objc_anonymous_block_A_dispatch_after_example______3 \n " color=yellow style=filled] - 28 -> 27 ; -27 [label="27: BinaryOperatorStmt: Assign \n n$22=*&#GB$A_dispatch_after_example_a:class A * [line 48]\n *n$22.x:int =10 [line 48]\n REMOVE_TEMPS(n$22); [line 48]\n APPLY_ABSTRACTION; [line 48]\n " shape="box"] +27 [label="27: Start __objc_anonymous_block_A_dispatch_after_example______3\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 46]\n " color=yellow style=filled] - 27 -> 26 ; -26 [label="26: Exit __objc_anonymous_block_A_dispatch_after_example______3 \n " color=yellow style=filled] + 27 -> 30 ; +26 [label="26: Call n$20 \n n$20=*&infer___objc_anonymous_block_A_dispatch_after_example______3:_fn_ (*) [line 44]\n n$21=n$20() [line 44]\n REMOVE_TEMPS(n$20,n$21); [line 44]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_after_example______3,false); [line 44]\n " shape="box"] -25 [label="25: Start __objc_anonymous_block_A_dispatch_after_example______3\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 46]\n " color=yellow style=filled] + 26 -> 25 ; +25 [label="25: Return Stmt \n n$18=*&#GB$A_dispatch_after_example_a:class A * [line 50]\n n$19=*n$18.x:int [line 50]\n *&return:int =n$19 [line 50]\n REMOVE_TEMPS(n$18,n$19); [line 50]\n NULLIFY(&__objc_anonymous_block_A_dispatch_after_example______3,true); [line 50]\n APPLY_ABSTRACTION; [line 50]\n " shape="box"] - 25 -> 28 ; -24 [label="24: Call n$20 \n n$20=*&infer___objc_anonymous_block_A_dispatch_after_example______3:_fn_ (*) [line 44]\n n$21=n$20() [line 44]\n REMOVE_TEMPS(n$20,n$21); [line 44]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_after_example______3,false); [line 44]\n " shape="box"] + 25 -> 24 ; +24 [label="24: Exit A_dispatch_after_example \n " color=yellow style=filled] - 24 -> 23 ; -23 [label="23: Return Stmt \n n$18=*&#GB$A_dispatch_after_example_a:class A * [line 50]\n n$19=*n$18.x:int [line 50]\n *&return:int =n$19 [line 50]\n REMOVE_TEMPS(n$18,n$19); [line 50]\n NULLIFY(&__objc_anonymous_block_A_dispatch_after_example______3,true); [line 50]\n APPLY_ABSTRACTION; [line 50]\n " shape="box"] +23 [label="23: Start A_dispatch_after_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_after_example______3:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_after_example______3); [line 42]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_after_example______3,false); [line 42]\n " color=yellow style=filled] - 23 -> 22 ; -22 [label="22: Exit A_dispatch_after_example \n " color=yellow style=filled] + 23 -> 32 ; +22 [label="22: DeclStmt \n *&#GB$A_dispatch_async_example_a:class A *=0 [line 33]\n " shape="box"] -21 [label="21: Start A_dispatch_after_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_after_example______3:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_after_example______3); [line 42]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_after_example______3,false); [line 42]\n " color=yellow style=filled] + 22 -> 21 ; +21 [label="21: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_async_example______2); [line 35]\n n$16=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_async_example______2 ):unsigned long ) [line 35]\n *&__objc_anonymous_block_A_dispatch_async_example______2:class __objc_anonymous_block_A_dispatch_async_example______2 =n$16 [line 35]\n n$17=*&#GB$A_dispatch_async_example_a:class A * [line 35]\n *n$16.A_dispatch_async_example_a:class A *=n$17 [line 35]\n *&infer___objc_anonymous_block_A_dispatch_async_example______2:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_async_example______2) [line 34]\n REMOVE_TEMPS(n$16,n$17); [line 34]\n " shape="box"] - 21 -> 30 ; -20 [label="20: DeclStmt \n *&#GB$A_dispatch_async_example_a:class A *=0 [line 33]\n " shape="box"] + 21 -> 16 ; +20 [label="20: BinaryOperatorStmt: Assign \n n$14=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 36]\n n$15=_fun_NSObject_init(n$14:class A *) virtual [line 36]\n *&#GB$A_dispatch_async_example_a:class A *=n$15 [line 36]\n REMOVE_TEMPS(n$14,n$15); [line 36]\n " shape="box"] 20 -> 19 ; -19 [label="19: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_async_example______2); [line 35]\n n$16=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_async_example______2 ):unsigned long ) [line 35]\n *&__objc_anonymous_block_A_dispatch_async_example______2:class __objc_anonymous_block_A_dispatch_async_example______2 =n$16 [line 35]\n n$17=*&#GB$A_dispatch_async_example_a:class A * [line 35]\n *n$16.A_dispatch_async_example_a:class A *=n$17 [line 35]\n *&infer___objc_anonymous_block_A_dispatch_async_example______2:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_async_example______2) [line 34]\n REMOVE_TEMPS(n$16,n$17); [line 34]\n " shape="box"] +19 [label="19: BinaryOperatorStmt: Assign \n n$13=*&#GB$A_dispatch_async_example_a:class A * [line 37]\n *n$13.x:int =10 [line 37]\n REMOVE_TEMPS(n$13); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] - 19 -> 14 ; -18 [label="18: BinaryOperatorStmt: Assign \n n$14=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 36]\n n$15=_fun_NSObject_init(n$14:class A *) virtual [line 36]\n *&#GB$A_dispatch_async_example_a:class A *=n$15 [line 36]\n REMOVE_TEMPS(n$14,n$15); [line 36]\n " shape="box"] + 19 -> 18 ; +18 [label="18: Exit __objc_anonymous_block_A_dispatch_async_example______2 \n " color=yellow style=filled] - 18 -> 17 ; -17 [label="17: BinaryOperatorStmt: Assign \n n$13=*&#GB$A_dispatch_async_example_a:class A * [line 37]\n *n$13.x:int =10 [line 37]\n REMOVE_TEMPS(n$13); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] +17 [label="17: Start __objc_anonymous_block_A_dispatch_async_example______2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 35]\n " color=yellow style=filled] - 17 -> 16 ; -16 [label="16: Exit __objc_anonymous_block_A_dispatch_async_example______2 \n " color=yellow style=filled] + 17 -> 20 ; +16 [label="16: Call n$11 \n n$11=*&infer___objc_anonymous_block_A_dispatch_async_example______2:_fn_ (*) [line 34]\n n$12=n$11() [line 34]\n REMOVE_TEMPS(n$11,n$12); [line 34]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_async_example______2,false); [line 34]\n " shape="box"] -15 [label="15: Start __objc_anonymous_block_A_dispatch_async_example______2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 35]\n " color=yellow style=filled] + 16 -> 15 ; +15 [label="15: Return Stmt \n n$9=*&#GB$A_dispatch_async_example_a:class A * [line 39]\n n$10=*n$9.x:int [line 39]\n *&return:int =n$10 [line 39]\n REMOVE_TEMPS(n$9,n$10); [line 39]\n NULLIFY(&__objc_anonymous_block_A_dispatch_async_example______2,true); [line 39]\n APPLY_ABSTRACTION; [line 39]\n " shape="box"] - 15 -> 18 ; -14 [label="14: Call n$11 \n n$11=*&infer___objc_anonymous_block_A_dispatch_async_example______2:_fn_ (*) [line 34]\n n$12=n$11() [line 34]\n REMOVE_TEMPS(n$11,n$12); [line 34]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_async_example______2,false); [line 34]\n " shape="box"] + 15 -> 14 ; +14 [label="14: Exit A_dispatch_async_example \n " color=yellow style=filled] - 14 -> 13 ; -13 [label="13: Return Stmt \n n$9=*&#GB$A_dispatch_async_example_a:class A * [line 39]\n n$10=*n$9.x:int [line 39]\n *&return:int =n$10 [line 39]\n REMOVE_TEMPS(n$9,n$10); [line 39]\n NULLIFY(&__objc_anonymous_block_A_dispatch_async_example______2,true); [line 39]\n APPLY_ABSTRACTION; [line 39]\n " shape="box"] +13 [label="13: Start A_dispatch_async_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_async_example______2:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_async_example______2); [line 32]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_async_example______2,false); [line 32]\n " color=yellow style=filled] - 13 -> 12 ; -12 [label="12: Exit A_dispatch_async_example \n " color=yellow style=filled] + 13 -> 22 ; +12 [label="12: DeclStmt \n *&#GB$A_dispatch_once_example_a:class A *=0 [line 21]\n " shape="box"] -11 [label="11: Start A_dispatch_async_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_async_example______2:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_async_example______2); [line 32]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_async_example______2,false); [line 32]\n " color=yellow style=filled] + 12 -> 11 ; +11 [label="11: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_once_example______1); [line 25]\n n$7=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_once_example______1 ):unsigned long ) [line 25]\n *&__objc_anonymous_block_A_dispatch_once_example______1:class __objc_anonymous_block_A_dispatch_once_example______1 =n$7 [line 25]\n n$8=*&#GB$A_dispatch_once_example_a:class A * [line 25]\n *n$7.A_dispatch_once_example_a:class A *=n$8 [line 25]\n *&infer___objc_anonymous_block_A_dispatch_once_example______1:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_once_example______1) [line 25]\n REMOVE_TEMPS(n$7,n$8); [line 25]\n " shape="box"] - 11 -> 20 ; -10 [label="10: DeclStmt \n *&#GB$A_dispatch_once_example_a:class A *=0 [line 21]\n " shape="box"] + 11 -> 6 ; +10 [label="10: BinaryOperatorStmt: Assign \n n$5=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 26]\n n$6=_fun_NSObject_init(n$5:class A *) virtual [line 26]\n *&#GB$A_dispatch_once_example_a:class A *=n$6 [line 26]\n REMOVE_TEMPS(n$5,n$6); [line 26]\n " shape="box"] 10 -> 9 ; -9 [label="9: DeclStmt \n DECLARE_LOCALS(&__objc_anonymous_block_A_dispatch_once_example______1); [line 25]\n n$7=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_dispatch_once_example______1 ):unsigned long ) [line 25]\n *&__objc_anonymous_block_A_dispatch_once_example______1:class __objc_anonymous_block_A_dispatch_once_example______1 =n$7 [line 25]\n n$8=*&#GB$A_dispatch_once_example_a:class A * [line 25]\n *n$7.A_dispatch_once_example_a:class A *=n$8 [line 25]\n *&infer___objc_anonymous_block_A_dispatch_once_example______1:_fn_ (*)=(_fun___objc_anonymous_block_A_dispatch_once_example______1) [line 25]\n REMOVE_TEMPS(n$7,n$8); [line 25]\n " shape="box"] +9 [label="9: BinaryOperatorStmt: Assign \n n$4=*&#GB$A_dispatch_once_example_a:class A * [line 27]\n *n$4.x:int =10 [line 27]\n REMOVE_TEMPS(n$4); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] - 9 -> 4 ; -8 [label="8: BinaryOperatorStmt: Assign \n n$5=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 26]\n n$6=_fun_NSObject_init(n$5:class A *) virtual [line 26]\n *&#GB$A_dispatch_once_example_a:class A *=n$6 [line 26]\n REMOVE_TEMPS(n$5,n$6); [line 26]\n " shape="box"] + 9 -> 8 ; +8 [label="8: Exit __objc_anonymous_block_A_dispatch_once_example______1 \n " color=yellow style=filled] - 8 -> 7 ; -7 [label="7: BinaryOperatorStmt: Assign \n n$4=*&#GB$A_dispatch_once_example_a:class A * [line 27]\n *n$4.x:int =10 [line 27]\n REMOVE_TEMPS(n$4); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] +7 [label="7: Start __objc_anonymous_block_A_dispatch_once_example______1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 25]\n " color=yellow style=filled] - 7 -> 6 ; -6 [label="6: Exit __objc_anonymous_block_A_dispatch_once_example______1 \n " color=yellow style=filled] + 7 -> 10 ; +6 [label="6: Call n$2 \n n$2=*&infer___objc_anonymous_block_A_dispatch_once_example______1:_fn_ (*) [line 25]\n n$3=n$2() [line 25]\n REMOVE_TEMPS(n$2,n$3); [line 25]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_once_example______1,false); [line 25]\n " shape="box"] -5 [label="5: Start __objc_anonymous_block_A_dispatch_once_example______1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 25]\n " color=yellow style=filled] + 6 -> 5 ; +5 [label="5: Return Stmt \n n$0=*&#GB$A_dispatch_once_example_a:class A * [line 29]\n n$1=*n$0.x:int [line 29]\n *&return:int =n$1 [line 29]\n REMOVE_TEMPS(n$0,n$1); [line 29]\n NULLIFY(&__objc_anonymous_block_A_dispatch_once_example______1,true); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] - 5 -> 8 ; -4 [label="4: Call n$2 \n n$2=*&infer___objc_anonymous_block_A_dispatch_once_example______1:_fn_ (*) [line 25]\n n$3=n$2() [line 25]\n REMOVE_TEMPS(n$2,n$3); [line 25]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_once_example______1,false); [line 25]\n " shape="box"] + 5 -> 4 ; +4 [label="4: Exit A_dispatch_once_example \n " color=yellow style=filled] - 4 -> 3 ; -3 [label="3: Return Stmt \n n$0=*&#GB$A_dispatch_once_example_a:class A * [line 29]\n n$1=*n$0.x:int [line 29]\n *&return:int =n$1 [line 29]\n REMOVE_TEMPS(n$0,n$1); [line 29]\n NULLIFY(&__objc_anonymous_block_A_dispatch_once_example______1,true); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] +3 [label="3: Start A_dispatch_once_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_once_example______1:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_once_example______1); [line 20]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_once_example______1,false); [line 20]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit A_dispatch_once_example \n " color=yellow style=filled] + 3 -> 12 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start A_dispatch_once_example\nFormals: \nLocals: infer___objc_anonymous_block_A_dispatch_once_example______1:_fn_ (*) \n DECLARE_LOCALS(&return,&infer___objc_anonymous_block_A_dispatch_once_example______1); [line 20]\n NULLIFY(&infer___objc_anonymous_block_A_dispatch_once_example______1,false); [line 20]\n " color=yellow style=filled] +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 10 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.dot b/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.dot index 775d5a713..480faeacc 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.dot @@ -1,73 +1,87 @@ digraph iCFG { -19 [label="19: DeclStmt \n n$2=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 63]\n *&a:class A *=n$2 [line 63]\n REMOVE_TEMPS(n$2); [line 63]\n " shape="box"] +23 [label="23: DeclStmt \n n$2=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 63]\n *&a:class A *=n$2 [line 63]\n REMOVE_TEMPS(n$2); [line 63]\n " shape="box"] - 19 -> 18 ; -18 [label="18: BinaryOperatorStmt: Assign \n n$0=*&a:class A * [line 65]\n n$1=_fun_foo(n$0:class A *) [line 65]\n *&a:class A *=n$1 [line 65]\n REMOVE_TEMPS(n$0,n$1); [line 65]\n NULLIFY(&a,false); [line 65]\n " shape="box"] + 23 -> 22 ; +22 [label="22: BinaryOperatorStmt: Assign \n n$0=*&a:class A * [line 65]\n n$1=_fun_foo(n$0:class A *) [line 65]\n *&a:class A *=n$1 [line 65]\n REMOVE_TEMPS(n$0,n$1); [line 65]\n NULLIFY(&a,false); [line 65]\n " shape="box"] + + + 22 -> 21 ; +21 [label="21: Return Stmt \n *&return:int =0 [line 67]\n APPLY_ABSTRACTION; [line 67]\n " shape="box"] + + + 21 -> 20 ; +20 [label="20: Exit main \n " color=yellow style=filled] + + +19 [label="19: Start main\nFormals: argc:int argv:char **\nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 61]\n NULLIFY(&a,false); [line 61]\n NULLIFY(&argc,false); [line 61]\n NULLIFY(&argv,false); [line 61]\n " color=yellow style=filled] + + + 19 -> 23 ; +18 [label="18: Message Call: capture \n n$1=*&a:class A * [line 56]\n _fun_A_capture(n$1:class A *) virtual [line 56]\n REMOVE_TEMPS(n$1); [line 56]\n " shape="box"] 18 -> 17 ; -17 [label="17: Return Stmt \n *&return:int =0 [line 67]\n APPLY_ABSTRACTION; [line 67]\n " shape="box"] +17 [label="17: Return Stmt \n n$0=*&a:class A * [line 58]\n *&return:class A *=n$0 [line 58]\n REMOVE_TEMPS(n$0); [line 58]\n NULLIFY(&a,false); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] 17 -> 16 ; -16 [label="16: Exit main \n " color=yellow style=filled] +16 [label="16: Exit foo \n " color=yellow style=filled] -15 [label="15: Start main\nFormals: argc:int argv:char **\nLocals: a:class A * \n DECLARE_LOCALS(&return,&a); [line 61]\n NULLIFY(&a,false); [line 61]\n NULLIFY(&argc,false); [line 61]\n NULLIFY(&argv,false); [line 61]\n " color=yellow style=filled] +15 [label="15: Start foo\nFormals: a:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 54]\n " color=yellow style=filled] - 15 -> 19 ; -14 [label="14: Message Call: capture \n n$1=*&a:class A * [line 56]\n _fun_A_capture(n$1:class A *) virtual [line 56]\n REMOVE_TEMPS(n$1); [line 56]\n " shape="box"] + 15 -> 18 ; +14 [label="14: BinaryOperatorStmt: Assign \n n$8=*&self:class A * [line 46]\n n$9=_fun___objc_alloc_no_fail(sizeof(class B ):unsigned long ) [line 46]\n *n$8._b:class B *=n$9 [line 46]\n REMOVE_TEMPS(n$8,n$9); [line 46]\n " shape="box"] 14 -> 13 ; -13 [label="13: Return Stmt \n n$0=*&a:class A * [line 58]\n *&return:class A *=n$0 [line 58]\n REMOVE_TEMPS(n$0); [line 58]\n NULLIFY(&a,false); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] +13 [label="13: Message Call: sHandler: \n n$0=*&self:class A * [line 47]\n n$1=*n$0._b:class B * [line 47]\n DECLARE_LOCALS(&__objc_anonymous_block_A_capture______1); [line 47]\n n$5=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_capture______1 ):unsigned long ) [line 47]\n *&__objc_anonymous_block_A_capture______1:class __objc_anonymous_block_A_capture______1 =n$5 [line 47]\n n$6=*&self:class A * [line 47]\n *n$5.self:class A *=n$6 [line 47]\n n$2=*&self:class A * [line 47]\n n$7=*&__objc_anonymous_block_A_capture______1:_fn_ (*) [line 47]\n _fun_B_sHandler:(n$1:class B *,n$7:_fn_ (*),n$2:_fn_ (*)) virtual [line 47]\n REMOVE_TEMPS(n$0,n$1,n$5,n$6,n$2,n$7); [line 47]\n NULLIFY(&__objc_anonymous_block_A_capture______1,true); [line 47]\n NULLIFY(&self,false); [line 47]\n APPLY_ABSTRACTION; [line 47]\n " shape="box"] - 13 -> 12 ; -12 [label="12: Exit foo \n " color=yellow style=filled] + 13 -> 9 ; +12 [label="12: BinaryOperatorStmt: Assign \n n$3=*&self:class A * [line 48]\n n$4=*&d:class D * [line 48]\n *n$3._data:class D *=n$4 [line 48]\n REMOVE_TEMPS(n$3,n$4); [line 48]\n NULLIFY(&d,false); [line 48]\n APPLY_ABSTRACTION; [line 48]\n " shape="box"] -11 [label="11: Start foo\nFormals: a:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 54]\n " color=yellow style=filled] + 12 -> 11 ; +11 [label="11: Exit __objc_anonymous_block_A_capture______1 \n " color=yellow style=filled] - 11 -> 14 ; -10 [label="10: BinaryOperatorStmt: Assign \n n$8=*&self:class A * [line 46]\n n$9=_fun___objc_alloc_no_fail(sizeof(class B ):unsigned long ) [line 46]\n *n$8._b:class B *=n$9 [line 46]\n REMOVE_TEMPS(n$8,n$9); [line 46]\n " shape="box"] +10 [label="10: Start __objc_anonymous_block_A_capture______1\nFormals: self:class A * d:class D *\nLocals: \nCaptured: self:class A * \n DECLARE_LOCALS(&return); [line 47]\n " color=yellow style=filled] - 10 -> 9 ; -9 [label="9: Message Call: sHandler: \n n$0=*&self:class A * [line 47]\n n$1=*n$0._b:class B * [line 47]\n DECLARE_LOCALS(&__objc_anonymous_block_A_capture______1); [line 47]\n n$5=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_capture______1 ):unsigned long ) [line 47]\n *&__objc_anonymous_block_A_capture______1:class __objc_anonymous_block_A_capture______1 =n$5 [line 47]\n n$6=*&self:class A * [line 47]\n *n$5.self:class A *=n$6 [line 47]\n n$2=*&self:class A * [line 47]\n n$7=*&__objc_anonymous_block_A_capture______1:_fn_ (*) [line 47]\n _fun_B_sHandler:(n$1:class B *,n$7:_fn_ (*),n$2:_fn_ (*)) virtual [line 47]\n REMOVE_TEMPS(n$0,n$1,n$5,n$6,n$2,n$7); [line 47]\n NULLIFY(&__objc_anonymous_block_A_capture______1,true); [line 47]\n NULLIFY(&self,false); [line 47]\n APPLY_ABSTRACTION; [line 47]\n " shape="box"] + 10 -> 12 ; +9 [label="9: Exit A_capture \n " color=yellow style=filled] - 9 -> 5 ; -8 [label="8: BinaryOperatorStmt: Assign \n n$3=*&self:class A * [line 48]\n n$4=*&d:class D * [line 48]\n *n$3._data:class D *=n$4 [line 48]\n REMOVE_TEMPS(n$3,n$4); [line 48]\n NULLIFY(&d,false); [line 48]\n APPLY_ABSTRACTION; [line 48]\n " shape="box"] +8 [label="8: Start A_capture\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 45]\n " color=yellow style=filled] - 8 -> 7 ; -7 [label="7: Exit __objc_anonymous_block_A_capture______1 \n " color=yellow style=filled] + 8 -> 14 ; +7 [label="7: Exit A_frontendChecks \n " color=yellow style=filled] -6 [label="6: Start __objc_anonymous_block_A_capture______1\nFormals: self:class A * d:class D *\nLocals: \nCaptured: self:class A * \n DECLARE_LOCALS(&return); [line 47]\n " color=yellow style=filled] +6 [label="6: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 6 -> 8 ; -5 [label="5: Exit A_capture \n " color=yellow style=filled] + 6 -> 7 ; +5 [label="5: BinaryOperatorStmt: Assign \n n$0=*&self:class B * [line 30]\n n$1=*&h:_fn_ (*) [line 30]\n *n$0._h:_fn_ (*)=n$1 [line 30]\n REMOVE_TEMPS(n$0,n$1); [line 30]\n NULLIFY(&h,false); [line 30]\n NULLIFY(&self,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] -4 [label="4: Start A_capture\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 45]\n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit B_sHandler: \n " color=yellow style=filled] - 4 -> 10 ; -3 [label="3: BinaryOperatorStmt: Assign \n n$0=*&self:class B * [line 30]\n n$1=*&h:_fn_ (*) [line 30]\n *n$0._h:_fn_ (*)=n$1 [line 30]\n REMOVE_TEMPS(n$0,n$1); [line 30]\n NULLIFY(&h,false); [line 30]\n NULLIFY(&self,false); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] +3 [label="3: Start B_sHandler:\nFormals: self:class B * h:_fn_ (*)\nLocals: \n DECLARE_LOCALS(&return); [line 28]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit B_sHandler: \n " color=yellow style=filled] + 3 -> 5 ; +2 [label="2: Exit B_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start B_sHandler:\nFormals: self:class B * h:_fn_ (*)\nLocals: \n DECLARE_LOCALS(&return); [line 28]\n " color=yellow style=filled] +1 [label="1: Start B_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 3 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/block/static.dot b/infer/tests/codetoanalyze/objc/frontend/block/static.dot index 4dcaf712d..83365bfa8 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/static.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/static.dot @@ -1,117 +1,124 @@ digraph iCFG { -31 [label="31: Return Stmt \n *&return:int =0 [line 60]\n APPLY_ABSTRACTION; [line 60]\n " shape="box"] +33 [label="33: Return Stmt \n *&return:int =0 [line 60]\n APPLY_ABSTRACTION; [line 60]\n " shape="box"] - 31 -> 30 ; -30 [label="30: Exit main \n " color=yellow style=filled] + 33 -> 32 ; +32 [label="32: Exit main \n " color=yellow style=filled] -29 [label="29: Start main\nFormals: argc:int argv:char **\nLocals: \n DECLARE_LOCALS(&return); [line 60]\n NULLIFY(&argc,false); [line 60]\n NULLIFY(&argv,false); [line 60]\n " color=yellow style=filled] +31 [label="31: Start main\nFormals: argc:int argv:char **\nLocals: \n DECLARE_LOCALS(&return); [line 60]\n NULLIFY(&argc,false); [line 60]\n NULLIFY(&argv,false); [line 60]\n " color=yellow style=filled] - 29 -> 31 ; -28 [label="28: Call (_fun___objc_anonymous_block_A_test3______4) \n DECLARE_LOCALS(&__objc_anonymous_block_A_test3______4); [line 50]\n n$17=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_test3______4 ):unsigned long ) [line 50]\n *&__objc_anonymous_block_A_test3______4:class __objc_anonymous_block_A_test3______4 =n$17 [line 50]\n n$18=*&#GB$A_test3_i:int [line 50]\n *n$17.A_test3_i:int =n$18 [line 50]\n (_fun___objc_anonymous_block_A_test3______4)() [line 50]\n REMOVE_TEMPS(n$17,n$18); [line 50]\n " shape="box"] + 31 -> 33 ; +30 [label="30: Call (_fun___objc_anonymous_block_A_test3______4) \n DECLARE_LOCALS(&__objc_anonymous_block_A_test3______4); [line 50]\n n$17=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_test3______4 ):unsigned long ) [line 50]\n *&__objc_anonymous_block_A_test3______4:class __objc_anonymous_block_A_test3______4 =n$17 [line 50]\n n$18=*&#GB$A_test3_i:int [line 50]\n *n$17.A_test3_i:int =n$18 [line 50]\n (_fun___objc_anonymous_block_A_test3______4)() [line 50]\n REMOVE_TEMPS(n$17,n$18); [line 50]\n " shape="box"] - 28 -> 24 ; -27 [label="27: UnaryOperator \n n$16=*&#GB$A_test3_i:int [line 52]\n *&#GB$A_test3_i:int =(n$16 + 1) [line 52]\n REMOVE_TEMPS(n$16); [line 52]\n APPLY_ABSTRACTION; [line 52]\n " shape="box"] + 30 -> 26 ; +29 [label="29: UnaryOperator \n n$16=*&#GB$A_test3_i:int [line 52]\n *&#GB$A_test3_i:int =(n$16 + 1) [line 52]\n REMOVE_TEMPS(n$16); [line 52]\n APPLY_ABSTRACTION; [line 52]\n " shape="box"] - 27 -> 26 ; -26 [label="26: Exit __objc_anonymous_block_A_test3______4 \n " color=yellow style=filled] + 29 -> 28 ; +28 [label="28: Exit __objc_anonymous_block_A_test3______4 \n " color=yellow style=filled] -25 [label="25: Start __objc_anonymous_block_A_test3______4\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 50]\n " color=yellow style=filled] +27 [label="27: Start __objc_anonymous_block_A_test3______4\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 50]\n " color=yellow style=filled] - 25 -> 27 ; -24 [label="24: Return Stmt \n n$15=*&#GB$A_test3_i:int [line 55]\n *&return:int =n$15 [line 55]\n REMOVE_TEMPS(n$15); [line 55]\n NULLIFY(&__objc_anonymous_block_A_test3______4,true); [line 55]\n APPLY_ABSTRACTION; [line 55]\n " shape="box"] + 27 -> 29 ; +26 [label="26: Return Stmt \n n$15=*&#GB$A_test3_i:int [line 55]\n *&return:int =n$15 [line 55]\n REMOVE_TEMPS(n$15); [line 55]\n NULLIFY(&__objc_anonymous_block_A_test3______4,true); [line 55]\n APPLY_ABSTRACTION; [line 55]\n " shape="box"] - 24 -> 23 ; -23 [label="23: Exit A_test3 \n " color=yellow style=filled] + 26 -> 25 ; +25 [label="25: Exit A_test3 \n " color=yellow style=filled] -22 [label="22: Start A_test3\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 47]\n " color=yellow style=filled] +24 [label="24: Start A_test3\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 47]\n " color=yellow style=filled] - 22 -> 28 ; -21 [label="21: BinaryOperatorStmt: Assign \n n$13=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 38]\n n$14=_fun_A_init(n$13:class A *) virtual [line 38]\n *&#GB$A_test2_sharedInstance:struct objc_object *=n$14 [line 38]\n REMOVE_TEMPS(n$13,n$14); [line 38]\n " shape="box"] + 24 -> 30 ; +23 [label="23: BinaryOperatorStmt: Assign \n n$13=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 38]\n n$14=_fun_A_init(n$13:class A *) virtual [line 38]\n *&#GB$A_test2_sharedInstance:struct objc_object *=n$14 [line 38]\n REMOVE_TEMPS(n$13,n$14); [line 38]\n " shape="box"] + + + 23 -> 22 ; +22 [label="22: Call (_fun___objc_anonymous_block_A_test2______3) \n DECLARE_LOCALS(&__objc_anonymous_block_A_test2______3); [line 39]\n n$11=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_test2______3 ):unsigned long ) [line 39]\n *&__objc_anonymous_block_A_test2______3:class __objc_anonymous_block_A_test2______3 =n$11 [line 39]\n n$12=*&#GB$A_test2_sharedInstance:struct objc_object * [line 39]\n *n$11.A_test2_sharedInstance:struct objc_object *=n$12 [line 39]\n (_fun___objc_anonymous_block_A_test2______3)() [line 39]\n REMOVE_TEMPS(n$11,n$12); [line 39]\n " shape="box"] + + + 22 -> 18 ; +21 [label="21: DeclStmt \n n$10=*&#GB$A_test2_sharedInstance:struct objc_object * [line 41]\n *&p:struct objc_object *=n$10 [line 41]\n REMOVE_TEMPS(n$10); [line 41]\n NULLIFY(&p,false); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] 21 -> 20 ; -20 [label="20: Call (_fun___objc_anonymous_block_A_test2______3) \n DECLARE_LOCALS(&__objc_anonymous_block_A_test2______3); [line 39]\n n$11=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_test2______3 ):unsigned long ) [line 39]\n *&__objc_anonymous_block_A_test2______3:class __objc_anonymous_block_A_test2______3 =n$11 [line 39]\n n$12=*&#GB$A_test2_sharedInstance:struct objc_object * [line 39]\n *n$11.A_test2_sharedInstance:struct objc_object *=n$12 [line 39]\n (_fun___objc_anonymous_block_A_test2______3)() [line 39]\n REMOVE_TEMPS(n$11,n$12); [line 39]\n " shape="box"] +20 [label="20: Exit __objc_anonymous_block_A_test2______3 \n " color=yellow style=filled] - 20 -> 16 ; -19 [label="19: DeclStmt \n n$10=*&#GB$A_test2_sharedInstance:struct objc_object * [line 41]\n *&p:struct objc_object *=n$10 [line 41]\n REMOVE_TEMPS(n$10); [line 41]\n NULLIFY(&p,false); [line 41]\n APPLY_ABSTRACTION; [line 41]\n " shape="box"] +19 [label="19: Start __objc_anonymous_block_A_test2______3\nFormals: \nLocals: p:struct objc_object * \n DECLARE_LOCALS(&return,&p); [line 39]\n NULLIFY(&p,false); [line 39]\n " color=yellow style=filled] - 19 -> 18 ; -18 [label="18: Exit __objc_anonymous_block_A_test2______3 \n " color=yellow style=filled] + 19 -> 21 ; +18 [label="18: Return Stmt \n n$9=*&#GB$A_test2_sharedInstance:struct objc_object * [line 44]\n *&return:struct objc_object *=n$9 [line 44]\n REMOVE_TEMPS(n$9); [line 44]\n NULLIFY(&__objc_anonymous_block_A_test2______3,true); [line 44]\n APPLY_ABSTRACTION; [line 44]\n " shape="box"] -17 [label="17: Start __objc_anonymous_block_A_test2______3\nFormals: \nLocals: p:struct objc_object * \n DECLARE_LOCALS(&return,&p); [line 39]\n NULLIFY(&p,false); [line 39]\n " color=yellow style=filled] + 18 -> 17 ; +17 [label="17: Exit A_test2 \n " color=yellow style=filled] - 17 -> 19 ; -16 [label="16: Return Stmt \n n$9=*&#GB$A_test2_sharedInstance:struct objc_object * [line 44]\n *&return:struct objc_object *=n$9 [line 44]\n REMOVE_TEMPS(n$9); [line 44]\n NULLIFY(&__objc_anonymous_block_A_test2______3,true); [line 44]\n APPLY_ABSTRACTION; [line 44]\n " shape="box"] +16 [label="16: Start A_test2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 36]\n " color=yellow style=filled] - 16 -> 15 ; -15 [label="15: Exit A_test2 \n " color=yellow style=filled] + 16 -> 23 ; +15 [label="15: Call (_fun___objc_anonymous_block_A_test_leak______2) \n DECLARE_LOCALS(&__objc_anonymous_block_A_test_leak______2); [line 30]\n n$7=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_test_leak______2 ):unsigned long ) [line 30]\n *&__objc_anonymous_block_A_test_leak______2:class __objc_anonymous_block_A_test_leak______2 =n$7 [line 30]\n n$8=*&#GB$A_test_leak_sharedInstance:struct objc_object * [line 30]\n *n$7.A_test_leak_sharedInstance:struct objc_object *=n$8 [line 30]\n (_fun___objc_anonymous_block_A_test_leak______2)() [line 30]\n REMOVE_TEMPS(n$7,n$8); [line 30]\n NULLIFY(&__objc_anonymous_block_A_test_leak______2,true); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] -14 [label="14: Start A_test2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 36]\n " color=yellow style=filled] + 15 -> 11 ; +14 [label="14: BinaryOperatorStmt: Assign \n n$5=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 31]\n n$6=_fun_A_init(n$5:class A *) virtual [line 31]\n *&#GB$A_test_leak_sharedInstance:struct objc_object *=n$6 [line 31]\n REMOVE_TEMPS(n$5,n$6); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] - 14 -> 21 ; -13 [label="13: Call (_fun___objc_anonymous_block_A_test_leak______2) \n DECLARE_LOCALS(&__objc_anonymous_block_A_test_leak______2); [line 30]\n n$7=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_test_leak______2 ):unsigned long ) [line 30]\n *&__objc_anonymous_block_A_test_leak______2:class __objc_anonymous_block_A_test_leak______2 =n$7 [line 30]\n n$8=*&#GB$A_test_leak_sharedInstance:struct objc_object * [line 30]\n *n$7.A_test_leak_sharedInstance:struct objc_object *=n$8 [line 30]\n (_fun___objc_anonymous_block_A_test_leak______2)() [line 30]\n REMOVE_TEMPS(n$7,n$8); [line 30]\n NULLIFY(&__objc_anonymous_block_A_test_leak______2,true); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] + 14 -> 13 ; +13 [label="13: Exit __objc_anonymous_block_A_test_leak______2 \n " color=yellow style=filled] - 13 -> 9 ; -12 [label="12: BinaryOperatorStmt: Assign \n n$5=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 31]\n n$6=_fun_A_init(n$5:class A *) virtual [line 31]\n *&#GB$A_test_leak_sharedInstance:struct objc_object *=n$6 [line 31]\n REMOVE_TEMPS(n$5,n$6); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] +12 [label="12: Start __objc_anonymous_block_A_test_leak______2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 30]\n " color=yellow style=filled] - 12 -> 11 ; -11 [label="11: Exit __objc_anonymous_block_A_test_leak______2 \n " color=yellow style=filled] + 12 -> 14 ; +11 [label="11: Exit A_test_leak \n " color=yellow style=filled] -10 [label="10: Start __objc_anonymous_block_A_test_leak______2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 30]\n " color=yellow style=filled] +10 [label="10: Start A_test_leak\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 28]\n " color=yellow style=filled] - 10 -> 12 ; -9 [label="9: Exit A_test_leak \n " color=yellow style=filled] + 10 -> 15 ; +9 [label="9: Call (_fun___objc_anonymous_block_A_test______1) \n DECLARE_LOCALS(&__objc_anonymous_block_A_test______1); [line 20]\n n$3=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_test______1 ):unsigned long ) [line 20]\n *&__objc_anonymous_block_A_test______1:class __objc_anonymous_block_A_test______1 =n$3 [line 20]\n n$4=*&#GB$A_test_sharedInstance:struct objc_object * [line 20]\n *n$3.A_test_sharedInstance:struct objc_object *=n$4 [line 20]\n (_fun___objc_anonymous_block_A_test______1)() [line 20]\n REMOVE_TEMPS(n$3,n$4); [line 20]\n " shape="box"] -8 [label="8: Start A_test_leak\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 28]\n " color=yellow style=filled] + 9 -> 5 ; +8 [label="8: BinaryOperatorStmt: Assign \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 21]\n n$2=_fun_A_init(n$1:class A *) virtual [line 21]\n *&#GB$A_test_sharedInstance:struct objc_object *=n$2 [line 21]\n REMOVE_TEMPS(n$1,n$2); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] - 8 -> 13 ; -7 [label="7: Call (_fun___objc_anonymous_block_A_test______1) \n DECLARE_LOCALS(&__objc_anonymous_block_A_test______1); [line 20]\n n$3=_fun___objc_alloc_no_fail(sizeof(class __objc_anonymous_block_A_test______1 ):unsigned long ) [line 20]\n *&__objc_anonymous_block_A_test______1:class __objc_anonymous_block_A_test______1 =n$3 [line 20]\n n$4=*&#GB$A_test_sharedInstance:struct objc_object * [line 20]\n *n$3.A_test_sharedInstance:struct objc_object *=n$4 [line 20]\n (_fun___objc_anonymous_block_A_test______1)() [line 20]\n REMOVE_TEMPS(n$3,n$4); [line 20]\n " shape="box"] + 8 -> 7 ; +7 [label="7: Exit __objc_anonymous_block_A_test______1 \n " color=yellow style=filled] - 7 -> 3 ; -6 [label="6: BinaryOperatorStmt: Assign \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 21]\n n$2=_fun_A_init(n$1:class A *) virtual [line 21]\n *&#GB$A_test_sharedInstance:struct objc_object *=n$2 [line 21]\n REMOVE_TEMPS(n$1,n$2); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] +6 [label="6: Start __objc_anonymous_block_A_test______1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 20]\n " color=yellow style=filled] - 6 -> 5 ; -5 [label="5: Exit __objc_anonymous_block_A_test______1 \n " color=yellow style=filled] + 6 -> 8 ; +5 [label="5: Return Stmt \n n$0=*&#GB$A_test_sharedInstance:struct objc_object * [line 25]\n *&return:struct objc_object *=n$0 [line 25]\n REMOVE_TEMPS(n$0); [line 25]\n NULLIFY(&__objc_anonymous_block_A_test______1,true); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] -4 [label="4: Start __objc_anonymous_block_A_test______1\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 20]\n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit A_test \n " color=yellow style=filled] - 4 -> 6 ; -3 [label="3: Return Stmt \n n$0=*&#GB$A_test_sharedInstance:struct objc_object * [line 25]\n *&return:struct objc_object *=n$0 [line 25]\n REMOVE_TEMPS(n$0); [line 25]\n NULLIFY(&__objc_anonymous_block_A_test______1,true); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] +3 [label="3: Start A_test\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 18]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit A_test \n " color=yellow style=filled] + 3 -> 9 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start A_test\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 18]\n " color=yellow style=filled] +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 7 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/boxing/Boxing.dot b/infer/tests/codetoanalyze/objc/frontend/boxing/Boxing.dot index f68e9ff9b..41aa5231c 100644 --- a/infer/tests/codetoanalyze/objc/frontend/boxing/Boxing.dot +++ b/infer/tests/codetoanalyze/objc/frontend/boxing/Boxing.dot @@ -1,100 +1,107 @@ digraph iCFG { -26 [label="26: DeclStmt \n n$15=_fun_strdup(\"hello world\":char *) [line 42]\n n$16=_fun_NSString_stringWithUTF8String:(n$15:char *) [line 42]\n *&s:class NSString *=n$16 [line 42]\n REMOVE_TEMPS(n$15,n$16); [line 42]\n NULLIFY(&s,false); [line 42]\n " shape="box"] +28 [label="28: DeclStmt \n n$15=_fun_strdup(\"hello world\":char *) [line 42]\n n$16=_fun_NSString_stringWithUTF8String:(n$15:char *) [line 42]\n *&s:class NSString *=n$16 [line 42]\n REMOVE_TEMPS(n$15,n$16); [line 42]\n NULLIFY(&s,false); [line 42]\n " shape="box"] - 26 -> 25 ; -25 [label="25: Return Stmt \n n$14=_fun_NSString_stringWithUTF8String:(\"hello world\":char *) [line 43]\n *&return:class NSString *=n$14 [line 43]\n REMOVE_TEMPS(n$14); [line 43]\n APPLY_ABSTRACTION; [line 43]\n " shape="box"] + 28 -> 27 ; +27 [label="27: Return Stmt \n n$14=_fun_NSString_stringWithUTF8String:(\"hello world\":char *) [line 43]\n *&return:class NSString *=n$14 [line 43]\n REMOVE_TEMPS(n$14); [line 43]\n APPLY_ABSTRACTION; [line 43]\n " shape="box"] - 25 -> 24 ; -24 [label="24: Exit Boxing_getS \n " color=yellow style=filled] + 27 -> 26 ; +26 [label="26: Exit Boxing_getS \n " color=yellow style=filled] -23 [label="23: Start Boxing_getS\nFormals: self:class Boxing *\nLocals: s:class NSString * \n DECLARE_LOCALS(&return,&s); [line 41]\n NULLIFY(&s,false); [line 41]\n NULLIFY(&self,false); [line 41]\n " color=yellow style=filled] +25 [label="25: Start Boxing_getS\nFormals: self:class Boxing *\nLocals: s:class NSString * \n DECLARE_LOCALS(&return,&s); [line 41]\n NULLIFY(&s,false); [line 41]\n NULLIFY(&self,false); [line 41]\n " color=yellow style=filled] - 23 -> 26 ; -22 [label="22: DeclStmt \n n$13=_fun_NSNumber_numberWithBool:(1:_Bool ) [line 37]\n *&n:class NSNumber *=n$13 [line 37]\n REMOVE_TEMPS(n$13); [line 37]\n NULLIFY(&n,false); [line 37]\n " shape="box"] + 25 -> 28 ; +24 [label="24: DeclStmt \n n$13=_fun_NSNumber_numberWithBool:(1:_Bool ) [line 37]\n *&n:class NSNumber *=n$13 [line 37]\n REMOVE_TEMPS(n$13); [line 37]\n NULLIFY(&n,false); [line 37]\n " shape="box"] - 22 -> 21 ; -21 [label="21: Return Stmt \n n$12=_fun_NSNumber_numberWithBool:(1:_Bool ) [line 38]\n *&return:class NSNumber *=n$12 [line 38]\n REMOVE_TEMPS(n$12); [line 38]\n APPLY_ABSTRACTION; [line 38]\n " shape="box"] + 24 -> 23 ; +23 [label="23: Return Stmt \n n$12=_fun_NSNumber_numberWithBool:(1:_Bool ) [line 38]\n *&return:class NSNumber *=n$12 [line 38]\n REMOVE_TEMPS(n$12); [line 38]\n APPLY_ABSTRACTION; [line 38]\n " shape="box"] - 21 -> 20 ; -20 [label="20: Exit Boxing_getBool \n " color=yellow style=filled] + 23 -> 22 ; +22 [label="22: Exit Boxing_getBool \n " color=yellow style=filled] -19 [label="19: Start Boxing_getBool\nFormals: self:class Boxing *\nLocals: n:class NSNumber * \n DECLARE_LOCALS(&return,&n); [line 36]\n NULLIFY(&n,false); [line 36]\n NULLIFY(&self,false); [line 36]\n " color=yellow style=filled] +21 [label="21: Start Boxing_getBool\nFormals: self:class Boxing *\nLocals: n:class NSNumber * \n DECLARE_LOCALS(&return,&n); [line 36]\n NULLIFY(&n,false); [line 36]\n NULLIFY(&self,false); [line 36]\n " color=yellow style=filled] - 19 -> 22 ; -18 [label="18: DeclStmt \n n$11=_fun_NSNumber_numberWithDouble:(1.500000:double ) [line 32]\n *&n:class NSNumber *=n$11 [line 32]\n REMOVE_TEMPS(n$11); [line 32]\n NULLIFY(&n,false); [line 32]\n " shape="box"] + 21 -> 24 ; +20 [label="20: DeclStmt \n n$11=_fun_NSNumber_numberWithDouble:(1.500000:double ) [line 32]\n *&n:class NSNumber *=n$11 [line 32]\n REMOVE_TEMPS(n$11); [line 32]\n NULLIFY(&n,false); [line 32]\n " shape="box"] - 18 -> 17 ; -17 [label="17: Return Stmt \n n$10=_fun_NSNumber_numberWithDouble:(1.500000:double ) [line 33]\n *&return:class NSNumber *=n$10 [line 33]\n REMOVE_TEMPS(n$10); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] + 20 -> 19 ; +19 [label="19: Return Stmt \n n$10=_fun_NSNumber_numberWithDouble:(1.500000:double ) [line 33]\n *&return:class NSNumber *=n$10 [line 33]\n REMOVE_TEMPS(n$10); [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] - 17 -> 16 ; -16 [label="16: Exit Boxing_getDouble \n " color=yellow style=filled] + 19 -> 18 ; +18 [label="18: Exit Boxing_getDouble \n " color=yellow style=filled] -15 [label="15: Start Boxing_getDouble\nFormals: self:class Boxing *\nLocals: n:class NSNumber * \n DECLARE_LOCALS(&return,&n); [line 31]\n NULLIFY(&n,false); [line 31]\n NULLIFY(&self,false); [line 31]\n " color=yellow style=filled] +17 [label="17: Start Boxing_getDouble\nFormals: self:class Boxing *\nLocals: n:class NSNumber * \n DECLARE_LOCALS(&return,&n); [line 31]\n NULLIFY(&n,false); [line 31]\n NULLIFY(&self,false); [line 31]\n " color=yellow style=filled] - 15 -> 18 ; -14 [label="14: DeclStmt \n n$9=_fun_NSNumber_numberWithFloat:(1.500000:float ) [line 27]\n *&n:class NSNumber *=n$9 [line 27]\n REMOVE_TEMPS(n$9); [line 27]\n NULLIFY(&n,false); [line 27]\n " shape="box"] + 17 -> 20 ; +16 [label="16: DeclStmt \n n$9=_fun_NSNumber_numberWithFloat:(1.500000:float ) [line 27]\n *&n:class NSNumber *=n$9 [line 27]\n REMOVE_TEMPS(n$9); [line 27]\n NULLIFY(&n,false); [line 27]\n " shape="box"] - 14 -> 13 ; -13 [label="13: Return Stmt \n n$8=_fun_NSNumber_numberWithFloat:(1.500000:float ) [line 28]\n *&return:class NSNumber *=n$8 [line 28]\n REMOVE_TEMPS(n$8); [line 28]\n APPLY_ABSTRACTION; [line 28]\n " shape="box"] + 16 -> 15 ; +15 [label="15: Return Stmt \n n$8=_fun_NSNumber_numberWithFloat:(1.500000:float ) [line 28]\n *&return:class NSNumber *=n$8 [line 28]\n REMOVE_TEMPS(n$8); [line 28]\n APPLY_ABSTRACTION; [line 28]\n " shape="box"] - 13 -> 12 ; -12 [label="12: Exit Boxing_getFloat \n " color=yellow style=filled] + 15 -> 14 ; +14 [label="14: Exit Boxing_getFloat \n " color=yellow style=filled] -11 [label="11: Start Boxing_getFloat\nFormals: self:class Boxing *\nLocals: n:class NSNumber * \n DECLARE_LOCALS(&return,&n); [line 26]\n NULLIFY(&n,false); [line 26]\n NULLIFY(&self,false); [line 26]\n " color=yellow style=filled] +13 [label="13: Start Boxing_getFloat\nFormals: self:class Boxing *\nLocals: n:class NSNumber * \n DECLARE_LOCALS(&return,&n); [line 26]\n NULLIFY(&n,false); [line 26]\n NULLIFY(&self,false); [line 26]\n " color=yellow style=filled] - 11 -> 14 ; -10 [label="10: DeclStmt \n n$7=_fun_NSNumber_numberWithInt:(5:int ) [line 22]\n *&n:class NSNumber *=n$7 [line 22]\n REMOVE_TEMPS(n$7); [line 22]\n NULLIFY(&n,false); [line 22]\n " shape="box"] + 13 -> 16 ; +12 [label="12: DeclStmt \n n$7=_fun_NSNumber_numberWithInt:(5:int ) [line 22]\n *&n:class NSNumber *=n$7 [line 22]\n REMOVE_TEMPS(n$7); [line 22]\n NULLIFY(&n,false); [line 22]\n " shape="box"] - 10 -> 9 ; -9 [label="9: Return Stmt \n n$6=_fun_NSNumber_numberWithInt:(5:int ) [line 23]\n *&return:class NSNumber *=n$6 [line 23]\n REMOVE_TEMPS(n$6); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] + 12 -> 11 ; +11 [label="11: Return Stmt \n n$6=_fun_NSNumber_numberWithInt:(5:int ) [line 23]\n *&return:class NSNumber *=n$6 [line 23]\n REMOVE_TEMPS(n$6); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] - 9 -> 8 ; -8 [label="8: Exit Boxing_getInt \n " color=yellow style=filled] + 11 -> 10 ; +10 [label="10: Exit Boxing_getInt \n " color=yellow style=filled] -7 [label="7: Start Boxing_getInt\nFormals: self:class Boxing *\nLocals: n:class NSNumber * \n DECLARE_LOCALS(&return,&n); [line 21]\n NULLIFY(&n,false); [line 21]\n NULLIFY(&self,false); [line 21]\n " color=yellow style=filled] +9 [label="9: Start Boxing_getInt\nFormals: self:class Boxing *\nLocals: n:class NSNumber * \n DECLARE_LOCALS(&return,&n); [line 21]\n NULLIFY(&n,false); [line 21]\n NULLIFY(&self,false); [line 21]\n " color=yellow style=filled] - 7 -> 10 ; -6 [label="6: DeclStmt \n *&x:int =4 [line 15]\n " shape="box"] + 9 -> 12 ; +8 [label="8: DeclStmt \n *&x:int =4 [line 15]\n " shape="box"] + + + 8 -> 7 ; +7 [label="7: DeclStmt \n *&y:int =5 [line 16]\n " shape="box"] + + + 7 -> 6 ; +6 [label="6: DeclStmt \n n$3=*&x:int [line 17]\n n$4=*&y:int [line 17]\n n$5=_fun_NSNumber_numberWithInt:((n$3 + n$4):int ) [line 17]\n *&n:class NSNumber *=n$5 [line 17]\n REMOVE_TEMPS(n$3,n$4,n$5); [line 17]\n NULLIFY(&n,false); [line 17]\n " shape="box"] 6 -> 5 ; -5 [label="5: DeclStmt \n *&y:int =5 [line 16]\n " shape="box"] +5 [label="5: Return Stmt \n n$0=*&x:int [line 18]\n n$1=*&y:int [line 18]\n n$2=_fun_NSNumber_numberWithInt:((n$0 + n$1):int ) [line 18]\n *&return:class NSNumber *=n$2 [line 18]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 18]\n NULLIFY(&x,false); [line 18]\n NULLIFY(&y,false); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"] 5 -> 4 ; -4 [label="4: DeclStmt \n n$3=*&x:int [line 17]\n n$4=*&y:int [line 17]\n n$5=_fun_NSNumber_numberWithInt:((n$3 + n$4):int ) [line 17]\n *&n:class NSNumber *=n$5 [line 17]\n REMOVE_TEMPS(n$3,n$4,n$5); [line 17]\n NULLIFY(&n,false); [line 17]\n " shape="box"] +4 [label="4: Exit Boxing_getIntExp \n " color=yellow style=filled] - 4 -> 3 ; -3 [label="3: Return Stmt \n n$0=*&x:int [line 18]\n n$1=*&y:int [line 18]\n n$2=_fun_NSNumber_numberWithInt:((n$0 + n$1):int ) [line 18]\n *&return:class NSNumber *=n$2 [line 18]\n REMOVE_TEMPS(n$0,n$1,n$2); [line 18]\n NULLIFY(&x,false); [line 18]\n NULLIFY(&y,false); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"] +3 [label="3: Start Boxing_getIntExp\nFormals: self:class Boxing *\nLocals: n:class NSNumber * y:int x:int \n DECLARE_LOCALS(&return,&n,&y,&x); [line 14]\n NULLIFY(&n,false); [line 14]\n NULLIFY(&self,false); [line 14]\n NULLIFY(&x,false); [line 14]\n NULLIFY(&y,false); [line 14]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit Boxing_getIntExp \n " color=yellow style=filled] + 3 -> 8 ; +2 [label="2: Exit Boxing_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start Boxing_getIntExp\nFormals: self:class Boxing *\nLocals: n:class NSNumber * y:int x:int \n DECLARE_LOCALS(&return,&n,&y,&x); [line 14]\n NULLIFY(&n,false); [line 14]\n NULLIFY(&self,false); [line 14]\n NULLIFY(&x,false); [line 14]\n NULLIFY(&y,false); [line 14]\n " color=yellow style=filled] +1 [label="1: Start Boxing_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 6 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/conditional_operation/ConditionalOperation.dot b/infer/tests/codetoanalyze/objc/frontend/conditional_operation/ConditionalOperation.dot index 0bc48d951..b8b11da83 100644 --- a/infer/tests/codetoanalyze/objc/frontend/conditional_operation/ConditionalOperation.dot +++ b/infer/tests/codetoanalyze/objc/frontend/conditional_operation/ConditionalOperation.dot @@ -1,45 +1,52 @@ digraph iCFG { -11 [label="11: Return Stmt \n n$1=*&self:class A * [line 24]\n n$4=*&SIL_temp_conditional___6:int [line 24]\n NULLIFY(&SIL_temp_conditional___6,true); [line 24]\n n$5=_fun_A_test4:(n$1:class A *,n$4:int ) virtual [line 24]\n *&return:int =n$5 [line 24]\n REMOVE_TEMPS(n$1,n$4,n$5); [line 24]\n NULLIFY(&self,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] +13 [label="13: Return Stmt \n n$1=*&self:class A * [line 24]\n n$4=*&SIL_temp_conditional___8:int [line 24]\n NULLIFY(&SIL_temp_conditional___8,true); [line 24]\n n$5=_fun_A_test4:(n$1:class A *,n$4:int ) virtual [line 24]\n *&return:int =n$5 [line 24]\n REMOVE_TEMPS(n$1,n$4,n$5); [line 24]\n NULLIFY(&self,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] - 11 -> 5 ; -10 [label="10: ConditinalStmt Branch \n NULLIFY(&b,false); [line 24]\n DECLARE_LOCALS(&SIL_temp_conditional___6); [line 24]\n *&SIL_temp_conditional___6:int =1 [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] + 13 -> 7 ; +12 [label="12: ConditinalStmt Branch \n NULLIFY(&b,false); [line 24]\n DECLARE_LOCALS(&SIL_temp_conditional___8); [line 24]\n *&SIL_temp_conditional___8:int =1 [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] - 10 -> 6 ; -9 [label="9: ConditinalStmt Branch \n n$3=*&b:_Bool [line 24]\n DECLARE_LOCALS(&SIL_temp_conditional___6); [line 24]\n *&SIL_temp_conditional___6:int =n$3 [line 24]\n REMOVE_TEMPS(n$3); [line 24]\n NULLIFY(&b,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] + 12 -> 8 ; +11 [label="11: ConditinalStmt Branch \n n$3=*&b:_Bool [line 24]\n DECLARE_LOCALS(&SIL_temp_conditional___8); [line 24]\n *&SIL_temp_conditional___8:int =n$3 [line 24]\n REMOVE_TEMPS(n$3); [line 24]\n NULLIFY(&b,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] - 9 -> 6 ; -8 [label="8: Prune (false branch) \n n$2=*&b:_Bool [line 24]\n PRUNE((n$2 == 0), false); [line 24]\n REMOVE_TEMPS(n$2); [line 24]\n " shape="invhouse"] + 11 -> 8 ; +10 [label="10: Prune (false branch) \n n$2=*&b:_Bool [line 24]\n PRUNE((n$2 == 0), false); [line 24]\n REMOVE_TEMPS(n$2); [line 24]\n " shape="invhouse"] - 8 -> 10 ; -7 [label="7: Prune (true branch) \n n$2=*&b:_Bool [line 24]\n PRUNE((n$2 != 0), true); [line 24]\n REMOVE_TEMPS(n$2); [line 24]\n " shape="invhouse"] + 10 -> 12 ; +9 [label="9: Prune (true branch) \n n$2=*&b:_Bool [line 24]\n PRUNE((n$2 != 0), true); [line 24]\n REMOVE_TEMPS(n$2); [line 24]\n " shape="invhouse"] - 7 -> 9 ; -6 [label="6: + \n " ] + 9 -> 11 ; +8 [label="8: + \n " ] - 6 -> 11 ; -5 [label="5: Exit A_test5: \n " color=yellow style=filled] + 8 -> 13 ; +7 [label="7: Exit A_test5: \n " color=yellow style=filled] -4 [label="4: Start A_test5:\nFormals: self:class A * b:_Bool \nLocals: \n DECLARE_LOCALS(&return); [line 23]\n " color=yellow style=filled] +6 [label="6: Start A_test5:\nFormals: self:class A * b:_Bool \nLocals: \n DECLARE_LOCALS(&return); [line 23]\n " color=yellow style=filled] - 4 -> 7 ; - 4 -> 8 ; -3 [label="3: Return Stmt \n n$0=*&x:int [line 20]\n *&return:int =n$0 [line 20]\n REMOVE_TEMPS(n$0); [line 20]\n NULLIFY(&x,false); [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"] + 6 -> 9 ; + 6 -> 10 ; +5 [label="5: Return Stmt \n n$0=*&x:int [line 20]\n *&return:int =n$0 [line 20]\n REMOVE_TEMPS(n$0); [line 20]\n NULLIFY(&x,false); [line 20]\n APPLY_ABSTRACTION; [line 20]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit A_test4: \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit A_test4: \n " color=yellow style=filled] -1 [label="1: Start A_test4:\nFormals: self:class A * x:int \nLocals: \n DECLARE_LOCALS(&return); [line 19]\n NULLIFY(&self,false); [line 19]\n " color=yellow style=filled] +3 [label="3: Start A_test4:\nFormals: self:class A * x:int \nLocals: \n DECLARE_LOCALS(&return); [line 19]\n NULLIFY(&self,false); [line 19]\n " color=yellow style=filled] - 1 -> 3 ; + 3 -> 5 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/exceptions/ExceptionExample.dot b/infer/tests/codetoanalyze/objc/frontend/exceptions/ExceptionExample.dot index e15622739..f8df74651 100644 --- a/infer/tests/codetoanalyze/objc/frontend/exceptions/ExceptionExample.dot +++ b/infer/tests/codetoanalyze/objc/frontend/exceptions/ExceptionExample.dot @@ -1,45 +1,52 @@ digraph iCFG { -11 [label="11: DeclStmt \n n$7=_fun___objc_alloc_no_fail(sizeof(class NSString ):unsigned long ) [line 28]\n *&s:class NSString *=n$7 [line 28]\n REMOVE_TEMPS(n$7); [line 28]\n " shape="box"] +13 [label="13: DeclStmt \n n$7=_fun___objc_alloc_no_fail(sizeof(class NSString ):unsigned long ) [line 28]\n *&s:class NSString *=n$7 [line 28]\n REMOVE_TEMPS(n$7); [line 28]\n " shape="box"] + + + 13 -> 10 ; + 13 -> 11 ; +12 [label="12: Return Stmt \n NULLIFY(&s,false); [line 30]\n n$4=_fun_NSString_stringWithUTF8String:(\"Something is not right exception\":char *) [line 31]\n n$5=_fun_NSString_stringWithUTF8String:(\"Can't perform this operation because of this or that\":char *) [line 33]\n n$6=_fun_NSException_exceptionWithName:reason:userInfo:(n$4:class NSString *,n$5:class NSString *,0:class NSDictionary *) [line 30]\n *&return:void =n$6 [line 30]\n REMOVE_TEMPS(n$4,n$5,n$6); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] + + + 12 -> 8 ; +11 [label="11: Prune (false branch) \n n$3=*&s:class NSString * [line 29]\n PRUNE((n$3 == 0), false); [line 29]\n REMOVE_TEMPS(n$3); [line 29]\n " shape="invhouse"] - 11 -> 8 ; 11 -> 9 ; -10 [label="10: Return Stmt \n NULLIFY(&s,false); [line 30]\n n$4=_fun_NSString_stringWithUTF8String:(\"Something is not right exception\":char *) [line 31]\n n$5=_fun_NSString_stringWithUTF8String:(\"Can't perform this operation because of this or that\":char *) [line 33]\n n$6=_fun_NSException_exceptionWithName:reason:userInfo:(n$4:class NSString *,n$5:class NSString *,0:class NSDictionary *) [line 30]\n *&return:void =n$6 [line 30]\n REMOVE_TEMPS(n$4,n$5,n$6); [line 30]\n APPLY_ABSTRACTION; [line 30]\n " shape="box"] +10 [label="10: Prune (true branch) \n n$3=*&s:class NSString * [line 29]\n PRUNE((n$3 != 0), true); [line 29]\n REMOVE_TEMPS(n$3); [line 29]\n " shape="invhouse"] - 10 -> 6 ; -9 [label="9: Prune (false branch) \n n$3=*&s:class NSString * [line 29]\n PRUNE((n$3 == 0), false); [line 29]\n REMOVE_TEMPS(n$3); [line 29]\n " shape="invhouse"] + 10 -> 12 ; +9 [label="9: + \n NULLIFY(&s,false); [line 29]\n " ] - 9 -> 7 ; -8 [label="8: Prune (true branch) \n n$3=*&s:class NSString * [line 29]\n PRUNE((n$3 != 0), true); [line 29]\n REMOVE_TEMPS(n$3); [line 29]\n " shape="invhouse"] + 9 -> 8 ; +8 [label="8: Exit ExceptionExample_test1 \n " color=yellow style=filled] - 8 -> 10 ; -7 [label="7: + \n NULLIFY(&s,false); [line 29]\n " ] +7 [label="7: Start ExceptionExample_test1\nFormals: self:class ExceptionExample *\nLocals: s:class NSString * \n DECLARE_LOCALS(&return,&s); [line 27]\n NULLIFY(&s,false); [line 27]\n NULLIFY(&self,false); [line 27]\n " color=yellow style=filled] - 7 -> 6 ; -6 [label="6: Exit ExceptionExample_test1 \n " color=yellow style=filled] + 7 -> 13 ; +6 [label="6: DeclStmt \n n$2=_fun___objc_alloc_no_fail(sizeof(class NSString ):unsigned long ) [line 20]\n *&s:class NSString *=n$2 [line 20]\n REMOVE_TEMPS(n$2); [line 20]\n NULLIFY(&s,false); [line 20]\n " shape="box"] -5 [label="5: Start ExceptionExample_test1\nFormals: self:class ExceptionExample *\nLocals: s:class NSString * \n DECLARE_LOCALS(&return,&s); [line 27]\n NULLIFY(&s,false); [line 27]\n NULLIFY(&self,false); [line 27]\n " color=yellow style=filled] + 6 -> 5 ; +5 [label="5: Message Call: description \n n$0=*&self:class ExceptionExample * [line 23]\n n$1=_fun_ExceptionExample_description(n$0:class ExceptionExample *) [line 23]\n REMOVE_TEMPS(n$0,n$1); [line 23]\n NULLIFY(&self,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] - 5 -> 11 ; -4 [label="4: DeclStmt \n n$2=_fun___objc_alloc_no_fail(sizeof(class NSString ):unsigned long ) [line 20]\n *&s:class NSString *=n$2 [line 20]\n REMOVE_TEMPS(n$2); [line 20]\n NULLIFY(&s,false); [line 20]\n " shape="box"] + 5 -> 4 ; +4 [label="4: Exit ExceptionExample_test \n " color=yellow style=filled] - 4 -> 3 ; -3 [label="3: Message Call: description \n n$0=*&self:class ExceptionExample * [line 23]\n n$1=_fun_ExceptionExample_description(n$0:class ExceptionExample *) [line 23]\n REMOVE_TEMPS(n$0,n$1); [line 23]\n NULLIFY(&self,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] +3 [label="3: Start ExceptionExample_test\nFormals: self:class ExceptionExample *\nLocals: s:class NSString * \n DECLARE_LOCALS(&return,&s); [line 18]\n NULLIFY(&s,false); [line 18]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit ExceptionExample_test \n " color=yellow style=filled] + 3 -> 6 ; +2 [label="2: Exit ExceptionExample_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start ExceptionExample_test\nFormals: self:class ExceptionExample *\nLocals: s:class NSString * \n DECLARE_LOCALS(&return,&s); [line 18]\n NULLIFY(&s,false); [line 18]\n " color=yellow style=filled] +1 [label="1: Start ExceptionExample_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 4 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.dot b/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.dot index 358652826..aa115ce36 100644 --- a/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.dot +++ b/infer/tests/codetoanalyze/objc/frontend/fast_enumeration/Fast_enumeration.dot @@ -1,86 +1,93 @@ digraph iCFG { -21 [label="21: DeclStmt \n *&size:int =0 [line 26]\n " shape="box"] +23 [label="23: DeclStmt \n *&size:int =0 [line 26]\n " shape="box"] - 21 -> 20 ; -20 [label="20: DeclStmt \n *&item:class NSArray *=0 [line 27]\n NULLIFY(&item,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] + 23 -> 22 ; +22 [label="22: DeclStmt \n *&item:class NSArray *=0 [line 27]\n NULLIFY(&item,false); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] - 20 -> 15 ; -19 [label="19: BinaryOperatorStmt: AddAssign \n n$13=*&item:class NSArray * [line 29]\n n$14=_fun_NSArray_count(n$13:class NSArray *) [line 29]\n n$15=*&size:int [line 29]\n *&size:int =(n$15 + n$14) [line 29]\n REMOVE_TEMPS(n$13,n$14,n$15); [line 29]\n NULLIFY(&item,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] + 22 -> 17 ; +21 [label="21: BinaryOperatorStmt: AddAssign \n n$13=*&item:class NSArray * [line 29]\n n$14=_fun_NSArray_count(n$13:class NSArray *) [line 29]\n n$15=*&size:int [line 29]\n *&size:int =(n$15 + n$14) [line 29]\n REMOVE_TEMPS(n$13,n$14,n$15); [line 29]\n NULLIFY(&item,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] - 19 -> 15 ; -18 [label="18: Prune (false branch) \n PRUNE((n$12 == 0), false); [line 28]\n REMOVE_TEMPS(n$10,n$11,n$12); [line 28]\n " shape="invhouse"] + 21 -> 17 ; +20 [label="20: Prune (false branch) \n PRUNE((n$12 == 0), false); [line 28]\n REMOVE_TEMPS(n$10,n$11,n$12); [line 28]\n " shape="invhouse"] - 18 -> 14 ; -17 [label="17: Prune (true branch) \n PRUNE((n$12 != 0), true); [line 28]\n REMOVE_TEMPS(n$10,n$11,n$12); [line 28]\n " shape="invhouse"] + 20 -> 16 ; +19 [label="19: Prune (true branch) \n PRUNE((n$12 != 0), true); [line 28]\n REMOVE_TEMPS(n$10,n$11,n$12); [line 28]\n " shape="invhouse"] - 17 -> 19 ; -16 [label="16: BinaryOperatorStmt: Assign \n n$10=*&items:class NSArray * [line 28]\n n$11=_fun_NSArray_nextObject(n$10:class NSArray *) virtual [line 28]\n *&item:class NSArray *=n$11 [line 28]\n n$12=*&item:class NSArray * [line 28]\n " shape="box"] + 19 -> 21 ; +18 [label="18: BinaryOperatorStmt: Assign \n n$10=*&items:class NSArray * [line 28]\n n$11=_fun_NSArray_nextObject(n$10:class NSArray *) virtual [line 28]\n *&item:class NSArray *=n$11 [line 28]\n n$12=*&item:class NSArray * [line 28]\n " shape="box"] - 16 -> 17 ; - 16 -> 18 ; -15 [label="15: + \n " ] + 18 -> 19 ; + 18 -> 20 ; +17 [label="17: + \n " ] - 15 -> 16 ; -14 [label="14: Return Stmt \n NULLIFY(&item,false); [line 31]\n NULLIFY(&items,false); [line 31]\n n$9=*&size:int [line 31]\n *&return:int =n$9 [line 31]\n REMOVE_TEMPS(n$9); [line 31]\n NULLIFY(&size,false); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] + 17 -> 18 ; +16 [label="16: Return Stmt \n NULLIFY(&item,false); [line 31]\n NULLIFY(&items,false); [line 31]\n n$9=*&size:int [line 31]\n *&return:int =n$9 [line 31]\n REMOVE_TEMPS(n$9); [line 31]\n NULLIFY(&size,false); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] - 14 -> 13 ; -13 [label="13: Exit A_while_loop: \n " color=yellow style=filled] + 16 -> 15 ; +15 [label="15: Exit A_while_loop: \n " color=yellow style=filled] -12 [label="12: Start A_while_loop:\nFormals: self:class A * items:class NSArray *\nLocals: item:class NSArray * size:int \n DECLARE_LOCALS(&return,&item,&size); [line 25]\n NULLIFY(&item,false); [line 25]\n NULLIFY(&self,false); [line 25]\n NULLIFY(&size,false); [line 25]\n " color=yellow style=filled] +14 [label="14: Start A_while_loop:\nFormals: self:class A * items:class NSArray *\nLocals: item:class NSArray * size:int \n DECLARE_LOCALS(&return,&item,&size); [line 25]\n NULLIFY(&item,false); [line 25]\n NULLIFY(&self,false); [line 25]\n NULLIFY(&size,false); [line 25]\n " color=yellow style=filled] - 12 -> 21 ; -11 [label="11: DeclStmt \n *&size:int =0 [line 18]\n " shape="box"] + 14 -> 23 ; +13 [label="13: DeclStmt \n *&size:int =0 [line 18]\n " shape="box"] + + + 13 -> 12 ; +12 [label="12: BinaryOperatorStmt: Assign \n n$7=*&items:class NSArray * [line 19]\n n$8=_fun_NSArray_nextObject(n$7:class NSArray *) virtual [line 19]\n *&item:class NSArray *=n$8 [line 19]\n REMOVE_TEMPS(n$7,n$8); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] + + + 12 -> 6 ; +11 [label="11: BinaryOperatorStmt: AddAssign \n n$4=*&item:class NSArray * [line 20]\n n$5=_fun_NSArray_count(n$4:class NSArray *) [line 20]\n n$6=*&size:int [line 20]\n *&size:int =(n$6 + n$5) [line 20]\n REMOVE_TEMPS(n$4,n$5,n$6); [line 20]\n NULLIFY(&item,false); [line 20]\n " shape="box"] 11 -> 10 ; -10 [label="10: BinaryOperatorStmt: Assign \n n$7=*&items:class NSArray * [line 19]\n n$8=_fun_NSArray_nextObject(n$7:class NSArray *) virtual [line 19]\n *&item:class NSArray *=n$8 [line 19]\n REMOVE_TEMPS(n$7,n$8); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] +10 [label="10: BinaryOperatorStmt: Assign \n n$2=*&items:class NSArray * [line 19]\n n$3=_fun_NSArray_nextObject(n$2:class NSArray *) virtual [line 19]\n *&item:class NSArray *=n$3 [line 19]\n REMOVE_TEMPS(n$2,n$3); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] - 10 -> 4 ; -9 [label="9: BinaryOperatorStmt: AddAssign \n n$4=*&item:class NSArray * [line 20]\n n$5=_fun_NSArray_count(n$4:class NSArray *) [line 20]\n n$6=*&size:int [line 20]\n *&size:int =(n$6 + n$5) [line 20]\n REMOVE_TEMPS(n$4,n$5,n$6); [line 20]\n NULLIFY(&item,false); [line 20]\n " shape="box"] + 10 -> 6 ; +9 [label="9: Prune (false branch) \n PRUNE(((n$1 != 0) == 0), false); [line 19]\n REMOVE_TEMPS(n$1); [line 19]\n " shape="invhouse"] - 9 -> 8 ; -8 [label="8: BinaryOperatorStmt: Assign \n n$2=*&items:class NSArray * [line 19]\n n$3=_fun_NSArray_nextObject(n$2:class NSArray *) virtual [line 19]\n *&item:class NSArray *=n$3 [line 19]\n REMOVE_TEMPS(n$2,n$3); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] + 9 -> 5 ; +8 [label="8: Prune (true branch) \n PRUNE(((n$1 != 0) != 0), true); [line 19]\n REMOVE_TEMPS(n$1); [line 19]\n " shape="invhouse"] - 8 -> 4 ; -7 [label="7: Prune (false branch) \n PRUNE(((n$1 != 0) == 0), false); [line 19]\n REMOVE_TEMPS(n$1); [line 19]\n " shape="invhouse"] + 8 -> 11 ; +7 [label="7: BinaryOperatorStmt: NE \n n$1=*&item:class NSArray * [line 19]\n " shape="box"] - 7 -> 3 ; -6 [label="6: Prune (true branch) \n PRUNE(((n$1 != 0) != 0), true); [line 19]\n REMOVE_TEMPS(n$1); [line 19]\n " shape="invhouse"] + 7 -> 8 ; + 7 -> 9 ; +6 [label="6: + \n " ] - 6 -> 9 ; -5 [label="5: BinaryOperatorStmt: NE \n n$1=*&item:class NSArray * [line 19]\n " shape="box"] + 6 -> 7 ; +5 [label="5: Return Stmt \n NULLIFY(&item,false); [line 22]\n NULLIFY(&items,false); [line 22]\n n$0=*&size:int [line 22]\n *&return:int =n$0 [line 22]\n REMOVE_TEMPS(n$0); [line 22]\n NULLIFY(&size,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] - 5 -> 6 ; - 5 -> 7 ; -4 [label="4: + \n " ] + 5 -> 4 ; +4 [label="4: Exit A_fast_loop: \n " color=yellow style=filled] - 4 -> 5 ; -3 [label="3: Return Stmt \n NULLIFY(&item,false); [line 22]\n NULLIFY(&items,false); [line 22]\n n$0=*&size:int [line 22]\n *&return:int =n$0 [line 22]\n REMOVE_TEMPS(n$0); [line 22]\n NULLIFY(&size,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] +3 [label="3: Start A_fast_loop:\nFormals: self:class A * items:class NSArray *\nLocals: item:class NSArray * size:int \n DECLARE_LOCALS(&return,&item,&size); [line 17]\n NULLIFY(&item,false); [line 17]\n NULLIFY(&self,false); [line 17]\n NULLIFY(&size,false); [line 17]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit A_fast_loop: \n " color=yellow style=filled] + 3 -> 13 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start A_fast_loop:\nFormals: self:class A * items:class NSArray *\nLocals: item:class NSArray * size:int \n DECLARE_LOCALS(&return,&item,&size); [line 17]\n NULLIFY(&item,false); [line 17]\n NULLIFY(&self,false); [line 17]\n NULLIFY(&size,false); [line 17]\n " color=yellow style=filled] +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 11 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/predefined_expr/PredefinedExprExample.dot b/infer/tests/codetoanalyze/objc/frontend/predefined_expr/PredefinedExprExample.dot index 38d9c0290..8f3870827 100644 --- a/infer/tests/codetoanalyze/objc/frontend/predefined_expr/PredefinedExprExample.dot +++ b/infer/tests/codetoanalyze/objc/frontend/predefined_expr/PredefinedExprExample.dot @@ -1,35 +1,42 @@ digraph iCFG { -9 [label="9: Call _fun_NSLog \n n$2=_fun_NSString_stringWithUTF8String:(\"%s\":char *) [line 27]\n _fun_NSLog(n$2:struct objc_object *,\"\":char *) [line 27]\n REMOVE_TEMPS(n$2); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] +11 [label="11: Call _fun_NSLog \n n$2=_fun_NSString_stringWithUTF8String:(\"%s\":char *) [line 27]\n _fun_NSLog(n$2:struct objc_object *,\"\":char *) [line 27]\n REMOVE_TEMPS(n$2); [line 27]\n APPLY_ABSTRACTION; [line 27]\n " shape="box"] - 9 -> 8 ; -8 [label="8: Exit A_testFunct \n " color=yellow style=filled] + 11 -> 10 ; +10 [label="10: Exit A_testFunct \n " color=yellow style=filled] -7 [label="7: Start A_testFunct\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 26]\n NULLIFY(&self,false); [line 26]\n " color=yellow style=filled] +9 [label="9: Start A_testFunct\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 26]\n NULLIFY(&self,false); [line 26]\n " color=yellow style=filled] - 7 -> 9 ; -6 [label="6: Call _fun_NSLog \n n$1=_fun_NSString_stringWithUTF8String:(\"%s\":char *) [line 23]\n _fun_NSLog(n$1:struct objc_object *,\"\":char *) [line 23]\n REMOVE_TEMPS(n$1); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] + 9 -> 11 ; +8 [label="8: Call _fun_NSLog \n n$1=_fun_NSString_stringWithUTF8String:(\"%s\":char *) [line 23]\n _fun_NSLog(n$1:struct objc_object *,\"\":char *) [line 23]\n REMOVE_TEMPS(n$1); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"] - 6 -> 5 ; -5 [label="5: Exit A_testFunction \n " color=yellow style=filled] + 8 -> 7 ; +7 [label="7: Exit A_testFunction \n " color=yellow style=filled] -4 [label="4: Start A_testFunction\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 22]\n NULLIFY(&self,false); [line 22]\n " color=yellow style=filled] +6 [label="6: Start A_testFunction\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 22]\n NULLIFY(&self,false); [line 22]\n " color=yellow style=filled] - 4 -> 6 ; -3 [label="3: Call _fun_NSLog \n n$0=_fun_NSString_stringWithUTF8String:(\"%s\":char *) [line 19]\n _fun_NSLog(n$0:struct objc_object *,\"\":char *) [line 19]\n REMOVE_TEMPS(n$0); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] + 6 -> 8 ; +5 [label="5: Call _fun_NSLog \n n$0=_fun_NSString_stringWithUTF8String:(\"%s\":char *) [line 19]\n _fun_NSLog(n$0:struct objc_object *,\"\":char *) [line 19]\n REMOVE_TEMPS(n$0); [line 19]\n APPLY_ABSTRACTION; [line 19]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit A_testPrettyFunction \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit A_testPrettyFunction \n " color=yellow style=filled] -1 [label="1: Start A_testPrettyFunction\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled] +3 [label="3: Start A_testPrettyFunction\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled] - 1 -> 3 ; + 3 -> 5 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/property_in_protocol/Test.dot b/infer/tests/codetoanalyze/objc/frontend/property_in_protocol/Test.dot index e69de29bb..ca8402289 100644 --- a/infer/tests/codetoanalyze/objc/frontend/property_in_protocol/Test.dot +++ b/infer/tests/codetoanalyze/objc/frontend/property_in_protocol/Test.dot @@ -0,0 +1,9 @@ +digraph iCFG { +2 [label="2: Exit Test_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start Test_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; +} diff --git a/infer/tests/codetoanalyze/objc/frontend/protocol/protocol.dot b/infer/tests/codetoanalyze/objc/frontend/protocol/protocol.dot index 3e8646cac..b19a96b85 100644 --- a/infer/tests/codetoanalyze/objc/frontend/protocol/protocol.dot +++ b/infer/tests/codetoanalyze/objc/frontend/protocol/protocol.dot @@ -1,30 +1,37 @@ digraph iCFG { -7 [label="7: Return Stmt \n APPLY_ABSTRACTION; [line 26]\n " shape="box"] +9 [label="9: Return Stmt \n APPLY_ABSTRACTION; [line 26]\n " shape="box"] - 7 -> 2 ; -6 [label="6: Prune (false branch) \n PRUNE((n$1 == 0), false); [line 25]\n REMOVE_TEMPS(n$0,n$1); [line 25]\n " shape="invhouse"] + 9 -> 4 ; +8 [label="8: Prune (false branch) \n PRUNE((n$1 == 0), false); [line 25]\n REMOVE_TEMPS(n$0,n$1); [line 25]\n " shape="invhouse"] - 6 -> 3 ; -5 [label="5: Prune (true branch) \n PRUNE((n$1 != 0), true); [line 25]\n REMOVE_TEMPS(n$0,n$1); [line 25]\n " shape="invhouse"] + 8 -> 5 ; +7 [label="7: Prune (true branch) \n PRUNE((n$1 != 0), true); [line 25]\n REMOVE_TEMPS(n$0,n$1); [line 25]\n " shape="invhouse"] - 5 -> 7 ; -4 [label="4: Message Call: conformsToProtocol: \n n$0=*&self:class Bla * [line 25]\n n$1=_fun_Bla_conformsToProtocol:(n$0:class Bla *,\"Foo\":class Protocol *) virtual [line 25]\n NULLIFY(&self,false); [line 25]\n " shape="box"] + 7 -> 9 ; +6 [label="6: Message Call: conformsToProtocol: \n n$0=*&self:class Bla * [line 25]\n n$1=_fun_Bla_conformsToProtocol:(n$0:class Bla *,\"Foo\":class Protocol *) virtual [line 25]\n NULLIFY(&self,false); [line 25]\n " shape="box"] - 4 -> 5 ; - 4 -> 6 ; -3 [label="3: + \n " ] + 6 -> 7 ; + 6 -> 8 ; +5 [label="5: + \n " ] - 3 -> 2 ; -2 [label="2: Exit Bla_fooMethod \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit Bla_fooMethod \n " color=yellow style=filled] -1 [label="1: Start Bla_fooMethod\nFormals: self:class Bla *\nLocals: \n DECLARE_LOCALS(&return); [line 24]\n " color=yellow style=filled] +3 [label="3: Start Bla_fooMethod\nFormals: self:class Bla *\nLocals: \n DECLARE_LOCALS(&return); [line 24]\n " color=yellow style=filled] - 1 -> 4 ; + 3 -> 6 ; +2 [label="2: Exit Bla_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start Bla_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/returnstmt/void_return.dot b/infer/tests/codetoanalyze/objc/frontend/returnstmt/void_return.dot index ac7392229..af985f682 100644 --- a/infer/tests/codetoanalyze/objc/frontend/returnstmt/void_return.dot +++ b/infer/tests/codetoanalyze/objc/frontend/returnstmt/void_return.dot @@ -1,59 +1,66 @@ digraph iCFG { -14 [label="14: DeclStmt \n *&i:int =0 [line 19]\n " shape="box"] +16 [label="16: DeclStmt \n *&i:int =0 [line 19]\n " shape="box"] - 14 -> 13 ; -13 [label="13: DeclStmt \n *&j:int =0 [line 20]\n " shape="box"] + 16 -> 15 ; +15 [label="15: DeclStmt \n *&j:int =0 [line 20]\n " shape="box"] - 13 -> 9 ; -12 [label="12: Return Stmt \n NULLIFY(&i,false); [line 22]\n NULLIFY(&j,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] + 15 -> 11 ; +14 [label="14: Return Stmt \n NULLIFY(&i,false); [line 22]\n NULLIFY(&j,false); [line 22]\n APPLY_ABSTRACTION; [line 22]\n " shape="box"] - 12 -> 2 ; -11 [label="11: Prune (false branch) \n PRUNE(((n$2 == 0) == 0), false); [line 21]\n REMOVE_TEMPS(n$2); [line 21]\n " shape="invhouse"] + 14 -> 4 ; +13 [label="13: Prune (false branch) \n PRUNE(((n$2 == 0) == 0), false); [line 21]\n REMOVE_TEMPS(n$2); [line 21]\n " shape="invhouse"] - 11 -> 8 ; -10 [label="10: Prune (true branch) \n PRUNE(((n$2 == 0) != 0), true); [line 21]\n REMOVE_TEMPS(n$2); [line 21]\n " shape="invhouse"] + 13 -> 10 ; +12 [label="12: Prune (true branch) \n PRUNE(((n$2 == 0) != 0), true); [line 21]\n REMOVE_TEMPS(n$2); [line 21]\n " shape="invhouse"] - 10 -> 12 ; -9 [label="9: BinaryOperatorStmt: EQ \n n$2=*&i:int [line 21]\n " shape="box"] + 12 -> 14 ; +11 [label="11: BinaryOperatorStmt: EQ \n n$2=*&i:int [line 21]\n " shape="box"] - 9 -> 10 ; - 9 -> 11 ; -8 [label="8: + \n " ] + 11 -> 12 ; + 11 -> 13 ; +10 [label="10: + \n " ] - 8 -> 4 ; -7 [label="7: UnaryOperator \n n$1=*&i:int [line 26]\n *&i:int =(n$1 + 1) [line 26]\n REMOVE_TEMPS(n$1); [line 26]\n NULLIFY(&i,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] + 10 -> 6 ; +9 [label="9: UnaryOperator \n n$1=*&i:int [line 26]\n *&i:int =(n$1 + 1) [line 26]\n REMOVE_TEMPS(n$1); [line 26]\n NULLIFY(&i,false); [line 26]\n APPLY_ABSTRACTION; [line 26]\n " shape="box"] - 7 -> 3 ; -6 [label="6: Prune (false branch) \n PRUNE(((n$0 == 0) == 0), false); [line 25]\n REMOVE_TEMPS(n$0); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="invhouse"] + 9 -> 5 ; +8 [label="8: Prune (false branch) \n PRUNE(((n$0 == 0) == 0), false); [line 25]\n REMOVE_TEMPS(n$0); [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="invhouse"] - 6 -> 3 ; -5 [label="5: Prune (true branch) \n PRUNE(((n$0 == 0) != 0), true); [line 25]\n REMOVE_TEMPS(n$0); [line 25]\n " shape="invhouse"] + 8 -> 5 ; +7 [label="7: Prune (true branch) \n PRUNE(((n$0 == 0) != 0), true); [line 25]\n REMOVE_TEMPS(n$0); [line 25]\n " shape="invhouse"] - 5 -> 7 ; -4 [label="4: BinaryOperatorStmt: EQ \n n$0=*&j:int [line 25]\n NULLIFY(&j,false); [line 25]\n " shape="box"] + 7 -> 9 ; +6 [label="6: BinaryOperatorStmt: EQ \n n$0=*&j:int [line 25]\n NULLIFY(&j,false); [line 25]\n " shape="box"] - 4 -> 5 ; - 4 -> 6 ; -3 [label="3: + \n NULLIFY(&i,false); [line 25]\n " ] + 6 -> 7 ; + 6 -> 8 ; +5 [label="5: + \n NULLIFY(&i,false); [line 25]\n " ] - 3 -> 2 ; -2 [label="2: Exit MyClass_aMethod \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit MyClass_aMethod \n " color=yellow style=filled] -1 [label="1: Start MyClass_aMethod\nFormals: self:class MyClass *\nLocals: j:int i:int \n DECLARE_LOCALS(&return,&j,&i); [line 18]\n NULLIFY(&i,false); [line 18]\n NULLIFY(&j,false); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled] +3 [label="3: Start MyClass_aMethod\nFormals: self:class MyClass *\nLocals: j:int i:int \n DECLARE_LOCALS(&return,&j,&i); [line 18]\n NULLIFY(&i,false); [line 18]\n NULLIFY(&j,false); [line 18]\n NULLIFY(&self,false); [line 18]\n " color=yellow style=filled] - 1 -> 14 ; + 3 -> 16 ; +2 [label="2: Exit MyClass_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start MyClass_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/self_static/Self.dot b/infer/tests/codetoanalyze/objc/frontend/self_static/Self.dot index 4a786f36d..829ee478d 100644 --- a/infer/tests/codetoanalyze/objc/frontend/self_static/Self.dot +++ b/infer/tests/codetoanalyze/objc/frontend/self_static/Self.dot @@ -1,190 +1,204 @@ digraph iCFG { -51 [label="51: Return Stmt \n *&return:int =0 [line 98]\n APPLY_ABSTRACTION; [line 98]\n " shape="box"] +55 [label="55: Return Stmt \n *&return:int =0 [line 98]\n APPLY_ABSTRACTION; [line 98]\n " shape="box"] - 51 -> 45 ; -50 [label="50: Return Stmt \n *&return:int =1 [line 96]\n APPLY_ABSTRACTION; [line 96]\n " shape="box"] + 55 -> 49 ; +54 [label="54: Return Stmt \n *&return:int =1 [line 96]\n APPLY_ABSTRACTION; [line 96]\n " shape="box"] - 50 -> 45 ; -49 [label="49: Prune (false branch) \n PRUNE(((sizeof(class A ) != n$15) == 0), false); [line 95]\n REMOVE_TEMPS(n$15); [line 95]\n " shape="invhouse"] + 54 -> 49 ; +53 [label="53: Prune (false branch) \n PRUNE(((sizeof(class A ) != n$15) == 0), false); [line 95]\n REMOVE_TEMPS(n$15); [line 95]\n " shape="invhouse"] - 49 -> 51 ; -48 [label="48: Prune (true branch) \n PRUNE(((sizeof(class A ) != n$15) != 0), true); [line 95]\n REMOVE_TEMPS(n$15); [line 95]\n " shape="invhouse"] + 53 -> 55 ; +52 [label="52: Prune (true branch) \n PRUNE(((sizeof(class A ) != n$15) != 0), true); [line 95]\n REMOVE_TEMPS(n$15); [line 95]\n " shape="invhouse"] - 48 -> 50 ; -47 [label="47: BinaryOperatorStmt: NE \n n$15=*&c:struct objc_class * [line 95]\n NULLIFY(&c,false); [line 95]\n " shape="box"] + 52 -> 54 ; +51 [label="51: BinaryOperatorStmt: NE \n n$15=*&c:struct objc_class * [line 95]\n NULLIFY(&c,false); [line 95]\n " shape="box"] - 47 -> 48 ; - 47 -> 49 ; -46 [label="46: + \n NULLIFY(&c,false); [line 95]\n " ] + 51 -> 52 ; + 51 -> 53 ; +50 [label="50: + \n NULLIFY(&c,false); [line 95]\n " ] - 46 -> 45 ; -45 [label="45: Exit A_used_in_binary_op: \n " color=yellow style=filled] + 50 -> 49 ; +49 [label="49: Exit A_used_in_binary_op: \n " color=yellow style=filled] -44 [label="44: Start A_used_in_binary_op:\nFormals: c:struct objc_class *\nLocals: \n DECLARE_LOCALS(&return); [line 94]\n " color=yellow style=filled] +48 [label="48: Start A_used_in_binary_op:\nFormals: c:struct objc_class *\nLocals: \n DECLARE_LOCALS(&return); [line 94]\n " color=yellow style=filled] - 44 -> 47 ; -43 [label="43: Return Stmt \n n$14=_fun_NSStringFromClass(sizeof(class A ):unsigned long ) [line 91]\n *&return:class NSString *=n$14 [line 91]\n REMOVE_TEMPS(n$14); [line 91]\n APPLY_ABSTRACTION; [line 91]\n " shape="box"] + 48 -> 51 ; +47 [label="47: Return Stmt \n n$14=_fun_NSStringFromClass(sizeof(class A ):unsigned long ) [line 91]\n *&return:class NSString *=n$14 [line 91]\n REMOVE_TEMPS(n$14); [line 91]\n APPLY_ABSTRACTION; [line 91]\n " shape="box"] - 43 -> 42 ; -42 [label="42: Exit A_loggerName \n " color=yellow style=filled] + 47 -> 46 ; +46 [label="46: Exit A_loggerName \n " color=yellow style=filled] -41 [label="41: Start A_loggerName\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 90]\n NULLIFY(&self,false); [line 90]\n " color=yellow style=filled] +45 [label="45: Start A_loggerName\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 90]\n NULLIFY(&self,false); [line 90]\n " color=yellow style=filled] - 41 -> 43 ; -40 [label="40: Message Call: init \n n$11=*&self:class A * [line 87]\n n$12=_fun_NSObject_init(n$11:class A *) [line 87]\n REMOVE_TEMPS(n$11,n$12); [line 87]\n NULLIFY(&self,false); [line 87]\n APPLY_ABSTRACTION; [line 87]\n " shape="box"] + 45 -> 47 ; +44 [label="44: Message Call: init \n n$11=*&self:class A * [line 87]\n n$12=_fun_NSObject_init(n$11:class A *) [line 87]\n REMOVE_TEMPS(n$11,n$12); [line 87]\n NULLIFY(&self,false); [line 87]\n APPLY_ABSTRACTION; [line 87]\n " shape="box"] - 40 -> 39 ; -39 [label="39: Exit A_init \n " color=yellow style=filled] + 44 -> 43 ; +43 [label="43: Exit A_init \n " color=yellow style=filled] -38 [label="38: Start A_init\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 86]\n " color=yellow style=filled] +42 [label="42: Start A_init\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 86]\n " color=yellow style=filled] - 38 -> 40 ; -37 [label="37: Message Call: test_class \n _fun_C_test_class() [line 83]\n APPLY_ABSTRACTION; [line 83]\n " shape="box"] + 42 -> 44 ; +41 [label="41: Message Call: test_class \n _fun_C_test_class() [line 83]\n APPLY_ABSTRACTION; [line 83]\n " shape="box"] - 37 -> 36 ; -36 [label="36: Exit A_calling_super \n " color=yellow style=filled] + 41 -> 40 ; +40 [label="40: Exit A_calling_super \n " color=yellow style=filled] -35 [label="35: Start A_calling_super\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 82]\n " color=yellow style=filled] +39 [label="39: Start A_calling_super\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 82]\n " color=yellow style=filled] - 35 -> 37 ; -34 [label="34: Return Stmt \n n$8=*&object:class B * [line 79]\n n$10=_fun_B_isC:(n$8:class B *,sizeof(class A ):unsigned long ) virtual [line 79]\n *&return:_Bool =n$10 [line 79]\n REMOVE_TEMPS(n$8,n$10); [line 79]\n NULLIFY(&object,false); [line 79]\n APPLY_ABSTRACTION; [line 79]\n " shape="box"] + 39 -> 41 ; +38 [label="38: Return Stmt \n n$8=*&object:class B * [line 79]\n n$10=_fun_B_isC:(n$8:class B *,sizeof(class A ):unsigned long ) virtual [line 79]\n *&return:_Bool =n$10 [line 79]\n REMOVE_TEMPS(n$8,n$10); [line 79]\n NULLIFY(&object,false); [line 79]\n APPLY_ABSTRACTION; [line 79]\n " shape="box"] + + + 38 -> 37 ; +37 [label="37: Exit A_use_class_in_other_ways: \n " color=yellow style=filled] + + +36 [label="36: Start A_use_class_in_other_ways:\nFormals: self:class A * object:class B *\nLocals: \n DECLARE_LOCALS(&return); [line 78]\n NULLIFY(&self,false); [line 78]\n " color=yellow style=filled] + + + 36 -> 38 ; +35 [label="35: DeclStmt \n n$6=_fun___objc_alloc_no_fail(sizeof(class B ):unsigned long ) [line 74]\n n$7=_fun_NSObject_init(n$6:class B *) virtual [line 74]\n *&b:class B *=n$7 [line 74]\n REMOVE_TEMPS(n$6,n$7); [line 74]\n NULLIFY(&b,false); [line 74]\n " shape="box"] + + + 35 -> 34 ; +34 [label="34: Message Call: b_m \n _fun_B_b_m() [line 75]\n APPLY_ABSTRACTION; [line 75]\n " shape="box"] 34 -> 33 ; -33 [label="33: Exit A_use_class_in_other_ways: \n " color=yellow style=filled] +33 [label="33: Exit A_t \n " color=yellow style=filled] -32 [label="32: Start A_use_class_in_other_ways:\nFormals: self:class A * object:class B *\nLocals: \n DECLARE_LOCALS(&return); [line 78]\n NULLIFY(&self,false); [line 78]\n " color=yellow style=filled] +32 [label="32: Start A_t\nFormals: self:class A *\nLocals: b:class B * \n DECLARE_LOCALS(&return,&b); [line 73]\n NULLIFY(&b,false); [line 73]\n NULLIFY(&self,false); [line 73]\n " color=yellow style=filled] - 32 -> 34 ; -31 [label="31: DeclStmt \n n$6=_fun___objc_alloc_no_fail(sizeof(class B ):unsigned long ) [line 74]\n n$7=_fun_NSObject_init(n$6:class B *) virtual [line 74]\n *&b:class B *=n$7 [line 74]\n REMOVE_TEMPS(n$6,n$7); [line 74]\n NULLIFY(&b,false); [line 74]\n " shape="box"] + 32 -> 35 ; +31 [label="31: Message Call: test_class \n _fun_A_test_class() [line 70]\n APPLY_ABSTRACTION; [line 70]\n " shape="box"] 31 -> 30 ; -30 [label="30: Message Call: b_m \n _fun_B_b_m() [line 75]\n APPLY_ABSTRACTION; [line 75]\n " shape="box"] +30 [label="30: Exit A_call_class_instance_with_class_name \n " color=yellow style=filled] - 30 -> 29 ; -29 [label="29: Exit A_t \n " color=yellow style=filled] +29 [label="29: Start A_call_class_instance_with_class_name\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 69]\n NULLIFY(&self,false); [line 69]\n " color=yellow style=filled] -28 [label="28: Start A_t\nFormals: self:class A *\nLocals: b:class B * \n DECLARE_LOCALS(&return,&b); [line 73]\n NULLIFY(&b,false); [line 73]\n NULLIFY(&self,false); [line 73]\n " color=yellow style=filled] + 29 -> 31 ; +28 [label="28: Message Call: test_class \n _fun_A_test_class() [line 66]\n APPLY_ABSTRACTION; [line 66]\n " shape="box"] - 28 -> 31 ; -27 [label="27: Message Call: test_class \n _fun_A_test_class() [line 70]\n APPLY_ABSTRACTION; [line 70]\n " shape="box"] + 28 -> 27 ; +27 [label="27: Exit A_call_class_instance \n " color=yellow style=filled] - 27 -> 26 ; -26 [label="26: Exit A_call_class_instance_with_class_name \n " color=yellow style=filled] +26 [label="26: Start A_call_class_instance\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 65]\n NULLIFY(&self,false); [line 65]\n " color=yellow style=filled] -25 [label="25: Start A_call_class_instance_with_class_name\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 69]\n NULLIFY(&self,false); [line 69]\n " color=yellow style=filled] + 26 -> 28 ; +25 [label="25: Call alloc \n n$3=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 62]\n REMOVE_TEMPS(n$3); [line 62]\n APPLY_ABSTRACTION; [line 62]\n " shape="box"] - 25 -> 27 ; -24 [label="24: Message Call: test_class \n _fun_A_test_class() [line 66]\n APPLY_ABSTRACTION; [line 66]\n " shape="box"] + 25 -> 24 ; +24 [label="24: Exit A_call_alloc_instance \n " color=yellow style=filled] - 24 -> 23 ; -23 [label="23: Exit A_call_class_instance \n " color=yellow style=filled] +23 [label="23: Start A_call_alloc_instance\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 61]\n NULLIFY(&self,false); [line 61]\n " color=yellow style=filled] -22 [label="22: Start A_call_class_instance\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 65]\n NULLIFY(&self,false); [line 65]\n " color=yellow style=filled] + 23 -> 25 ; +22 [label="22: Call alloc \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 58]\n REMOVE_TEMPS(n$1); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] - 22 -> 24 ; -21 [label="21: Call alloc \n n$3=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 62]\n REMOVE_TEMPS(n$3); [line 62]\n APPLY_ABSTRACTION; [line 62]\n " shape="box"] + 22 -> 21 ; +21 [label="21: Exit A_call_alloc_class \n " color=yellow style=filled] - 21 -> 20 ; -20 [label="20: Exit A_call_alloc_instance \n " color=yellow style=filled] +20 [label="20: Start A_call_alloc_class\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 57]\n " color=yellow style=filled] -19 [label="19: Start A_call_alloc_instance\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 61]\n NULLIFY(&self,false); [line 61]\n " color=yellow style=filled] + 20 -> 22 ; +19 [label="19: Message Call: test_class \n _fun_A_test_class() [line 54]\n APPLY_ABSTRACTION; [line 54]\n " shape="box"] - 19 -> 21 ; -18 [label="18: Call alloc \n n$1=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 58]\n REMOVE_TEMPS(n$1); [line 58]\n APPLY_ABSTRACTION; [line 58]\n " shape="box"] + 19 -> 18 ; +18 [label="18: Exit A_call_test_class \n " color=yellow style=filled] - 18 -> 17 ; -17 [label="17: Exit A_call_alloc_class \n " color=yellow style=filled] +17 [label="17: Start A_call_test_class\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 53]\n " color=yellow style=filled] -16 [label="16: Start A_call_alloc_class\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 57]\n " color=yellow style=filled] + 17 -> 19 ; +16 [label="16: Exit A_test_class \n " color=yellow style=filled] - 16 -> 18 ; -15 [label="15: Message Call: test_class \n _fun_A_test_class() [line 54]\n APPLY_ABSTRACTION; [line 54]\n " shape="box"] +15 [label="15: Start A_test_class\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 50]\n " color=yellow style=filled] - 15 -> 14 ; -14 [label="14: Exit A_call_test_class \n " color=yellow style=filled] + 15 -> 16 ; +14 [label="14: Message Call: test \n n$0=*&self:class A * [line 47]\n _fun_A_test(n$0:class A *) virtual [line 47]\n REMOVE_TEMPS(n$0); [line 47]\n NULLIFY(&self,false); [line 47]\n APPLY_ABSTRACTION; [line 47]\n " shape="box"] -13 [label="13: Start A_call_test_class\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 53]\n " color=yellow style=filled] + 14 -> 13 ; +13 [label="13: Exit A_call_test \n " color=yellow style=filled] - 13 -> 15 ; -12 [label="12: Exit A_test_class \n " color=yellow style=filled] +12 [label="12: Start A_call_test\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 46]\n " color=yellow style=filled] -11 [label="11: Start A_test_class\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 50]\n " color=yellow style=filled] + 12 -> 14 ; +11 [label="11: Exit A_test \n " color=yellow style=filled] - 11 -> 12 ; -10 [label="10: Message Call: test \n n$0=*&self:class A * [line 47]\n _fun_A_test(n$0:class A *) virtual [line 47]\n REMOVE_TEMPS(n$0); [line 47]\n NULLIFY(&self,false); [line 47]\n APPLY_ABSTRACTION; [line 47]\n " shape="box"] +10 [label="10: Start A_test\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 43]\n NULLIFY(&self,false); [line 43]\n " color=yellow style=filled] - 10 -> 9 ; -9 [label="9: Exit A_call_test \n " color=yellow style=filled] + 10 -> 11 ; +9 [label="9: Exit A_frontendChecks \n " color=yellow style=filled] -8 [label="8: Start A_call_test\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 46]\n " color=yellow style=filled] +8 [label="8: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 8 -> 10 ; -7 [label="7: Exit A_test \n " color=yellow style=filled] + 8 -> 9 ; +7 [label="7: Return Stmt \n *&return:_Bool =1 [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] -6 [label="6: Start A_test\nFormals: self:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 43]\n NULLIFY(&self,false); [line 43]\n " color=yellow style=filled] + 7 -> 6 ; +6 [label="6: Exit B_isC: \n " color=yellow style=filled] - 6 -> 7 ; -5 [label="5: Return Stmt \n *&return:_Bool =1 [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] +5 [label="5: Start B_isC:\nFormals: self:class B * aClass:struct objc_class *\nLocals: \n DECLARE_LOCALS(&return); [line 23]\n NULLIFY(&aClass,false); [line 23]\n NULLIFY(&self,false); [line 23]\n " color=yellow style=filled] - 5 -> 4 ; -4 [label="4: Exit B_isC: \n " color=yellow style=filled] + 5 -> 7 ; +4 [label="4: Exit B_b_m \n " color=yellow style=filled] -3 [label="3: Start B_isC:\nFormals: self:class B * aClass:struct objc_class *\nLocals: \n DECLARE_LOCALS(&return); [line 23]\n NULLIFY(&aClass,false); [line 23]\n NULLIFY(&self,false); [line 23]\n " color=yellow style=filled] +3 [label="3: Start B_b_m\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 20]\n " color=yellow style=filled] - 3 -> 5 ; -2 [label="2: Exit B_b_m \n " color=yellow style=filled] + 3 -> 4 ; +2 [label="2: Exit B_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start B_b_m\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 20]\n " color=yellow style=filled] +1 [label="1: Start B_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] 1 -> 2 ; diff --git a/infer/tests/codetoanalyze/objc/frontend/self_static/static.dot b/infer/tests/codetoanalyze/objc/frontend/self_static/static.dot index 67a980e58..7ab863029 100644 --- a/infer/tests/codetoanalyze/objc/frontend/self_static/static.dot +++ b/infer/tests/codetoanalyze/objc/frontend/self_static/static.dot @@ -1,57 +1,64 @@ digraph iCFG { -15 [label="15: Message Call: getX \n n$1=*&self:class MyClass * [line 37]\n n$2=_fun_MyClass_getX(n$1:class MyClass *) virtual [line 37]\n REMOVE_TEMPS(n$1,n$2); [line 37]\n NULLIFY(&self,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] +17 [label="17: Message Call: getX \n n$1=*&self:class MyClass * [line 37]\n n$2=_fun_MyClass_getX(n$1:class MyClass *) virtual [line 37]\n REMOVE_TEMPS(n$1,n$2); [line 37]\n NULLIFY(&self,false); [line 37]\n APPLY_ABSTRACTION; [line 37]\n " shape="box"] - 15 -> 14 ; -14 [label="14: Exit MyClass_anInstanceMethod2 \n " color=yellow style=filled] + 17 -> 16 ; +16 [label="16: Exit MyClass_anInstanceMethod2 \n " color=yellow style=filled] -13 [label="13: Start MyClass_anInstanceMethod2\nFormals: self:class MyClass *\nLocals: \n DECLARE_LOCALS(&return); [line 36]\n " color=yellow style=filled] +15 [label="15: Start MyClass_anInstanceMethod2\nFormals: self:class MyClass *\nLocals: \n DECLARE_LOCALS(&return); [line 36]\n " color=yellow style=filled] - 13 -> 15 ; -12 [label="12: Return Stmt \n *&return:int =0 [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] + 15 -> 17 ; +14 [label="14: Return Stmt \n *&return:int =0 [line 33]\n APPLY_ABSTRACTION; [line 33]\n " shape="box"] - 12 -> 11 ; -11 [label="11: Exit MyClass_getX \n " color=yellow style=filled] + 14 -> 13 ; +13 [label="13: Exit MyClass_getX \n " color=yellow style=filled] -10 [label="10: Start MyClass_getX\nFormals: self:class MyClass *\nLocals: \n DECLARE_LOCALS(&return); [line 32]\n NULLIFY(&self,false); [line 32]\n " color=yellow style=filled] +12 [label="12: Start MyClass_getX\nFormals: self:class MyClass *\nLocals: \n DECLARE_LOCALS(&return); [line 32]\n NULLIFY(&self,false); [line 32]\n " color=yellow style=filled] - 10 -> 12 ; -9 [label="9: Message Call: aClassMethod \n _fun_MyClass_aClassMethod() [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] + 12 -> 14 ; +11 [label="11: Message Call: aClassMethod \n _fun_MyClass_aClassMethod() [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] - 9 -> 8 ; -8 [label="8: Exit MyClass_aClassMethod2 \n " color=yellow style=filled] + 11 -> 10 ; +10 [label="10: Exit MyClass_aClassMethod2 \n " color=yellow style=filled] -7 [label="7: Start MyClass_aClassMethod2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 28]\n " color=yellow style=filled] +9 [label="9: Start MyClass_aClassMethod2\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 28]\n " color=yellow style=filled] - 7 -> 9 ; -6 [label="6: Message Call: aClassMethod \n _fun_MyClass_aClassMethod() [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] + 9 -> 11 ; +8 [label="8: Message Call: aClassMethod \n _fun_MyClass_aClassMethod() [line 25]\n APPLY_ABSTRACTION; [line 25]\n " shape="box"] - 6 -> 5 ; -5 [label="5: Exit MyClass_anInstanceMethod \n " color=yellow style=filled] + 8 -> 7 ; +7 [label="7: Exit MyClass_anInstanceMethod \n " color=yellow style=filled] -4 [label="4: Start MyClass_anInstanceMethod\nFormals: self:class MyClass *\nLocals: \n DECLARE_LOCALS(&return); [line 24]\n NULLIFY(&self,false); [line 24]\n " color=yellow style=filled] +6 [label="6: Start MyClass_anInstanceMethod\nFormals: self:class MyClass *\nLocals: \n DECLARE_LOCALS(&return); [line 24]\n NULLIFY(&self,false); [line 24]\n " color=yellow style=filled] - 4 -> 6 ; -3 [label="3: DeclStmt \n n$0=_fun___objc_alloc_no_fail(sizeof(class MyClass ):unsigned long ) [line 21]\n *&myClass:class MyClass *=n$0 [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n NULLIFY(&myClass,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] + 6 -> 8 ; +5 [label="5: DeclStmt \n n$0=_fun___objc_alloc_no_fail(sizeof(class MyClass ):unsigned long ) [line 21]\n *&myClass:class MyClass *=n$0 [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n NULLIFY(&myClass,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit MyClass_aClassMethod \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit MyClass_aClassMethod \n " color=yellow style=filled] -1 [label="1: Start MyClass_aClassMethod\nFormals: \nLocals: myClass:class MyClass * \n DECLARE_LOCALS(&return,&myClass); [line 20]\n NULLIFY(&myClass,false); [line 20]\n " color=yellow style=filled] +3 [label="3: Start MyClass_aClassMethod\nFormals: \nLocals: myClass:class MyClass * \n DECLARE_LOCALS(&return,&myClass); [line 20]\n NULLIFY(&myClass,false); [line 20]\n " color=yellow style=filled] - 1 -> 3 ; + 3 -> 5 ; +2 [label="2: Exit MyClass_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start MyClass_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/subclass/MyClass.dot b/infer/tests/codetoanalyze/objc/frontend/subclass/MyClass.dot index 5b5e1a2fa..26a443022 100644 --- a/infer/tests/codetoanalyze/objc/frontend/subclass/MyClass.dot +++ b/infer/tests/codetoanalyze/objc/frontend/subclass/MyClass.dot @@ -1,13 +1,20 @@ digraph iCFG { -3 [label="3: Return Stmt \n *&return:int =1 [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] +5 [label="5: Return Stmt \n *&return:int =1 [line 15]\n APPLY_ABSTRACTION; [line 15]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit MyClass_myNumber \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit MyClass_myNumber \n " color=yellow style=filled] -1 [label="1: Start MyClass_myNumber\nFormals: self:class MyClass *\nLocals: \n DECLARE_LOCALS(&return); [line 14]\n NULLIFY(&self,false); [line 14]\n " color=yellow style=filled] +3 [label="3: Start MyClass_myNumber\nFormals: self:class MyClass *\nLocals: \n DECLARE_LOCALS(&return); [line 14]\n NULLIFY(&self,false); [line 14]\n " color=yellow style=filled] - 1 -> 3 ; + 3 -> 5 ; +2 [label="2: Exit MyClass_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start MyClass_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/subclass/MySubClass.dot b/infer/tests/codetoanalyze/objc/frontend/subclass/MySubClass.dot index bf63f93ca..3297a1959 100644 --- a/infer/tests/codetoanalyze/objc/frontend/subclass/MySubClass.dot +++ b/infer/tests/codetoanalyze/objc/frontend/subclass/MySubClass.dot @@ -1,17 +1,24 @@ digraph iCFG { -4 [label="4: DeclStmt \n n$1=*&self:class MySubclass * [line 17]\n n$2=_fun_MyClass_myNumber(n$1:class MySubclass *) [line 17]\n *&subclassNumber:int =(n$2 + 1) [line 17]\n REMOVE_TEMPS(n$1,n$2); [line 17]\n NULLIFY(&self,false); [line 17]\n " shape="box"] +6 [label="6: DeclStmt \n n$1=*&self:class MySubclass * [line 17]\n n$2=_fun_MyClass_myNumber(n$1:class MySubclass *) [line 17]\n *&subclassNumber:int =(n$2 + 1) [line 17]\n REMOVE_TEMPS(n$1,n$2); [line 17]\n NULLIFY(&self,false); [line 17]\n " shape="box"] - 4 -> 3 ; -3 [label="3: Return Stmt \n n$0=*&subclassNumber:int [line 18]\n *&return:int =n$0 [line 18]\n REMOVE_TEMPS(n$0); [line 18]\n NULLIFY(&subclassNumber,false); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"] + 6 -> 5 ; +5 [label="5: Return Stmt \n n$0=*&subclassNumber:int [line 18]\n *&return:int =n$0 [line 18]\n REMOVE_TEMPS(n$0); [line 18]\n NULLIFY(&subclassNumber,false); [line 18]\n APPLY_ABSTRACTION; [line 18]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit MySubclass_myNumber \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit MySubclass_myNumber \n " color=yellow style=filled] -1 [label="1: Start MySubclass_myNumber\nFormals: self:class MySubclass *\nLocals: subclassNumber:int \n DECLARE_LOCALS(&return,&subclassNumber); [line 15]\n NULLIFY(&subclassNumber,false); [line 15]\n " color=yellow style=filled] +3 [label="3: Start MySubclass_myNumber\nFormals: self:class MySubclass *\nLocals: subclassNumber:int \n DECLARE_LOCALS(&return,&subclassNumber); [line 15]\n NULLIFY(&subclassNumber,false); [line 15]\n " color=yellow style=filled] - 1 -> 4 ; + 3 -> 6 ; +2 [label="2: Exit MySubclass_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start MySubclass_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/types/attributes.dot b/infer/tests/codetoanalyze/objc/frontend/types/attributes.dot index 9869dc102..0ccf7f41f 100644 --- a/infer/tests/codetoanalyze/objc/frontend/types/attributes.dot +++ b/infer/tests/codetoanalyze/objc/frontend/types/attributes.dot @@ -1,57 +1,64 @@ digraph iCFG { -14 [label="14: DeclStmt \n *&aWeakRef:class A __weak *=0 [line 22]\n " shape="box"] +16 [label="16: DeclStmt \n *&aWeakRef:class A __weak *=0 [line 22]\n " shape="box"] + + + 16 -> 15 ; +15 [label="15: DeclStmt \n _fun___objc_retain(0:class A *) [line 23]\n *&aStrongRef:class A *=0 [line 23]\n NULLIFY(&aStrongRef,false); [line 23]\n " shape="box"] + + + 15 -> 14 ; +14 [label="14: DeclStmt \n *&anUnsafeUnretRef:class A __unsafe_unretained *=0 [line 24]\n " shape="box"] 14 -> 13 ; -13 [label="13: DeclStmt \n _fun___objc_retain(0:class A *) [line 23]\n *&aStrongRef:class A *=0 [line 23]\n NULLIFY(&aStrongRef,false); [line 23]\n " shape="box"] +13 [label="13: DeclStmt \n _fun___objc_retain(0:class A __autoreleasing *) [line 25]\n _fun___set_autorelease_attribute(0:class A __autoreleasing *) [line 25]\n *&anAutoRelRef:class A __autoreleasing *=0 [line 25]\n " shape="box"] 13 -> 12 ; -12 [label="12: DeclStmt \n *&anUnsafeUnretRef:class A __unsafe_unretained *=0 [line 24]\n " shape="box"] +12 [label="12: DeclStmt \n _fun___objc_retain(0:class A *) [line 26]\n *&aStdRef:class A *=0 [line 26]\n " shape="box"] 12 -> 11 ; -11 [label="11: DeclStmt \n _fun___objc_retain(0:class A __autoreleasing *) [line 25]\n _fun___set_autorelease_attribute(0:class A __autoreleasing *) [line 25]\n *&anAutoRelRef:class A __autoreleasing *=0 [line 25]\n " shape="box"] +11 [label="11: BinaryOperatorStmt: Assign \n n$9=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 29]\n *&aStrongRef:class A *=n$9 [line 29]\n REMOVE_TEMPS(n$9); [line 29]\n " shape="box"] 11 -> 10 ; -10 [label="10: DeclStmt \n _fun___objc_retain(0:class A *) [line 26]\n *&aStdRef:class A *=0 [line 26]\n " shape="box"] +10 [label="10: BinaryOperatorStmt: Assign \n n$7=*&aStrongRef:class A * [line 31]\n _fun___objc_retain(n$7:class A *) [line 31]\n n$8=*&aStdRef:class A * [line 31]\n *&aStdRef:class A *=n$7 [line 31]\n _fun___objc_release(n$8:class A *) [line 31]\n REMOVE_TEMPS(n$7,n$8); [line 31]\n " shape="box"] 10 -> 9 ; -9 [label="9: BinaryOperatorStmt: Assign \n n$9=_fun___objc_alloc_no_fail(sizeof(class A ):unsigned long ) [line 29]\n *&aStrongRef:class A *=n$9 [line 29]\n REMOVE_TEMPS(n$9); [line 29]\n " shape="box"] +9 [label="9: BinaryOperatorStmt: Assign \n _fun___objc_retain(0:class A *) [line 33]\n n$6=*&aStrongRef:class A * [line 33]\n *&aStrongRef:class A *=0 [line 33]\n _fun___objc_release(n$6:class A *) [line 33]\n REMOVE_TEMPS(n$6); [line 33]\n NULLIFY(&aStrongRef,false); [line 33]\n " shape="box"] 9 -> 8 ; -8 [label="8: BinaryOperatorStmt: Assign \n n$7=*&aStrongRef:class A * [line 31]\n _fun___objc_retain(n$7:class A *) [line 31]\n n$8=*&aStdRef:class A * [line 31]\n *&aStdRef:class A *=n$7 [line 31]\n _fun___objc_release(n$8:class A *) [line 31]\n REMOVE_TEMPS(n$7,n$8); [line 31]\n " shape="box"] +8 [label="8: BinaryOperatorStmt: Assign \n n$4=*&aStdRef:class A * [line 35]\n _fun___objc_retain(n$4:class A *) [line 35]\n n$5=*&aWeakRef:class A * [line 35]\n *&aWeakRef:class A *=n$4 [line 35]\n _fun___objc_release(n$5:class A *) [line 35]\n REMOVE_TEMPS(n$4,n$5); [line 35]\n NULLIFY(&aWeakRef,false); [line 35]\n " shape="box"] 8 -> 7 ; -7 [label="7: BinaryOperatorStmt: Assign \n _fun___objc_retain(0:class A *) [line 33]\n n$6=*&aStrongRef:class A * [line 33]\n *&aStrongRef:class A *=0 [line 33]\n _fun___objc_release(n$6:class A *) [line 33]\n REMOVE_TEMPS(n$6); [line 33]\n NULLIFY(&aStrongRef,false); [line 33]\n " shape="box"] +7 [label="7: BinaryOperatorStmt: Assign \n n$2=*&aStdRef:class A * [line 37]\n _fun___objc_retain(n$2:class A *) [line 37]\n n$3=*&anAutoRelRef:class A * [line 37]\n *&anAutoRelRef:class A *=n$2 [line 37]\n _fun___objc_release(n$3:class A *) [line 37]\n REMOVE_TEMPS(n$2,n$3); [line 37]\n NULLIFY(&anAutoRelRef,false); [line 37]\n " shape="box"] 7 -> 6 ; -6 [label="6: BinaryOperatorStmt: Assign \n n$4=*&aStdRef:class A * [line 35]\n _fun___objc_retain(n$4:class A *) [line 35]\n n$5=*&aWeakRef:class A * [line 35]\n *&aWeakRef:class A *=n$4 [line 35]\n _fun___objc_release(n$5:class A *) [line 35]\n REMOVE_TEMPS(n$4,n$5); [line 35]\n NULLIFY(&aWeakRef,false); [line 35]\n " shape="box"] +6 [label="6: BinaryOperatorStmt: Assign \n n$0=*&aStdRef:class A * [line 39]\n _fun___objc_retain(n$0:class A *) [line 39]\n n$1=*&anUnsafeUnretRef:class A * [line 39]\n *&anUnsafeUnretRef:class A *=n$0 [line 39]\n _fun___objc_release(n$1:class A *) [line 39]\n REMOVE_TEMPS(n$0,n$1); [line 39]\n NULLIFY(&aStdRef,false); [line 39]\n NULLIFY(&anUnsafeUnretRef,false); [line 39]\n " shape="box"] 6 -> 5 ; -5 [label="5: BinaryOperatorStmt: Assign \n n$2=*&aStdRef:class A * [line 37]\n _fun___objc_retain(n$2:class A *) [line 37]\n n$3=*&anAutoRelRef:class A * [line 37]\n *&anAutoRelRef:class A *=n$2 [line 37]\n _fun___objc_release(n$3:class A *) [line 37]\n REMOVE_TEMPS(n$2,n$3); [line 37]\n NULLIFY(&anAutoRelRef,false); [line 37]\n " shape="box"] +5 [label="5: Return Stmt \n *&return:int =0 [line 42]\n APPLY_ABSTRACTION; [line 42]\n " shape="box"] 5 -> 4 ; -4 [label="4: BinaryOperatorStmt: Assign \n n$0=*&aStdRef:class A * [line 39]\n _fun___objc_retain(n$0:class A *) [line 39]\n n$1=*&anUnsafeUnretRef:class A * [line 39]\n *&anUnsafeUnretRef:class A *=n$0 [line 39]\n _fun___objc_release(n$1:class A *) [line 39]\n REMOVE_TEMPS(n$0,n$1); [line 39]\n NULLIFY(&aStdRef,false); [line 39]\n NULLIFY(&anUnsafeUnretRef,false); [line 39]\n " shape="box"] +4 [label="4: Exit main \n " color=yellow style=filled] - 4 -> 3 ; -3 [label="3: Return Stmt \n *&return:int =0 [line 42]\n APPLY_ABSTRACTION; [line 42]\n " shape="box"] +3 [label="3: Start main\nFormals: \nLocals: aStdRef:class A * anAutoRelRef:class A __autoreleasing * anUnsafeUnretRef:class A __unsafe_unretained * aStrongRef:class A * aWeakRef:class A __weak * \n DECLARE_LOCALS(&return,&aStdRef,&anAutoRelRef,&anUnsafeUnretRef,&aStrongRef,&aWeakRef); [line 20]\n NULLIFY(&aStdRef,false); [line 20]\n NULLIFY(&aStrongRef,false); [line 20]\n NULLIFY(&aWeakRef,false); [line 20]\n NULLIFY(&anAutoRelRef,false); [line 20]\n NULLIFY(&anUnsafeUnretRef,false); [line 20]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit main \n " color=yellow style=filled] + 3 -> 16 ; +2 [label="2: Exit A_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start main\nFormals: \nLocals: aStdRef:class A * anAutoRelRef:class A __autoreleasing * anUnsafeUnretRef:class A __unsafe_unretained * aStrongRef:class A * aWeakRef:class A __weak * \n DECLARE_LOCALS(&return,&aStdRef,&anAutoRelRef,&anUnsafeUnretRef,&aStrongRef,&aWeakRef); [line 20]\n NULLIFY(&aStdRef,false); [line 20]\n NULLIFY(&aStrongRef,false); [line 20]\n NULLIFY(&aWeakRef,false); [line 20]\n NULLIFY(&anAutoRelRef,false); [line 20]\n NULLIFY(&anUnsafeUnretRef,false); [line 20]\n " color=yellow style=filled] +1 [label="1: Start A_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 14 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/types/testloop.dot b/infer/tests/codetoanalyze/objc/frontend/types/testloop.dot index cd5582ab9..e1eea4de2 100644 --- a/infer/tests/codetoanalyze/objc/frontend/types/testloop.dot +++ b/infer/tests/codetoanalyze/objc/frontend/types/testloop.dot @@ -1,13 +1,20 @@ digraph iCFG { -3 [label="3: Return Stmt \n n$0=*&#GB$__iPhoneVideoAdLayout:struct FBVideoAdLayout [line 45]\n *&return:struct FBVideoAdLayout =n$0 [line 45]\n REMOVE_TEMPS(n$0); [line 45]\n APPLY_ABSTRACTION; [line 45]\n " shape="box"] +5 [label="5: Return Stmt \n n$0=*&#GB$__iPhoneVideoAdLayout:struct FBVideoAdLayout [line 45]\n *&return:struct FBVideoAdLayout =n$0 [line 45]\n REMOVE_TEMPS(n$0); [line 45]\n APPLY_ABSTRACTION; [line 45]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit FBScrollViewDelegateProxy_layoutToUse \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit FBScrollViewDelegateProxy_layoutToUse \n " color=yellow style=filled] -1 [label="1: Start FBScrollViewDelegateProxy_layoutToUse\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 44]\n " color=yellow style=filled] +3 [label="3: Start FBScrollViewDelegateProxy_layoutToUse\nFormals: \nLocals: \n DECLARE_LOCALS(&return); [line 44]\n " color=yellow style=filled] - 1 -> 3 ; + 3 -> 5 ; +2 [label="2: Exit FBScrollViewDelegateProxy_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start FBScrollViewDelegateProxy_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/types/void_call.dot b/infer/tests/codetoanalyze/objc/frontend/types/void_call.dot index 0c8c61964..3c5d168ba 100644 --- a/infer/tests/codetoanalyze/objc/frontend/types/void_call.dot +++ b/infer/tests/codetoanalyze/objc/frontend/types/void_call.dot @@ -1,94 +1,101 @@ digraph iCFG { -24 [label="24: DeclStmt \n *&x:int =1 [line 35]\n " shape="box"] +26 [label="26: DeclStmt \n *&x:int =1 [line 35]\n " shape="box"] + + + 26 -> 25 ; +25 [label="25: Call _fun_foo1 \n n$9=*&x:int [line 36]\n _fun_foo1(n$9:int ) [line 36]\n REMOVE_TEMPS(n$9); [line 36]\n " shape="box"] + + + 25 -> 24 ; +24 [label="24: BinaryOperatorStmt: Assign \n n$7=*&x:int [line 38]\n n$8=_fun_bar1(n$7:int ) [line 38]\n *&x:int =n$8 [line 38]\n REMOVE_TEMPS(n$7,n$8); [line 38]\n " shape="box"] 24 -> 23 ; -23 [label="23: Call _fun_foo1 \n n$9=*&x:int [line 36]\n _fun_foo1(n$9:int ) [line 36]\n REMOVE_TEMPS(n$9); [line 36]\n " shape="box"] +23 [label="23: DeclStmt \n n$6=_fun___objc_alloc_no_fail(sizeof(class AClass ):unsigned long ) [line 40]\n *&o:class AClass *=n$6 [line 40]\n REMOVE_TEMPS(n$6); [line 40]\n " shape="box"] - 23 -> 22 ; -22 [label="22: BinaryOperatorStmt: Assign \n n$7=*&x:int [line 38]\n n$8=_fun_bar1(n$7:int ) [line 38]\n *&x:int =n$8 [line 38]\n REMOVE_TEMPS(n$7,n$8); [line 38]\n " shape="box"] + 23 -> 19 ; + 23 -> 20 ; +22 [label="22: Message Call: foo: \n n$4=*&o:class AClass * [line 44]\n n$5=*&x:int [line 44]\n _fun_AClass_foo:(n$4:class AClass *,n$5:int ) virtual [line 44]\n REMOVE_TEMPS(n$4,n$5); [line 44]\n " shape="box"] 22 -> 21 ; -21 [label="21: DeclStmt \n n$6=_fun___objc_alloc_no_fail(sizeof(class AClass ):unsigned long ) [line 40]\n *&o:class AClass *=n$6 [line 40]\n REMOVE_TEMPS(n$6); [line 40]\n " shape="box"] +21 [label="21: BinaryOperatorStmt: Assign \n n$1=*&o:class AClass * [line 45]\n n$2=*&x:int [line 45]\n n$3=_fun_AClass_bar:(n$1:class AClass *,n$2:int ) virtual [line 45]\n *&x:int =n$3 [line 45]\n REMOVE_TEMPS(n$1,n$2,n$3); [line 45]\n NULLIFY(&o,false); [line 45]\n NULLIFY(&x,false); [line 45]\n APPLY_ABSTRACTION; [line 45]\n " shape="box"] - 21 -> 17 ; 21 -> 18 ; -20 [label="20: Message Call: foo: \n n$4=*&o:class AClass * [line 44]\n n$5=*&x:int [line 44]\n _fun_AClass_foo:(n$4:class AClass *,n$5:int ) virtual [line 44]\n REMOVE_TEMPS(n$4,n$5); [line 44]\n " shape="box"] +20 [label="20: Prune (false branch) \n n$0=*&o:class AClass * [line 42]\n PRUNE((n$0 == 0), false); [line 42]\n REMOVE_TEMPS(n$0); [line 42]\n APPLY_ABSTRACTION; [line 42]\n " shape="invhouse"] - 20 -> 19 ; -19 [label="19: BinaryOperatorStmt: Assign \n n$1=*&o:class AClass * [line 45]\n n$2=*&x:int [line 45]\n n$3=_fun_AClass_bar:(n$1:class AClass *,n$2:int ) virtual [line 45]\n *&x:int =n$3 [line 45]\n REMOVE_TEMPS(n$1,n$2,n$3); [line 45]\n NULLIFY(&o,false); [line 45]\n NULLIFY(&x,false); [line 45]\n APPLY_ABSTRACTION; [line 45]\n " shape="box"] + 20 -> 18 ; +19 [label="19: Prune (true branch) \n n$0=*&o:class AClass * [line 42]\n PRUNE((n$0 != 0), true); [line 42]\n REMOVE_TEMPS(n$0); [line 42]\n " shape="invhouse"] - 19 -> 16 ; -18 [label="18: Prune (false branch) \n n$0=*&o:class AClass * [line 42]\n PRUNE((n$0 == 0), false); [line 42]\n REMOVE_TEMPS(n$0); [line 42]\n APPLY_ABSTRACTION; [line 42]\n " shape="invhouse"] + 19 -> 22 ; +18 [label="18: + \n " ] - 18 -> 16 ; -17 [label="17: Prune (true branch) \n n$0=*&o:class AClass * [line 42]\n PRUNE((n$0 != 0), true); [line 42]\n REMOVE_TEMPS(n$0); [line 42]\n " shape="invhouse"] + 18 -> 17 ; +17 [label="17: Return Stmt \n NULLIFY(&o,false); [line 48]\n NULLIFY(&x,false); [line 48]\n *&return:int =0 [line 48]\n APPLY_ABSTRACTION; [line 48]\n " shape="box"] - 17 -> 20 ; -16 [label="16: + \n " ] + 17 -> 16 ; +16 [label="16: Exit main \n " color=yellow style=filled] - 16 -> 15 ; -15 [label="15: Return Stmt \n NULLIFY(&o,false); [line 48]\n NULLIFY(&x,false); [line 48]\n *&return:int =0 [line 48]\n APPLY_ABSTRACTION; [line 48]\n " shape="box"] +15 [label="15: Start main\nFormals: \nLocals: o:class AClass * x:int \n DECLARE_LOCALS(&return,&o,&x); [line 33]\n NULLIFY(&o,false); [line 33]\n NULLIFY(&x,false); [line 33]\n " color=yellow style=filled] - 15 -> 14 ; -14 [label="14: Exit main \n " color=yellow style=filled] + 15 -> 26 ; +14 [label="14: Return Stmt \n n$0=*&a:int [line 31]\n *&a:int =(n$0 + 1) [line 31]\n *&return:int =n$0 [line 31]\n REMOVE_TEMPS(n$0); [line 31]\n NULLIFY(&a,false); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] -13 [label="13: Start main\nFormals: \nLocals: o:class AClass * x:int \n DECLARE_LOCALS(&return,&o,&x); [line 33]\n NULLIFY(&o,false); [line 33]\n NULLIFY(&x,false); [line 33]\n " color=yellow style=filled] + 14 -> 13 ; +13 [label="13: Exit bar1 \n " color=yellow style=filled] - 13 -> 24 ; -12 [label="12: Return Stmt \n n$0=*&a:int [line 31]\n *&a:int =(n$0 + 1) [line 31]\n *&return:int =n$0 [line 31]\n REMOVE_TEMPS(n$0); [line 31]\n NULLIFY(&a,false); [line 31]\n APPLY_ABSTRACTION; [line 31]\n " shape="box"] +12 [label="12: Start bar1\nFormals: a:int \nLocals: \n DECLARE_LOCALS(&return); [line 31]\n " color=yellow style=filled] - 12 -> 11 ; -11 [label="11: Exit bar1 \n " color=yellow style=filled] + 12 -> 14 ; +11 [label="11: UnaryOperator \n n$0=*&a:int [line 29]\n *&a:int =(n$0 + 1) [line 29]\n REMOVE_TEMPS(n$0); [line 29]\n NULLIFY(&a,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] -10 [label="10: Start bar1\nFormals: a:int \nLocals: \n DECLARE_LOCALS(&return); [line 31]\n " color=yellow style=filled] + 11 -> 10 ; +10 [label="10: Exit foo1 \n " color=yellow style=filled] - 10 -> 12 ; -9 [label="9: UnaryOperator \n n$0=*&a:int [line 29]\n *&a:int =(n$0 + 1) [line 29]\n REMOVE_TEMPS(n$0); [line 29]\n NULLIFY(&a,false); [line 29]\n APPLY_ABSTRACTION; [line 29]\n " shape="box"] +9 [label="9: Start foo1\nFormals: a:int \nLocals: \n DECLARE_LOCALS(&return); [line 29]\n " color=yellow style=filled] - 9 -> 8 ; -8 [label="8: Exit foo1 \n " color=yellow style=filled] + 9 -> 11 ; +8 [label="8: Return Stmt \n n$1=*&a:int [line 24]\n *&a:int =(n$1 + 1) [line 24]\n *&return:int =n$1 [line 24]\n REMOVE_TEMPS(n$1); [line 24]\n NULLIFY(&a,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] -7 [label="7: Start foo1\nFormals: a:int \nLocals: \n DECLARE_LOCALS(&return); [line 29]\n " color=yellow style=filled] + 8 -> 7 ; +7 [label="7: Exit AClass_bar: \n " color=yellow style=filled] - 7 -> 9 ; -6 [label="6: Return Stmt \n n$1=*&a:int [line 24]\n *&a:int =(n$1 + 1) [line 24]\n *&return:int =n$1 [line 24]\n REMOVE_TEMPS(n$1); [line 24]\n NULLIFY(&a,false); [line 24]\n APPLY_ABSTRACTION; [line 24]\n " shape="box"] +6 [label="6: Start AClass_bar:\nFormals: self:class AClass * a:int \nLocals: \n DECLARE_LOCALS(&return); [line 23]\n NULLIFY(&self,false); [line 23]\n " color=yellow style=filled] - 6 -> 5 ; -5 [label="5: Exit AClass_bar: \n " color=yellow style=filled] + 6 -> 8 ; +5 [label="5: UnaryOperator \n n$0=*&a:int [line 21]\n *&a:int =(n$0 + 1) [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n NULLIFY(&a,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] -4 [label="4: Start AClass_bar:\nFormals: self:class AClass * a:int \nLocals: \n DECLARE_LOCALS(&return); [line 23]\n NULLIFY(&self,false); [line 23]\n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit AClass_foo: \n " color=yellow style=filled] - 4 -> 6 ; -3 [label="3: UnaryOperator \n n$0=*&a:int [line 21]\n *&a:int =(n$0 + 1) [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n NULLIFY(&a,false); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] +3 [label="3: Start AClass_foo:\nFormals: self:class AClass * a:int \nLocals: \n DECLARE_LOCALS(&return); [line 20]\n NULLIFY(&self,false); [line 20]\n " color=yellow style=filled] - 3 -> 2 ; -2 [label="2: Exit AClass_foo: \n " color=yellow style=filled] + 3 -> 5 ; +2 [label="2: Exit AClass_frontendChecks \n " color=yellow style=filled] -1 [label="1: Start AClass_foo:\nFormals: self:class AClass * a:int \nLocals: \n DECLARE_LOCALS(&return); [line 20]\n NULLIFY(&self,false); [line 20]\n " color=yellow style=filled] +1 [label="1: Start AClass_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] - 1 -> 3 ; + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/vardecl/aclass.dot b/infer/tests/codetoanalyze/objc/frontend/vardecl/aclass.dot index 4b4f2490d..e688cc50d 100644 --- a/infer/tests/codetoanalyze/objc/frontend/vardecl/aclass.dot +++ b/infer/tests/codetoanalyze/objc/frontend/vardecl/aclass.dot @@ -1,13 +1,20 @@ digraph iCFG { -3 [label="3: Return Stmt \n n$0=*&#GB$aVariable:class NSObject * [line 21]\n *&return:class NSObject *=n$0 [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] +5 [label="5: Return Stmt \n n$0=*&#GB$aVariable:class NSObject * [line 21]\n *&return:class NSObject *=n$0 [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit AClass_sharedInstance \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit AClass_sharedInstance \n " color=yellow style=filled] -1 [label="1: Start AClass_sharedInstance\nFormals: self:class AClass *\nLocals: \n DECLARE_LOCALS(&return); [line 20]\n NULLIFY(&self,false); [line 20]\n " color=yellow style=filled] +3 [label="3: Start AClass_sharedInstance\nFormals: self:class AClass *\nLocals: \n DECLARE_LOCALS(&return); [line 20]\n NULLIFY(&self,false); [line 20]\n " color=yellow style=filled] - 1 -> 3 ; + 3 -> 5 ; +2 [label="2: Exit AClass_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start AClass_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/codetoanalyze/objc/frontend/vardecl/aclass_2.dot b/infer/tests/codetoanalyze/objc/frontend/vardecl/aclass_2.dot index 4b4f2490d..e688cc50d 100644 --- a/infer/tests/codetoanalyze/objc/frontend/vardecl/aclass_2.dot +++ b/infer/tests/codetoanalyze/objc/frontend/vardecl/aclass_2.dot @@ -1,13 +1,20 @@ digraph iCFG { -3 [label="3: Return Stmt \n n$0=*&#GB$aVariable:class NSObject * [line 21]\n *&return:class NSObject *=n$0 [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] +5 [label="5: Return Stmt \n n$0=*&#GB$aVariable:class NSObject * [line 21]\n *&return:class NSObject *=n$0 [line 21]\n REMOVE_TEMPS(n$0); [line 21]\n APPLY_ABSTRACTION; [line 21]\n " shape="box"] - 3 -> 2 ; -2 [label="2: Exit AClass_sharedInstance \n " color=yellow style=filled] + 5 -> 4 ; +4 [label="4: Exit AClass_sharedInstance \n " color=yellow style=filled] -1 [label="1: Start AClass_sharedInstance\nFormals: self:class AClass *\nLocals: \n DECLARE_LOCALS(&return); [line 20]\n NULLIFY(&self,false); [line 20]\n " color=yellow style=filled] +3 [label="3: Start AClass_sharedInstance\nFormals: self:class AClass *\nLocals: \n DECLARE_LOCALS(&return); [line 20]\n NULLIFY(&self,false); [line 20]\n " color=yellow style=filled] - 1 -> 3 ; + 3 -> 5 ; +2 [label="2: Exit AClass_frontendChecks \n " color=yellow style=filled] + + +1 [label="1: Start AClass_frontendChecks\nFormals: \nLocals: \n " color=yellow style=filled] + + + 1 -> 2 ; } diff --git a/infer/tests/endtoend/objc/RegisteredObserver2.java b/infer/tests/endtoend/objc/RegisteredObserver2.java new file mode 100644 index 000000000..e20a96e9f --- /dev/null +++ b/infer/tests/endtoend/objc/RegisteredObserver2.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2015 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package endtoend.objc; + +import static org.hamcrest.MatcherAssert.assertThat; +import static utils.matchers.ResultContainsExactly.containsExactly; + +import com.google.common.collect.ImmutableList; + +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +import java.io.IOException; + +import utils.DebuggableTemporaryFolder; +import utils.InferException; +import utils.InferResults; +import utils.InferRunner; + +public class RegisteredObserver2 { + + public static final String VCFile2 = + "infer/tests/codetoanalyze/objc/errors/registered_observer/ViewController2.m"; + + private static ImmutableList inferCmd; + + public static final String REGISTERED_OBSERVER = "REGISTERED_OBSERVER_BEING_DEALLOCATED"; + + @ClassRule + public static DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); + + @BeforeClass + public static void runInfer() throws InterruptedException, IOException { + inferCmd = InferRunner.createObjCInferCommandSimple( + folder, + VCFile2, + "cf"); + } + + @Test + public void RegisteredObserverShouldNotBeFound() + throws InterruptedException, IOException, InferException { + InferResults inferResults = InferRunner.runInferObjC(inferCmd); + String[] methods = {}; + assertThat( + "Results should contain " + REGISTERED_OBSERVER, + inferResults, + containsExactly( + REGISTERED_OBSERVER, + VCFile2, + methods + ) + ); + } + +} diff --git a/infer/tests/endtoend/objc/RegisteredObserver3.java b/infer/tests/endtoend/objc/RegisteredObserver3.java new file mode 100644 index 000000000..896bc7fcc --- /dev/null +++ b/infer/tests/endtoend/objc/RegisteredObserver3.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2015 - present Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +package endtoend.objc; + +import static org.hamcrest.MatcherAssert.assertThat; +import static utils.matchers.ResultContainsExactly.containsExactly; + +import com.google.common.collect.ImmutableList; + +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; + +import java.io.IOException; + +import utils.DebuggableTemporaryFolder; +import utils.InferException; +import utils.InferResults; +import utils.InferRunner; + +public class RegisteredObserver3 { + + public static final String VCFile3 = + "infer/tests/codetoanalyze/objc/errors/registered_observer/ViewController3.m"; + + private static ImmutableList inferCmd; + + public static final String REGISTERED_OBSERVER = "REGISTERED_OBSERVER_BEING_DEALLOCATED"; + + @ClassRule + public static DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder(); + + @BeforeClass + public static void runInfer() throws InterruptedException, IOException { + + inferCmd = InferRunner.createObjCInferCommandSimple( + folder, + VCFile3, + "cf"); + } + + @Test + public void RegisteredObserverShouldBeFound() + throws InterruptedException, IOException, InferException { + InferResults inferResults = InferRunner.runInferObjC(inferCmd); + String[] methods = { + "frontendChecks" + }; + assertThat( + "Results should contain " + REGISTERED_OBSERVER, + inferResults, + containsExactly( + REGISTERED_OBSERVER, + VCFile3, + methods + ) + ); + } +}