From e4b3971441cb959fbed628d230db9b0a5513faaa Mon Sep 17 00:00:00 2001 From: Sungkeun Cho Date: Mon, 7 Dec 2020 01:19:34 -0800 Subject: [PATCH] [frontend] Fix capture mode in ObjC Summary: The frontend of ObjC regarding to captured variable was incorrect: it set capturing mode as by-reference always, but it actually translaged as if all captured variables were passed with by-value. This diff fixes this based on the document. https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Blocks/Articles/bxVariables.html * global variable: by reference * local variable: by value * `static` local variable: by reference * `__block` local variable: by reference * parameter: by value Reviewed By: jvillard Differential Revision: D25306122 fbshipit-source-id: ec499d705 --- infer/src/clang/cTrans.ml | 19 ++- infer/src/clang/cVar_decl.ml | 10 +- infer/src/clang/cVar_decl.mli | 4 +- .../codetoanalyze/objc/biabduction/issues.exp | 2 - .../RetainCycleBlockCapturedVar.m | 4 +- .../objc/frontend/block/escaping_byref.m | 50 +++++++ .../objc/frontend/block/escaping_byref.m.dot | 128 ++++++++++++++++++ .../objc/frontend/block/retain_cycle.m.dot | 4 +- ...specialized_method_with_block_params.m.dot | 20 +-- .../objc/frontend/noarc/Makefile | 1 + .../objc/shared/block/BlockVar.m.dot | 16 +-- .../shared/block/Blocks_as_parameters.m.dot | 4 +- .../objc/shared/block/block.m.dot | 8 +- .../objc/shared/block/block_no_args.m.dot | 4 +- .../objc/shared/block/block_release.m.dot | 4 +- .../objc/shared/block/dispatch.m.dot | 38 +++--- 16 files changed, 254 insertions(+), 62 deletions(-) create mode 100644 infer/tests/codetoanalyze/objc/frontend/block/escaping_byref.m create mode 100644 infer/tests/codetoanalyze/objc/frontend/block/escaping_byref.m.dot diff --git a/infer/src/clang/cTrans.ml b/infer/src/clang/cTrans.ml index 29e4d44bf..dca637aed 100644 --- a/infer/src/clang/cTrans.ml +++ b/infer/src/clang/cTrans.ml @@ -297,9 +297,13 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s (** Given a captured var, return the instruction to assign it to a temp *) let assign_captured_var loc (cvar, typ, mode) = - let id = Ident.create_fresh Ident.knormal in - let instr = Sil.Load {id; e= Exp.Lvar cvar; root_typ= typ; typ; loc} in - ((Exp.Var id, cvar, typ, mode), instr) + match mode with + | Pvar.ByReference -> + ((Exp.Lvar cvar, cvar, Typ.mk_ptr ~ptr_kind:Pk_reference typ, mode), None) + | Pvar.ByValue -> + let id = Ident.create_fresh Ident.knormal in + let instr = Sil.Load {id; e= Exp.Lvar cvar; root_typ= typ; typ; loc} in + ((Exp.Var id, cvar, typ, mode), Some instr) let closure_trans closure_pname captured_vars context stmt_info expr_info = @@ -311,6 +315,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s let typ = CType_decl.qual_type_to_sil_type context.tenv qual_type in let ids_instrs = List.map ~f:(assign_captured_var loc) captured_vars in let captured_vars, instrs = List.unzip ids_instrs in + let instrs = List.filter_opt instrs in let closure = Exp.Closure {name= closure_pname; captured_vars} in mk_trans_result (closure, typ) {empty_control with instrs} @@ -3263,9 +3268,12 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s block_decl_info.Clang_ast_t.bdi_captured_variables in let passed_as_noescape_block_to = trans_state.passed_as_noescape_block_to in - (* TODO: set correct capture mode *) let captured_vars = - List.map captured_vars_no_mode ~f:(fun (var, typ) -> (var, typ, Pvar.ByReference)) + List.map captured_vars_no_mode ~f:(fun (var, typ, modify_in_block) -> + let mode = + if modify_in_block || Pvar.is_global var then Pvar.ByReference else Pvar.ByValue + in + (var, typ, mode) ) in let res = closure_trans procname captured_vars context stmt_info expr_info in let block_data = @@ -3288,6 +3296,7 @@ module CTrans_funct (F : CModule_type.CFrontend) : CModule_type.CTranslation = s let get_captured_pvar_typ decl_ref = CVar_decl.sil_var_of_captured_var context stmt_info.Clang_ast_t.si_source_range procname decl_ref + |> Option.map ~f:(fun (var, typ, _modify_in_block) -> (var, typ)) in let loc = CLocation.location_of_stmt_info context.translation_unit_context.source_file stmt_info diff --git a/infer/src/clang/cVar_decl.ml b/infer/src/clang/cVar_decl.ml index 5060f9bc9..4a93e2677 100644 --- a/infer/src/clang/cVar_decl.ml +++ b/infer/src/clang/cVar_decl.ml @@ -104,8 +104,14 @@ let sil_var_of_captured_var context source_range procname decl_ref = in match (var_opt, typ_opt) with | Some var, Some typ -> - (* TODO: set correct capture mode *) - Some (var, typ) + let modify_in_block = + match CAst_utils.get_decl decl_ref.Clang_ast_t.dr_decl_pointer with + | Some (VarDecl (decl_info, _, _, _)) -> + has_block_attribute decl_info + | _ -> + false + in + Some (var, typ, modify_in_block) | None, None -> None | _ -> diff --git a/infer/src/clang/cVar_decl.mli b/infer/src/clang/cVar_decl.mli index bdf7ce663..ec49b25d3 100644 --- a/infer/src/clang/cVar_decl.mli +++ b/infer/src/clang/cVar_decl.mli @@ -23,13 +23,13 @@ val sil_var_of_captured_var : -> Clang_ast_t.source_range -> Procname.t -> Clang_ast_t.decl_ref - -> (Pvar.t * Typ.t) option + -> (Pvar.t * Typ.t * bool) option val captured_vars_from_block_info : CContext.t -> Clang_ast_t.source_range -> Clang_ast_t.block_captured_variable list - -> (Pvar.t * Typ.t) list + -> (Pvar.t * Typ.t * bool) list val mk_temp_sil_var : Procdesc.t -> name:string -> Pvar.t diff --git a/infer/tests/codetoanalyze/objc/biabduction/issues.exp b/infer/tests/codetoanalyze/objc/biabduction/issues.exp index 16d267cbf..8a1a6db17 100644 --- a/infer/tests/codetoanalyze/objc/biabduction/issues.exp +++ b/infer/tests/codetoanalyze/objc/biabduction/issues.exp @@ -31,8 +31,6 @@ codetoanalyze/objc/biabduction/initialization/struct_initlistexpr.c, implicit_ex codetoanalyze/objc/biabduction/initialization/struct_initlistexpr.c, point_coords_set_correctly, 2, DIVIDE_BY_ZERO, no_bucket, ERROR, [start of procedure point_coords_set_correctly()] codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlockAsParameter.m, FBSomeDataManager.fetchNewData, 2, BIABDUCTION_ANALYSIS_STOPS, no_bucket, WARNING, [start of procedure fetchNewData,start of procedure initWithCompletionBlock:,return from a call to Fetcher.initWithCompletionBlock:] codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlockAsParameter.m, FBSomeDataManager.fetchNewData, 2, RETAIN_CYCLE, no_bucket, ERROR, [start of procedure fetchNewData,start of procedure initWithCompletionBlock:,return from a call to Fetcher.initWithCompletionBlock:] -codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlockCapturedVar.m, LinkResolver.test_bad, 3, BIABDUCTION_ANALYSIS_STOPS, no_bucket, WARNING, [start of procedure test_bad,start of procedure setDidFinishLoad:,return from a call to Listener.setDidFinishLoad:] -codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlockCapturedVar.m, LinkResolver.test_bad, 3, RETAIN_CYCLE, no_bucket, ERROR, [start of procedure test_bad,start of procedure setDidFinishLoad:,return from a call to Listener.setDidFinishLoad:] codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlocks.m, RCBlock.retain_self_in_block, 1, BIABDUCTION_ANALYSIS_STOPS, no_bucket, WARNING, [start of procedure retain_self_in_block,start of procedure setHandler:,return from a call to RCBlock.setHandler:] codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlocks.m, RCBlock.retain_self_in_block, 1, RETAIN_CYCLE, no_bucket, ERROR, [start of procedure retain_self_in_block,start of procedure setHandler:,return from a call to RCBlock.setHandler:] codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlocks.m, objc_blockretain_a_in_block_cycle_3, 1, BIABDUCTION_ANALYSIS_STOPS, no_bucket, WARNING, [start of procedure block,start of procedure setChild:,return from a call to RCBlockAA.setChild:] diff --git a/infer/tests/codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlockCapturedVar.m b/infer/tests/codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlockCapturedVar.m index e75fa6ee4..137f52d40 100644 --- a/infer/tests/codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlockCapturedVar.m +++ b/infer/tests/codetoanalyze/objc/biabduction/memory_leaks_benchmark/RetainCycleBlockCapturedVar.m @@ -26,7 +26,7 @@ @implementation LinkResolver -- (void)test_bad { +- (void)test_bad_FN { Listener* listener = [[Listener alloc] init]; __block Listener* retainedListener = listener; listener.didFinishLoad = ^() { @@ -44,6 +44,6 @@ int main() { LinkResolver* a = [LinkResolver new]; - [a test_bad]; + [a test_bad_FN]; return 0; } diff --git a/infer/tests/codetoanalyze/objc/frontend/block/escaping_byref.m b/infer/tests/codetoanalyze/objc/frontend/block/escaping_byref.m new file mode 100644 index 000000000..932636a5c --- /dev/null +++ b/infer/tests/codetoanalyze/objc/frontend/block/escaping_byref.m @@ -0,0 +1,50 @@ +/* + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */ + +#import + +@interface EscapingByref : NSObject +@end + +@implementation EscapingByref + +int global; + ++ (void)capture_global_byref { + void (^closure)() = ^() { + global = 3; + }; +} + ++ (void)capture_local_byvalue { + int local; + void (^closure)() = ^() { + int x = local; + }; +} + ++ (void)capture_local_block_byref { + __block int local; + void (^closure)() = ^() { + local = 3; + }; +} + ++ (void)capture_local_static_byvalue { + static int local = 3; + void (^closure)() = ^() { + int x = local; + }; +} + ++ (void)capture_param_byvalue:(int)param { + void (^closure)() = ^() { + int x = param; + }; +} + +@end diff --git a/infer/tests/codetoanalyze/objc/frontend/block/escaping_byref.m.dot b/infer/tests/codetoanalyze/objc/frontend/block/escaping_byref.m.dot new file mode 100644 index 000000000..9149c15d5 --- /dev/null +++ b/infer/tests/codetoanalyze/objc/frontend/block/escaping_byref.m.dot @@ -0,0 +1,128 @@ +/* @generated */ +digraph cfg { +"objc_blockEscapingByref.capture_global_byref_1.71c6ece6ee30cbceb6bb1ac4222fc774_1" [label="1: Start objc_blockEscapingByref.capture_global_byref_1\nFormals: \nLocals: \n " color=yellow style=filled] + + + "objc_blockEscapingByref.capture_global_byref_1.71c6ece6ee30cbceb6bb1ac4222fc774_1" -> "objc_blockEscapingByref.capture_global_byref_1.71c6ece6ee30cbceb6bb1ac4222fc774_3" ; +"objc_blockEscapingByref.capture_global_byref_1.71c6ece6ee30cbceb6bb1ac4222fc774_2" [label="2: Exit objc_blockEscapingByref.capture_global_byref_1 \n " color=yellow style=filled] + + +"objc_blockEscapingByref.capture_global_byref_1.71c6ece6ee30cbceb6bb1ac4222fc774_3" [label="3: BinaryOperatorStmt: Assign \n *&#GB$global:int=3 [line 19, column 5]\n " shape="box"] + + + "objc_blockEscapingByref.capture_global_byref_1.71c6ece6ee30cbceb6bb1ac4222fc774_3" -> "objc_blockEscapingByref.capture_global_byref_1.71c6ece6ee30cbceb6bb1ac4222fc774_2" ; +"objc_blockEscapingByref.capture_local_block_byref_3.e3584f1ccd5f005a0c753b9bf434cd37_1" [label="1: Start objc_blockEscapingByref.capture_local_block_byref_3\nFormals: local:int\nLocals: \nCaptured: [by ref]local:int \n " color=yellow style=filled] + + + "objc_blockEscapingByref.capture_local_block_byref_3.e3584f1ccd5f005a0c753b9bf434cd37_1" -> "objc_blockEscapingByref.capture_local_block_byref_3.e3584f1ccd5f005a0c753b9bf434cd37_3" ; +"objc_blockEscapingByref.capture_local_block_byref_3.e3584f1ccd5f005a0c753b9bf434cd37_2" [label="2: Exit objc_blockEscapingByref.capture_local_block_byref_3 \n " color=yellow style=filled] + + +"objc_blockEscapingByref.capture_local_block_byref_3.e3584f1ccd5f005a0c753b9bf434cd37_3" [label="3: BinaryOperatorStmt: Assign \n *&local:int=3 [line 33, column 5]\n " shape="box"] + + + "objc_blockEscapingByref.capture_local_block_byref_3.e3584f1ccd5f005a0c753b9bf434cd37_3" -> "objc_blockEscapingByref.capture_local_block_byref_3.e3584f1ccd5f005a0c753b9bf434cd37_2" ; +"objc_blockEscapingByref.capture_local_byvalue_2.f19e514fa65b29c94c8ca5dfb300d895_1" [label="1: Start objc_blockEscapingByref.capture_local_byvalue_2\nFormals: local:int\nLocals: x:int\nCaptured: [by value]local:int \n " color=yellow style=filled] + + + "objc_blockEscapingByref.capture_local_byvalue_2.f19e514fa65b29c94c8ca5dfb300d895_1" -> "objc_blockEscapingByref.capture_local_byvalue_2.f19e514fa65b29c94c8ca5dfb300d895_3" ; +"objc_blockEscapingByref.capture_local_byvalue_2.f19e514fa65b29c94c8ca5dfb300d895_2" [label="2: Exit objc_blockEscapingByref.capture_local_byvalue_2 \n " color=yellow style=filled] + + +"objc_blockEscapingByref.capture_local_byvalue_2.f19e514fa65b29c94c8ca5dfb300d895_3" [label="3: DeclStmt \n VARIABLE_DECLARED(x:int); [line 26, column 5]\n n$1=*&local:int [line 26, column 13]\n *&x:int=n$1 [line 26, column 5]\n " shape="box"] + + + "objc_blockEscapingByref.capture_local_byvalue_2.f19e514fa65b29c94c8ca5dfb300d895_3" -> "objc_blockEscapingByref.capture_local_byvalue_2.f19e514fa65b29c94c8ca5dfb300d895_2" ; +"objc_blockEscapingByref.capture_local_static_byvalue_4.c3f6724a818e1f8b6ce2010807ddaa98_1" [label="1: Start objc_blockEscapingByref.capture_local_static_byvalue_4\nFormals: \nLocals: x:int \n " color=yellow style=filled] + + + "objc_blockEscapingByref.capture_local_static_byvalue_4.c3f6724a818e1f8b6ce2010807ddaa98_1" -> "objc_blockEscapingByref.capture_local_static_byvalue_4.c3f6724a818e1f8b6ce2010807ddaa98_3" ; +"objc_blockEscapingByref.capture_local_static_byvalue_4.c3f6724a818e1f8b6ce2010807ddaa98_2" [label="2: Exit objc_blockEscapingByref.capture_local_static_byvalue_4 \n " color=yellow style=filled] + + +"objc_blockEscapingByref.capture_local_static_byvalue_4.c3f6724a818e1f8b6ce2010807ddaa98_3" [label="3: DeclStmt \n VARIABLE_DECLARED(x:int); [line 40, column 5]\n n$2=*&#GB$EscapingByref.capture_local_static_byvalue.local:int [line 40, column 13]\n *&x:int=n$2 [line 40, column 5]\n " shape="box"] + + + "objc_blockEscapingByref.capture_local_static_byvalue_4.c3f6724a818e1f8b6ce2010807ddaa98_3" -> "objc_blockEscapingByref.capture_local_static_byvalue_4.c3f6724a818e1f8b6ce2010807ddaa98_2" ; +"objc_blockEscapingByref.capture_param_byvalue:_5.f5bb82a8a518c0c4d631c0f262866fb5_1" [label="1: Start objc_blockEscapingByref.capture_param_byvalue:_5\nFormals: param:int\nLocals: x:int\nCaptured: [by value]param:int \n " color=yellow style=filled] + + + "objc_blockEscapingByref.capture_param_byvalue:_5.f5bb82a8a518c0c4d631c0f262866fb5_1" -> "objc_blockEscapingByref.capture_param_byvalue:_5.f5bb82a8a518c0c4d631c0f262866fb5_3" ; +"objc_blockEscapingByref.capture_param_byvalue:_5.f5bb82a8a518c0c4d631c0f262866fb5_2" [label="2: Exit objc_blockEscapingByref.capture_param_byvalue:_5 \n " color=yellow style=filled] + + +"objc_blockEscapingByref.capture_param_byvalue:_5.f5bb82a8a518c0c4d631c0f262866fb5_3" [label="3: DeclStmt \n VARIABLE_DECLARED(x:int); [line 46, column 5]\n n$4=*¶m:int [line 46, column 13]\n *&x:int=n$4 [line 46, column 5]\n " shape="box"] + + + "objc_blockEscapingByref.capture_param_byvalue:_5.f5bb82a8a518c0c4d631c0f262866fb5_3" -> "objc_blockEscapingByref.capture_param_byvalue:_5.f5bb82a8a518c0c4d631c0f262866fb5_2" ; +"capture_global_byref#EscapingByref#class.d5798002ff336b6db40d170c64f79dfa_1" [label="1: Start EscapingByref.capture_global_byref\nFormals: \nLocals: closure:_fn_(*) \n " color=yellow style=filled] + + + "capture_global_byref#EscapingByref#class.d5798002ff336b6db40d170c64f79dfa_1" -> "capture_global_byref#EscapingByref#class.d5798002ff336b6db40d170c64f79dfa_3" ; +"capture_global_byref#EscapingByref#class.d5798002ff336b6db40d170c64f79dfa_2" [label="2: Exit EscapingByref.capture_global_byref \n " color=yellow style=filled] + + +"capture_global_byref#EscapingByref#class.d5798002ff336b6db40d170c64f79dfa_3" [label="3: DeclStmt \n VARIABLE_DECLARED(closure:_fn_(*)); [line 18, column 3]\n *&closure:_fn_(*)=(_fun_objc_blockEscapingByref.capture_global_byref_1) [line 18, column 3]\n " shape="box"] + + + "capture_global_byref#EscapingByref#class.d5798002ff336b6db40d170c64f79dfa_3" -> "capture_global_byref#EscapingByref#class.d5798002ff336b6db40d170c64f79dfa_2" ; +"capture_local_block_byref#EscapingByref#class.6666a6c7666ee99b965268341dfff1ed_1" [label="1: Start EscapingByref.capture_local_block_byref\nFormals: \nLocals: closure:_fn_(*) local:int(__block) \n " color=yellow style=filled] + + + "capture_local_block_byref#EscapingByref#class.6666a6c7666ee99b965268341dfff1ed_1" -> "capture_local_block_byref#EscapingByref#class.6666a6c7666ee99b965268341dfff1ed_3" ; +"capture_local_block_byref#EscapingByref#class.6666a6c7666ee99b965268341dfff1ed_2" [label="2: Exit EscapingByref.capture_local_block_byref \n " color=yellow style=filled] + + +"capture_local_block_byref#EscapingByref#class.6666a6c7666ee99b965268341dfff1ed_3" [label="3: DeclStmt \n VARIABLE_DECLARED(closure:_fn_(*)); [line 32, column 3]\n *&closure:_fn_(*)=(_fun_objc_blockEscapingByref.capture_local_block_byref_3,&local) [line 32, column 3]\n " shape="box"] + + + "capture_local_block_byref#EscapingByref#class.6666a6c7666ee99b965268341dfff1ed_3" -> "capture_local_block_byref#EscapingByref#class.6666a6c7666ee99b965268341dfff1ed_2" ; +"capture_local_byvalue#EscapingByref#class.1125724b2218b1f9ed9626a91a882cd6_1" [label="1: Start EscapingByref.capture_local_byvalue\nFormals: \nLocals: closure:_fn_(*) local:int \n " color=yellow style=filled] + + + "capture_local_byvalue#EscapingByref#class.1125724b2218b1f9ed9626a91a882cd6_1" -> "capture_local_byvalue#EscapingByref#class.1125724b2218b1f9ed9626a91a882cd6_3" ; +"capture_local_byvalue#EscapingByref#class.1125724b2218b1f9ed9626a91a882cd6_2" [label="2: Exit EscapingByref.capture_local_byvalue \n " color=yellow style=filled] + + +"capture_local_byvalue#EscapingByref#class.1125724b2218b1f9ed9626a91a882cd6_3" [label="3: DeclStmt \n VARIABLE_DECLARED(closure:_fn_(*)); [line 25, column 3]\n n$0=*&local:int [line 25, column 23]\n *&closure:_fn_(*)=(_fun_objc_blockEscapingByref.capture_local_byvalue_2,([by value]n$0 &local:int)) [line 25, column 3]\n " shape="box"] + + + "capture_local_byvalue#EscapingByref#class.1125724b2218b1f9ed9626a91a882cd6_3" -> "capture_local_byvalue#EscapingByref#class.1125724b2218b1f9ed9626a91a882cd6_2" ; +"capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_1" [label="1: Start EscapingByref.capture_local_static_byvalue\nFormals: \nLocals: closure:_fn_(*) \n " color=yellow style=filled] + + + "capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_1" -> "capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_4" ; +"capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_2" [label="2: Exit EscapingByref.capture_local_static_byvalue \n " color=yellow style=filled] + + +"capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_3" [label="3: DeclStmt \n VARIABLE_DECLARED(closure:_fn_(*)); [line 39, column 3]\n *&closure:_fn_(*)=(_fun_objc_blockEscapingByref.capture_local_static_byvalue_4) [line 39, column 3]\n " shape="box"] + + + "capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_3" -> "capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_2" ; +"capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_4" [label="4: DeclStmt \n VARIABLE_DECLARED(#GB$EscapingByref.capture_local_static_byvalue.local:int); [line 38, column 3]\n *&#GB$EscapingByref.capture_local_static_byvalue.local:int=3 [line 38, column 3]\n " shape="box"] + + + "capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_4" -> "capture_local_static_byvalue#EscapingByref#class.62aaa1df15079c55c89f40cca7b36f49_3" ; +"capture_param_byvalue:#EscapingByref#class.53132577f6f77d4aff66fe10ebd3eee9_1" [label="1: Start EscapingByref.capture_param_byvalue:\nFormals: param:int\nLocals: closure:_fn_(*) \n " color=yellow style=filled] + + + "capture_param_byvalue:#EscapingByref#class.53132577f6f77d4aff66fe10ebd3eee9_1" -> "capture_param_byvalue:#EscapingByref#class.53132577f6f77d4aff66fe10ebd3eee9_3" ; +"capture_param_byvalue:#EscapingByref#class.53132577f6f77d4aff66fe10ebd3eee9_2" [label="2: Exit EscapingByref.capture_param_byvalue: \n " color=yellow style=filled] + + +"capture_param_byvalue:#EscapingByref#class.53132577f6f77d4aff66fe10ebd3eee9_3" [label="3: DeclStmt \n VARIABLE_DECLARED(closure:_fn_(*)); [line 45, column 3]\n n$3=*¶m:int [line 45, column 23]\n *&closure:_fn_(*)=(_fun_objc_blockEscapingByref.capture_param_byvalue:_5,([by value]n$3 ¶m:int)) [line 45, column 3]\n " shape="box"] + + + "capture_param_byvalue:#EscapingByref#class.53132577f6f77d4aff66fe10ebd3eee9_3" -> "capture_param_byvalue:#EscapingByref#class.53132577f6f77d4aff66fe10ebd3eee9_2" ; +"dealloc#EscapingByref#instance.40517e59a0de2ec4636441123541bfef_1" [label="1: Start EscapingByref.dealloc\nFormals: self:EscapingByref*\nLocals: \n " color=yellow style=filled] + + + "dealloc#EscapingByref#instance.40517e59a0de2ec4636441123541bfef_1" -> "dealloc#EscapingByref#instance.40517e59a0de2ec4636441123541bfef_3" ; +"dealloc#EscapingByref#instance.40517e59a0de2ec4636441123541bfef_2" [label="2: Exit EscapingByref.dealloc \n " color=yellow style=filled] + + +"dealloc#EscapingByref#instance.40517e59a0de2ec4636441123541bfef_3" [label="3: Call dealloc \n " shape="box"] + + + "dealloc#EscapingByref#instance.40517e59a0de2ec4636441123541bfef_3" -> "dealloc#EscapingByref#instance.40517e59a0de2ec4636441123541bfef_2" ; +} diff --git a/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.m.dot b/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.m.dot index 32ef93078..e3f33cba4 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/retain_cycle.m.dot @@ -38,7 +38,7 @@ digraph cfg { "main.fad58de7366495db4650cfefac2fcd61_5" -> "main.fad58de7366495db4650cfefac2fcd61_4" ; -"objc_blockA.capture_1(class A,class D).8e9a52049a11f3e729d697583cda7110_1" [label="1: Start objc_blockA.capture_1\nFormals: self:A* d:D*\nLocals: \nCaptured: [by ref]self:A* \n " color=yellow style=filled] +"objc_blockA.capture_1(class A,class D).8e9a52049a11f3e729d697583cda7110_1" [label="1: Start objc_blockA.capture_1\nFormals: self:A* d:D*\nLocals: \nCaptured: [by value]self:A* \n " color=yellow style=filled] "objc_blockA.capture_1(class A,class D).8e9a52049a11f3e729d697583cda7110_1" -> "objc_blockA.capture_1(class A,class D).8e9a52049a11f3e729d697583cda7110_3" ; @@ -56,7 +56,7 @@ digraph cfg { "capture#A#instance.d411336575e4bf632a1828f5f5979726_2" [label="2: Exit A.capture \n " color=yellow style=filled] -"capture#A#instance.d411336575e4bf632a1828f5f5979726_3" [label="3: Compound statement \n n$3=*&self:A* [line 45, column 4]\n n$4=*n$3._b:B* [line 45, column 4]\n n$0=*&self:A* [line 45, column 16]\n n$5=_fun_B.sHandler:[objc_blockA.capture_1](n$0:A*,n$4:B*,(_fun_objc_blockA.capture_1,([by ref]n$0 &self:A*)):_fn_(*)) virtual [line 45, column 3]\n " shape="box"] +"capture#A#instance.d411336575e4bf632a1828f5f5979726_3" [label="3: Compound statement \n n$3=*&self:A* [line 45, column 4]\n n$4=*n$3._b:B* [line 45, column 4]\n n$0=*&self:A* [line 45, column 16]\n n$5=_fun_B.sHandler:[objc_blockA.capture_1](n$0:A*,n$4:B*,(_fun_objc_blockA.capture_1,([by value]n$0 &self:A*)):_fn_(*)) virtual [line 45, column 3]\n " shape="box"] "capture#A#instance.d411336575e4bf632a1828f5f5979726_3" -> "capture#A#instance.d411336575e4bf632a1828f5f5979726_2" ; diff --git a/infer/tests/codetoanalyze/objc/frontend/block/specialized_method_with_block_params.m.dot b/infer/tests/codetoanalyze/objc/frontend/block/specialized_method_with_block_params.m.dot index 500b055b1..68f121584 100644 --- a/infer/tests/codetoanalyze/objc/frontend/block/specialized_method_with_block_params.m.dot +++ b/infer/tests/codetoanalyze/objc/frontend/block/specialized_method_with_block_params.m.dot @@ -22,7 +22,7 @@ digraph cfg { "p.83878c91171338902e0fe0fb97a8c47a_3" -> "p.83878c91171338902e0fe0fb97a8c47a_2" ; -"objc_blockA.bar2_3(class A).d749ef9e4d7f0a45237d8fe9e40fc593_1" [label="1: Start objc_blockA.bar2_3\nFormals: self:A* i:int\nLocals: \nCaptured: [by ref]self:A* \n " color=yellow style=filled] +"objc_blockA.bar2_3(class A).d749ef9e4d7f0a45237d8fe9e40fc593_1" [label="1: Start objc_blockA.bar2_3\nFormals: self:A* i:int\nLocals: \nCaptured: [by value]self:A* \n " color=yellow style=filled] "objc_blockA.bar2_3(class A).d749ef9e4d7f0a45237d8fe9e40fc593_1" -> "objc_blockA.bar2_3(class A).d749ef9e4d7f0a45237d8fe9e40fc593_3" ; @@ -33,7 +33,7 @@ digraph cfg { "objc_blockA.bar2_3(class A).d749ef9e4d7f0a45237d8fe9e40fc593_3" -> "objc_blockA.bar2_3(class A).d749ef9e4d7f0a45237d8fe9e40fc593_2" ; -"objc_blockA.bar2_4(class A).a4f29e420077ca6ce7e44776941a7430_1" [label="1: Start objc_blockA.bar2_4\nFormals: self:A* i:int\nLocals: \nCaptured: [by ref]self:A* \n " color=yellow style=filled] +"objc_blockA.bar2_4(class A).a4f29e420077ca6ce7e44776941a7430_1" [label="1: Start objc_blockA.bar2_4\nFormals: self:A* i:int\nLocals: \nCaptured: [by value]self:A* \n " color=yellow style=filled] "objc_blockA.bar2_4(class A).a4f29e420077ca6ce7e44776941a7430_1" -> "objc_blockA.bar2_4(class A).a4f29e420077ca6ce7e44776941a7430_3" ; @@ -44,7 +44,7 @@ digraph cfg { "objc_blockA.bar2_4(class A).a4f29e420077ca6ce7e44776941a7430_3" -> "objc_blockA.bar2_4(class A).a4f29e420077ca6ce7e44776941a7430_2" ; -"objc_blockA.bar:_1(class A).3dfd8f5104e9624c9f972777203745e3_1" [label="1: Start objc_blockA.bar:_1\nFormals: self:A* x:int i:int\nLocals: \nCaptured: [by ref]self:A* [by ref]x:int \n " color=yellow style=filled] +"objc_blockA.bar:_1(class A).3dfd8f5104e9624c9f972777203745e3_1" [label="1: Start objc_blockA.bar:_1\nFormals: self:A* x:int i:int\nLocals: \nCaptured: [by value]self:A* [by value]x:int \n " color=yellow style=filled] "objc_blockA.bar:_1(class A).3dfd8f5104e9624c9f972777203745e3_1" -> "objc_blockA.bar:_1(class A).3dfd8f5104e9624c9f972777203745e3_3" ; @@ -55,7 +55,7 @@ digraph cfg { "objc_blockA.bar:_1(class A).3dfd8f5104e9624c9f972777203745e3_3" -> "objc_blockA.bar:_1(class A).3dfd8f5104e9624c9f972777203745e3_2" ; -"objc_blockA.bar:_2(class A).714c02790d023adc163c946a9f0220cd_1" [label="1: Start objc_blockA.bar:_2\nFormals: self:A* i:int\nLocals: \nCaptured: [by ref]self:A* \n " color=yellow style=filled] +"objc_blockA.bar:_2(class A).714c02790d023adc163c946a9f0220cd_1" [label="1: Start objc_blockA.bar:_2\nFormals: self:A* i:int\nLocals: \nCaptured: [by value]self:A* \n " color=yellow style=filled] "objc_blockA.bar:_2(class A).714c02790d023adc163c946a9f0220cd_1" -> "objc_blockA.bar:_2(class A).714c02790d023adc163c946a9f0220cd_3" ; @@ -66,7 +66,7 @@ digraph cfg { "objc_blockA.bar:_2(class A).714c02790d023adc163c946a9f0220cd_3" -> "objc_blockA.bar:_2(class A).714c02790d023adc163c946a9f0220cd_2" ; -"objc_blockA.call_foo_with_same_param_5(class A).03c7f776ebd8253258577359808dec16_1" [label="1: Start objc_blockA.call_foo_with_same_param_5\nFormals: self:A* i:int\nLocals: \nCaptured: [by ref]self:A* \n " color=yellow style=filled] +"objc_blockA.call_foo_with_same_param_5(class A).03c7f776ebd8253258577359808dec16_1" [label="1: Start objc_blockA.call_foo_with_same_param_5\nFormals: self:A* i:int\nLocals: \nCaptured: [by value]self:A* \n " color=yellow style=filled] "objc_blockA.call_foo_with_same_param_5(class A).03c7f776ebd8253258577359808dec16_1" -> "objc_blockA.call_foo_with_same_param_5(class A).03c7f776ebd8253258577359808dec16_3" ; @@ -92,7 +92,7 @@ digraph cfg { "bar2#A#instance.413fa5106d6a23f2bf18df99659efb82_4" -> "bar2#A#instance.413fa5106d6a23f2bf18df99659efb82_2" ; -"bar2#A#instance.413fa5106d6a23f2bf18df99659efb82_5" [label="5: Compound statement \n n$14=*&self:A* [line 40, column 7]\n n$16=*&self:A* [line 43, column 7]\n n$18=*&self:A* [line 46, column 7]\n n$19=_fun_foo[objc_blockA.bar2_3^objc_blockA.bar2_4](n$14:A*,(_fun_objc_blockA.bar2_4,([by ref]n$16 &self:A*)):_fn_(*),(_fun_objc_blockA.bar2_3,([by ref]n$14 &self:A*)):_fn_(*),n$18:A*) [line 39, column 3]\n " shape="box"] +"bar2#A#instance.413fa5106d6a23f2bf18df99659efb82_5" [label="5: Compound statement \n n$14=*&self:A* [line 40, column 7]\n n$16=*&self:A* [line 43, column 7]\n n$18=*&self:A* [line 46, column 7]\n n$19=_fun_foo[objc_blockA.bar2_3^objc_blockA.bar2_4](n$14:A*,(_fun_objc_blockA.bar2_4,([by value]n$16 &self:A*)):_fn_(*),(_fun_objc_blockA.bar2_3,([by value]n$14 &self:A*)):_fn_(*),n$18:A*) [line 39, column 3]\n " shape="box"] "bar2#A#instance.413fa5106d6a23f2bf18df99659efb82_5" -> "bar2#A#instance.413fa5106d6a23f2bf18df99659efb82_3" ; @@ -115,7 +115,7 @@ digraph cfg { "bar:#A(class A)#instance.3e4a860660eb436d473f8ceeb9c1a72b_5" -> "bar:#A(class A)#instance.3e4a860660eb436d473f8ceeb9c1a72b_3" ; -"bar:#A(class A)#instance.3e4a860660eb436d473f8ceeb9c1a72b_6" [label="6: Compound statement \n n$3=*&self:A* [line 27, column 7]\n n$4=*&x:int [line 27, column 7]\n n$7=*&self:A* [line 30, column 7]\n n$10=*&a:A* [line 33, column 7]\n n$11=_fun_foo[objc_blockA.bar:_1^objc_blockA.bar:_2](n$4:int,n$3:A*,(_fun_objc_blockA.bar:_2,([by ref]n$7 &self:A*)):_fn_(*),(_fun_objc_blockA.bar:_1,([by ref]n$3 &self:A*),([by ref]n$4 &x:int)):_fn_(*),n$10:A*) [line 26, column 3]\n " shape="box"] +"bar:#A(class A)#instance.3e4a860660eb436d473f8ceeb9c1a72b_6" [label="6: Compound statement \n n$3=*&self:A* [line 27, column 7]\n n$4=*&x:int [line 27, column 7]\n n$7=*&self:A* [line 30, column 7]\n n$10=*&a:A* [line 33, column 7]\n n$11=_fun_foo[objc_blockA.bar:_1^objc_blockA.bar:_2](n$4:int,n$3:A*,(_fun_objc_blockA.bar:_2,([by value]n$7 &self:A*)):_fn_(*),(_fun_objc_blockA.bar:_1,([by value]n$3 &self:A*),([by value]n$4 &x:int)):_fn_(*),n$10:A*) [line 26, column 3]\n " shape="box"] "bar:#A(class A)#instance.3e4a860660eb436d473f8ceeb9c1a72b_6" -> "bar:#A(class A)#instance.3e4a860660eb436d473f8ceeb9c1a72b_5" ; @@ -138,15 +138,15 @@ digraph cfg { "call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_4" -> "call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_2" ; -"call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_5" [label="5: Call _fun_foo \n n$22=*&b:_fn_(*) [line 55, column 7]\n n$23=*&b:_fn_(*) [line 55, column 10]\n n$24=*&self:A* [line 55, column 13]\n n$25=_fun_foo[objc_blockA.call_foo_with_same_param_5^objc_blockA.call_foo_with_same_param_5](n$30:A*,(_fun_objc_blockA.call_foo_with_same_param_5,([by ref]n$30 &self:A*)):_fn_(*),(_fun_objc_blockA.call_foo_with_same_param_5,([by ref]n$30 &self:A*)):_fn_(*),n$24:A*) [line 55, column 3]\n " shape="box"] +"call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_5" [label="5: Call _fun_foo \n n$22=*&b:_fn_(*) [line 55, column 7]\n n$23=*&b:_fn_(*) [line 55, column 10]\n n$24=*&self:A* [line 55, column 13]\n n$25=_fun_foo[objc_blockA.call_foo_with_same_param_5^objc_blockA.call_foo_with_same_param_5](n$30:A*,(_fun_objc_blockA.call_foo_with_same_param_5,([by value]n$30 &self:A*)):_fn_(*),(_fun_objc_blockA.call_foo_with_same_param_5,([by value]n$30 &self:A*)):_fn_(*),n$24:A*) [line 55, column 3]\n " shape="box"] "call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_5" -> "call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_3" ; -"call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_6" [label="6: Call _fun_foo \n n$26=*&b:_fn_(*) [line 54, column 7]\n n$27=*&b:_fn_(*) [line 54, column 10]\n n$28=*&self:A* [line 54, column 13]\n n$29=_fun_foo[objc_blockA.call_foo_with_same_param_5^objc_blockA.call_foo_with_same_param_5](n$30:A*,(_fun_objc_blockA.call_foo_with_same_param_5,([by ref]n$30 &self:A*)):_fn_(*),(_fun_objc_blockA.call_foo_with_same_param_5,([by ref]n$30 &self:A*)):_fn_(*),n$28:A*) [line 54, column 3]\n " shape="box"] +"call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_6" [label="6: Call _fun_foo \n n$26=*&b:_fn_(*) [line 54, column 7]\n n$27=*&b:_fn_(*) [line 54, column 10]\n n$28=*&self:A* [line 54, column 13]\n n$29=_fun_foo[objc_blockA.call_foo_with_same_param_5^objc_blockA.call_foo_with_same_param_5](n$30:A*,(_fun_objc_blockA.call_foo_with_same_param_5,([by value]n$30 &self:A*)):_fn_(*),(_fun_objc_blockA.call_foo_with_same_param_5,([by value]n$30 &self:A*)):_fn_(*),n$28:A*) [line 54, column 3]\n " shape="box"] "call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_6" -> "call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_5" ; -"call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_7" [label="7: DeclStmt \n VARIABLE_DECLARED(b:_fn_(*)); [line 51, column 3]\n n$30=*&self:A* [line 51, column 20]\n *&b:_fn_(*)=(_fun_objc_blockA.call_foo_with_same_param_5,([by ref]n$30 &self:A*)) [line 51, column 3]\n " shape="box"] +"call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_7" [label="7: DeclStmt \n VARIABLE_DECLARED(b:_fn_(*)); [line 51, column 3]\n n$30=*&self:A* [line 51, column 20]\n *&b:_fn_(*)=(_fun_objc_blockA.call_foo_with_same_param_5,([by value]n$30 &self:A*)) [line 51, column 3]\n " shape="box"] "call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_7" -> "call_foo_with_same_param#A#instance.7f01b1476c1662f7ce825ec7b1739a00_6" ; diff --git a/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile b/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile index d60887dec..02c288a75 100644 --- a/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile +++ b/infer/tests/codetoanalyze/objc/frontend/noarc/Makefile @@ -11,6 +11,7 @@ SOURCES = \ ../block/retain_cycle.m \ ../block/static.m \ ../block/specialized_method_with_block_params.m \ + ../block/escaping_byref.m \ ../boxing/Boxing.m \ ../boxing/array.m \ ../boxing/array_literal.c \ diff --git a/infer/tests/codetoanalyze/objc/shared/block/BlockVar.m.dot b/infer/tests/codetoanalyze/objc/shared/block/BlockVar.m.dot index d7470dfe9..39d0c154a 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/BlockVar.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/BlockVar.m.dot @@ -1,6 +1,6 @@ /* @generated */ digraph cfg { -"objc_blockBlockVar.blockPostBad_2.9b5fc6c216acf1eebade4e80598bd292_1" [label="1: Start objc_blockBlockVar.blockPostBad_2\nFormals: x:int*\nLocals: \nCaptured: [by ref]x:int* \n " color=yellow style=filled] +"objc_blockBlockVar.blockPostBad_2.9b5fc6c216acf1eebade4e80598bd292_1" [label="1: Start objc_blockBlockVar.blockPostBad_2\nFormals: x:int*\nLocals: \nCaptured: [by value]x:int* \n " color=yellow style=filled] "objc_blockBlockVar.blockPostBad_2.9b5fc6c216acf1eebade4e80598bd292_1" -> "objc_blockBlockVar.blockPostBad_2.9b5fc6c216acf1eebade4e80598bd292_3" ; @@ -15,7 +15,7 @@ digraph cfg { "objc_blockBlockVar.blockPostBad_2.9b5fc6c216acf1eebade4e80598bd292_4" -> "objc_blockBlockVar.blockPostBad_2.9b5fc6c216acf1eebade4e80598bd292_2" ; -"objc_blockBlockVar.blockPostOk_3.860b502fd4305d26ee26104b0e266b62_1" [label="1: Start objc_blockBlockVar.blockPostOk_3\nFormals: x:int*\nLocals: \nCaptured: [by ref]x:int* \n " color=yellow style=filled] +"objc_blockBlockVar.blockPostOk_3.860b502fd4305d26ee26104b0e266b62_1" [label="1: Start objc_blockBlockVar.blockPostOk_3\nFormals: x:int*\nLocals: \nCaptured: [by value]x:int* \n " color=yellow style=filled] "objc_blockBlockVar.blockPostOk_3.860b502fd4305d26ee26104b0e266b62_1" -> "objc_blockBlockVar.blockPostOk_3.860b502fd4305d26ee26104b0e266b62_3" ; @@ -30,7 +30,7 @@ digraph cfg { "objc_blockBlockVar.blockPostOk_3.860b502fd4305d26ee26104b0e266b62_4" -> "objc_blockBlockVar.blockPostOk_3.860b502fd4305d26ee26104b0e266b62_2" ; -"objc_blockBlockVar.capturedNoNullDeref_5.05728b28cff98ce99554f69b47154636_1" [label="1: Start objc_blockBlockVar.capturedNoNullDeref_5\nFormals: x:int*\nLocals: \nCaptured: [by ref]x:int* \n " color=yellow style=filled] +"objc_blockBlockVar.capturedNoNullDeref_5.05728b28cff98ce99554f69b47154636_1" [label="1: Start objc_blockBlockVar.capturedNoNullDeref_5\nFormals: x:int*\nLocals: \nCaptured: [by value]x:int* \n " color=yellow style=filled] "objc_blockBlockVar.capturedNoNullDeref_5.05728b28cff98ce99554f69b47154636_1" -> "objc_blockBlockVar.capturedNoNullDeref_5.05728b28cff98ce99554f69b47154636_3" ; @@ -45,7 +45,7 @@ digraph cfg { "objc_blockBlockVar.capturedNoNullDeref_5.05728b28cff98ce99554f69b47154636_4" -> "objc_blockBlockVar.capturedNoNullDeref_5.05728b28cff98ce99554f69b47154636_2" ; -"objc_blockBlockVar.capturedNullDeref_4.b2398d8a441f4c0e3ff276c92e1e2c2b_1" [label="1: Start objc_blockBlockVar.capturedNullDeref_4\nFormals: x:int*\nLocals: \nCaptured: [by ref]x:int* \n " color=yellow style=filled] +"objc_blockBlockVar.capturedNullDeref_4.b2398d8a441f4c0e3ff276c92e1e2c2b_1" [label="1: Start objc_blockBlockVar.capturedNullDeref_4\nFormals: x:int*\nLocals: \nCaptured: [by value]x:int* \n " color=yellow style=filled] "objc_blockBlockVar.capturedNullDeref_4.b2398d8a441f4c0e3ff276c92e1e2c2b_1" -> "objc_blockBlockVar.capturedNullDeref_4.b2398d8a441f4c0e3ff276c92e1e2c2b_3" ; @@ -161,7 +161,7 @@ digraph cfg { "blockPostBad#BlockVar#instance.60292f870cad8c1a5cefdbfe4194d6f9_4" -> "blockPostBad#BlockVar#instance.60292f870cad8c1a5cefdbfe4194d6f9_2" ; -"blockPostBad#BlockVar#instance.60292f870cad8c1a5cefdbfe4194d6f9_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 31, column 3]\n n$14=*&x:int* [line 31, column 28]\n *&my_block:_fn_(*)=(_fun_objc_blockBlockVar.blockPostBad_2,([by ref]n$14 &x:int*)) [line 31, column 3]\n " shape="box"] +"blockPostBad#BlockVar#instance.60292f870cad8c1a5cefdbfe4194d6f9_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 31, column 3]\n n$14=*&x:int* [line 31, column 28]\n *&my_block:_fn_(*)=(_fun_objc_blockBlockVar.blockPostBad_2,([by value]n$14 &x:int*)) [line 31, column 3]\n " shape="box"] "blockPostBad#BlockVar#instance.60292f870cad8c1a5cefdbfe4194d6f9_5" -> "blockPostBad#BlockVar#instance.60292f870cad8c1a5cefdbfe4194d6f9_3" ; @@ -184,7 +184,7 @@ digraph cfg { "blockPostOk#BlockVar#instance.1bb64a946f8b169b31996644931ed82d_4" -> "blockPostOk#BlockVar#instance.1bb64a946f8b169b31996644931ed82d_2" ; -"blockPostOk#BlockVar#instance.1bb64a946f8b169b31996644931ed82d_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 40, column 3]\n n$19=*&x:int* [line 40, column 28]\n *&my_block:_fn_(*)=(_fun_objc_blockBlockVar.blockPostOk_3,([by ref]n$19 &x:int*)) [line 40, column 3]\n " shape="box"] +"blockPostOk#BlockVar#instance.1bb64a946f8b169b31996644931ed82d_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 40, column 3]\n n$19=*&x:int* [line 40, column 28]\n *&my_block:_fn_(*)=(_fun_objc_blockBlockVar.blockPostOk_3,([by value]n$19 &x:int*)) [line 40, column 3]\n " shape="box"] "blockPostOk#BlockVar#instance.1bb64a946f8b169b31996644931ed82d_5" -> "blockPostOk#BlockVar#instance.1bb64a946f8b169b31996644931ed82d_3" ; @@ -215,7 +215,7 @@ digraph cfg { "capturedNoNullDeref#BlockVar#instance.ebe646baaabdc58144a5916780ee8c76_5" -> "capturedNoNullDeref#BlockVar#instance.ebe646baaabdc58144a5916780ee8c76_3" ; -"capturedNoNullDeref#BlockVar#instance.ebe646baaabdc58144a5916780ee8c76_6" [label="6: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 57, column 3]\n n$28=*&x:int* [line 57, column 27]\n *&my_block:_fn_(*)=(_fun_objc_blockBlockVar.capturedNoNullDeref_5,([by ref]n$28 &x:int*)) [line 57, column 3]\n " shape="box"] +"capturedNoNullDeref#BlockVar#instance.ebe646baaabdc58144a5916780ee8c76_6" [label="6: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 57, column 3]\n n$28=*&x:int* [line 57, column 27]\n *&my_block:_fn_(*)=(_fun_objc_blockBlockVar.capturedNoNullDeref_5,([by value]n$28 &x:int*)) [line 57, column 3]\n " shape="box"] "capturedNoNullDeref#BlockVar#instance.ebe646baaabdc58144a5916780ee8c76_6" -> "capturedNoNullDeref#BlockVar#instance.ebe646baaabdc58144a5916780ee8c76_5" ; @@ -242,7 +242,7 @@ digraph cfg { "capturedNullDeref#BlockVar#instance.48c44f7ae26caf7a1ac522523ebac894_4" -> "capturedNullDeref#BlockVar#instance.48c44f7ae26caf7a1ac522523ebac894_2" ; -"capturedNullDeref#BlockVar#instance.48c44f7ae26caf7a1ac522523ebac894_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 48, column 3]\n n$23=*&x:int* [line 48, column 27]\n *&my_block:_fn_(*)=(_fun_objc_blockBlockVar.capturedNullDeref_4,([by ref]n$23 &x:int*)) [line 48, column 3]\n " shape="box"] +"capturedNullDeref#BlockVar#instance.48c44f7ae26caf7a1ac522523ebac894_5" [label="5: DeclStmt \n VARIABLE_DECLARED(my_block:_fn_(*)); [line 48, column 3]\n n$23=*&x:int* [line 48, column 27]\n *&my_block:_fn_(*)=(_fun_objc_blockBlockVar.capturedNullDeref_4,([by value]n$23 &x:int*)) [line 48, column 3]\n " shape="box"] "capturedNullDeref#BlockVar#instance.48c44f7ae26caf7a1ac522523ebac894_5" -> "capturedNullDeref#BlockVar#instance.48c44f7ae26caf7a1ac522523ebac894_3" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/Blocks_as_parameters.m.dot b/infer/tests/codetoanalyze/objc/shared/block/Blocks_as_parameters.m.dot index b62aa333f..54a3b5ace 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/Blocks_as_parameters.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/Blocks_as_parameters.m.dot @@ -1,6 +1,6 @@ /* @generated */ digraph cfg { -"objc_blockB.f_1(class B).c1c611f4be5cea3fe56d67e34da1fffd_1" [label="1: Start objc_blockB.f_1\nFormals: self:B* const \nLocals: \nCaptured: [by ref]self:B* const \n " color=yellow style=filled] +"objc_blockB.f_1(class B).c1c611f4be5cea3fe56d67e34da1fffd_1" [label="1: Start objc_blockB.f_1\nFormals: self:B* const \nLocals: \nCaptured: [by value]self:B* const \n " color=yellow style=filled] "objc_blockB.f_1(class B).c1c611f4be5cea3fe56d67e34da1fffd_1" -> "objc_blockB.f_1(class B).c1c611f4be5cea3fe56d67e34da1fffd_3" ; @@ -37,7 +37,7 @@ digraph cfg { "f#B#instance.f1371ff5e7f410d3df6a2e71ff0a814e_4" -> "f#B#instance.f1371ff5e7f410d3df6a2e71ff0a814e_2" ; -"f#B#instance.f1371ff5e7f410d3df6a2e71ff0a814e_5" [label="5: Compound statement \n n$4=*&self:B* [line 23, column 10]\n n$5=*n$4.h:int [line 23, column 10]\n n$2=*&self:B* const [line 24, column 11]\n n$6=_fun_B.foo:and:[objc_blockB.f_1](n$5:int,n$2:B* const ,(_fun_objc_blockB.f_1,([by ref]n$2 &self:B* const )):_fn_(*)) [line 23, column 3]\n " shape="box"] +"f#B#instance.f1371ff5e7f410d3df6a2e71ff0a814e_5" [label="5: Compound statement \n n$4=*&self:B* [line 23, column 10]\n n$5=*n$4.h:int [line 23, column 10]\n n$2=*&self:B* const [line 24, column 11]\n n$6=_fun_B.foo:and:[objc_blockB.f_1](n$5:int,n$2:B* const ,(_fun_objc_blockB.f_1,([by value]n$2 &self:B* const )):_fn_(*)) [line 23, column 3]\n " shape="box"] "f#B#instance.f1371ff5e7f410d3df6a2e71ff0a814e_5" -> "f#B#instance.f1371ff5e7f410d3df6a2e71ff0a814e_3" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/block.m.dot b/infer/tests/codetoanalyze/objc/shared/block/block.m.dot index 237993663..bef826d46 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/block.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/block.m.dot @@ -46,7 +46,7 @@ digraph cfg { "main1.38f534a9576db7ec6ebcbca8c111f942_8" -> "main1.38f534a9576db7ec6ebcbca8c111f942_7" ; -"main1.38f534a9576db7ec6ebcbca8c111f942_9" [label="9: Compound statement \n n$9=*&x:int [line 16, column 14]\n *&addblock:_fn_(*)=(_fun_objc_blockmain1_2,([by ref]n$9 &x:int)) [line 16, column 3]\n n$22=*&addblock:_fn_(*) [line 16, column 3]\n " shape="box"] +"main1.38f534a9576db7ec6ebcbca8c111f942_9" [label="9: Compound statement \n n$9=*&x:int [line 16, column 14]\n *&addblock:_fn_(*)=(_fun_objc_blockmain1_2,([by value]n$9 &x:int)) [line 16, column 3]\n n$22=*&addblock:_fn_(*) [line 16, column 3]\n " shape="box"] "main1.38f534a9576db7ec6ebcbca8c111f942_9" -> "main1.38f534a9576db7ec6ebcbca8c111f942_8" ; @@ -73,7 +73,7 @@ digraph cfg { "objc_blockmain1_1.74199543de3b6a9a736f23ef5e45586a_4" -> "objc_blockmain1_1.74199543de3b6a9a736f23ef5e45586a_2" ; -"objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_1" [label="1: Start objc_blockmain1_2\nFormals: x:int c:int d:int\nLocals: bla:int add2:int addblock2:_fn_(*)\nCaptured: [by ref]x:int \n " color=yellow style=filled] +"objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_1" [label="1: Start objc_blockmain1_2\nFormals: x:int c:int d:int\nLocals: bla:int add2:int addblock2:_fn_(*)\nCaptured: [by value]x:int \n " color=yellow style=filled] "objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_1" -> "objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_7" ; @@ -92,7 +92,7 @@ digraph cfg { "objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_5" -> "objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_3" ; -"objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_6" [label="6: Compound statement \n n$15=*&x:int [line 21, column 17]\n n$16=*&bla:int [line 21, column 17]\n *&addblock2:_fn_(*)=(_fun_objc_blockobjc_blockmain1_2_3,([by ref]n$15 &x:int),([by ref]n$16 &bla:int)) [line 21, column 5]\n n$21=*&addblock2:_fn_(*) [line 21, column 5]\n " shape="box"] +"objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_6" [label="6: Compound statement \n n$15=*&x:int [line 21, column 17]\n n$16=*&bla:int [line 21, column 17]\n *&addblock2:_fn_(*)=(_fun_objc_blockobjc_blockmain1_2_3,([by value]n$15 &x:int),([by value]n$16 &bla:int)) [line 21, column 5]\n n$21=*&addblock2:_fn_(*) [line 21, column 5]\n " shape="box"] "objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_6" -> "objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_5" ; @@ -100,7 +100,7 @@ digraph cfg { "objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_7" -> "objc_blockmain1_2.0d332204bbe33f46a9283d2c0df5700a_6" ; -"objc_blockobjc_blockmain1_2_3.0824f0806cf4ebad2920e9a12535d20e_1" [label="1: Start objc_blockobjc_blockmain1_2_3\nFormals: x:int bla:int z:int\nLocals: \nCaptured: [by ref]x:int [by ref]bla:int \n " color=yellow style=filled] +"objc_blockobjc_blockmain1_2_3.0824f0806cf4ebad2920e9a12535d20e_1" [label="1: Start objc_blockobjc_blockmain1_2_3\nFormals: x:int bla:int z:int\nLocals: \nCaptured: [by value]x:int [by value]bla:int \n " color=yellow style=filled] "objc_blockobjc_blockmain1_2_3.0824f0806cf4ebad2920e9a12535d20e_1" -> "objc_blockobjc_blockmain1_2_3.0824f0806cf4ebad2920e9a12535d20e_3" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/block_no_args.m.dot b/infer/tests/codetoanalyze/objc/shared/block/block_no_args.m.dot index 46fd836c5..fdd3ca737 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/block_no_args.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/block_no_args.m.dot @@ -1,6 +1,6 @@ /* @generated */ digraph cfg { -"objc_blockBlock_no_args.m_1.4d7585adf186f5ddc971eca39c81e1b8_1" [label="1: Start objc_blockBlock_no_args.m_1\nFormals: z:int\nLocals: \nCaptured: [by ref]z:int \n " color=yellow style=filled] +"objc_blockBlock_no_args.m_1.4d7585adf186f5ddc971eca39c81e1b8_1" [label="1: Start objc_blockBlock_no_args.m_1\nFormals: z:int\nLocals: \nCaptured: [by value]z:int \n " color=yellow style=filled] "objc_blockBlock_no_args.m_1.4d7585adf186f5ddc971eca39c81e1b8_1" -> "objc_blockBlock_no_args.m_1.4d7585adf186f5ddc971eca39c81e1b8_3" ; @@ -74,7 +74,7 @@ digraph cfg { "m#Block_no_args#instance.385f8c4982ef6acc28cdc868a8cd4272_13" -> "m#Block_no_args#instance.385f8c4982ef6acc28cdc868a8cd4272_12" ; -"m#Block_no_args#instance.385f8c4982ef6acc28cdc868a8cd4272_14" [label="14: Compound statement \n n$7=*&z:int [line 23, column 7]\n *&b:_fn_(*)=(_fun_objc_blockBlock_no_args.m_1,([by ref]n$7 &z:int)) [line 23, column 3]\n n$9=*&b:_fn_(*) [line 23, column 3]\n " shape="box"] +"m#Block_no_args#instance.385f8c4982ef6acc28cdc868a8cd4272_14" [label="14: Compound statement \n n$7=*&z:int [line 23, column 7]\n *&b:_fn_(*)=(_fun_objc_blockBlock_no_args.m_1,([by value]n$7 &z:int)) [line 23, column 3]\n n$9=*&b:_fn_(*) [line 23, column 3]\n " shape="box"] "m#Block_no_args#instance.385f8c4982ef6acc28cdc868a8cd4272_14" -> "m#Block_no_args#instance.385f8c4982ef6acc28cdc868a8cd4272_13" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot b/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot index 2c7b93c1d..ded508472 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/block_release.m.dot @@ -1,6 +1,6 @@ /* @generated */ digraph cfg { -"objc_blockMy_manager.blockReleaseNoLeak_1(struct CGImage).d2039f8bbb0530575d5ff258d059d268_1" [label="1: Start objc_blockMy_manager.blockReleaseNoLeak_1\nFormals: newImage:CGImage* a:int\nLocals: \nCaptured: [by ref]newImage:CGImage* \n " color=yellow style=filled] +"objc_blockMy_manager.blockReleaseNoLeak_1(struct CGImage).d2039f8bbb0530575d5ff258d059d268_1" [label="1: Start objc_blockMy_manager.blockReleaseNoLeak_1\nFormals: newImage:CGImage* a:int\nLocals: \nCaptured: [by value]newImage:CGImage* \n " color=yellow style=filled] "objc_blockMy_manager.blockReleaseNoLeak_1(struct CGImage).d2039f8bbb0530575d5ff258d059d268_1" -> "objc_blockMy_manager.blockReleaseNoLeak_1(struct CGImage).d2039f8bbb0530575d5ff258d059d268_5" ; @@ -64,7 +64,7 @@ digraph cfg { "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_9" -> "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_6" ; "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_9" -> "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_7" ; -"blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_10" [label="10: Compound statement \n n$9=*&newImage:CGImage* [line 23, column 7]\n *&b:_fn_(*)=(_fun_objc_blockMy_manager.blockReleaseNoLeak_1,([by ref]n$9 &newImage:CGImage*)) [line 23, column 3]\n n$15=*&b:_fn_(*) [line 23, column 3]\n " shape="box"] +"blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_10" [label="10: Compound statement \n n$9=*&newImage:CGImage* [line 23, column 7]\n *&b:_fn_(*)=(_fun_objc_blockMy_manager.blockReleaseNoLeak_1,([by value]n$9 &newImage:CGImage*)) [line 23, column 3]\n n$15=*&b:_fn_(*) [line 23, column 3]\n " shape="box"] "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_10" -> "blockReleaseNoLeak#My_manager#instance.0c48f80f024250b18a529440f1313af6_9" ; diff --git a/infer/tests/codetoanalyze/objc/shared/block/dispatch.m.dot b/infer/tests/codetoanalyze/objc/shared/block/dispatch.m.dot index 6301fcec4..14b1d0e29 100644 --- a/infer/tests/codetoanalyze/objc/shared/block/dispatch.m.dot +++ b/infer/tests/codetoanalyze/objc/shared/block/dispatch.m.dot @@ -55,7 +55,7 @@ digraph cfg { "objc_blockDispatchA.block_attribute_2(class DispatchA).fbb5956dc6c8f95a8f2ae751ac2b44a1_2" [label="2: Exit objc_blockDispatchA.block_attribute_2 \n " color=yellow style=filled] -"objc_blockDispatchA.block_attribute_2(class DispatchA).fbb5956dc6c8f95a8f2ae751ac2b44a1_3" [label="3: BinaryOperatorStmt: Assign \n n$8=*&a:DispatchA* [line 38, column 5]\n *n$8._x:int=10 [line 38, column 5]\n " shape="box"] +"objc_blockDispatchA.block_attribute_2(class DispatchA).fbb5956dc6c8f95a8f2ae751ac2b44a1_3" [label="3: BinaryOperatorStmt: Assign \n n$7=*&a:DispatchA* [line 38, column 5]\n *n$7._x:int=10 [line 38, column 5]\n " shape="box"] "objc_blockDispatchA.block_attribute_2(class DispatchA).fbb5956dc6c8f95a8f2ae751ac2b44a1_3" -> "objc_blockDispatchA.block_attribute_2(class DispatchA).fbb5956dc6c8f95a8f2ae751ac2b44a1_2" ; @@ -66,7 +66,7 @@ digraph cfg { "objc_blockDispatchA.dispatch_a_block_variable_4.85a73921543aa13f4bc6d889cc185a8d_2" [label="2: Exit objc_blockDispatchA.dispatch_a_block_variable_4 \n " color=yellow style=filled] -"objc_blockDispatchA.dispatch_a_block_variable_4.85a73921543aa13f4bc6d889cc185a8d_3" [label="3: BinaryOperatorStmt: Assign \n n$20=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 55, column 25]\n n$21=_fun_NSObject.init(n$20:DispatchA*) virtual [line 55, column 25]\n *&#GB$DispatchA.dispatch_a_block_variable.static_storage__:DispatchA*=n$21 [line 55, column 5]\n " shape="box"] +"objc_blockDispatchA.dispatch_a_block_variable_4.85a73921543aa13f4bc6d889cc185a8d_3" [label="3: BinaryOperatorStmt: Assign \n n$19=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 55, column 25]\n n$20=_fun_NSObject.init(n$19:DispatchA*) virtual [line 55, column 25]\n *&#GB$DispatchA.dispatch_a_block_variable.static_storage__:DispatchA*=n$20 [line 55, column 5]\n " shape="box"] "objc_blockDispatchA.dispatch_a_block_variable_4.85a73921543aa13f4bc6d889cc185a8d_3" -> "objc_blockDispatchA.dispatch_a_block_variable_4.85a73921543aa13f4bc6d889cc185a8d_2" ; @@ -77,7 +77,7 @@ digraph cfg { "objc_blockDispatchA.dispatch_a_block_variable_from_macro_5.8b47e325760aa028beb8a7010bc38e1c_2" [label="2: Exit objc_blockDispatchA.dispatch_a_block_variable_from_macro_5 \n " color=yellow style=filled] -"objc_blockDispatchA.dispatch_a_block_variable_from_macro_5.8b47e325760aa028beb8a7010bc38e1c_3" [label="3: BinaryOperatorStmt: Assign \n n$25=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 66, column 27]\n n$26=_fun_NSObject.init(n$25:DispatchA*) virtual [line 66, column 27]\n *&#GB$DispatchA.dispatch_a_block_variable_from_macro.static_storage__:DispatchA*=n$26 [line 66, column 7]\n " shape="box"] +"objc_blockDispatchA.dispatch_a_block_variable_from_macro_5.8b47e325760aa028beb8a7010bc38e1c_3" [label="3: BinaryOperatorStmt: Assign \n n$24=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 66, column 27]\n n$25=_fun_NSObject.init(n$24:DispatchA*) virtual [line 66, column 27]\n *&#GB$DispatchA.dispatch_a_block_variable_from_macro.static_storage__:DispatchA*=n$25 [line 66, column 7]\n " shape="box"] "objc_blockDispatchA.dispatch_a_block_variable_from_macro_5.8b47e325760aa028beb8a7010bc38e1c_3" -> "objc_blockDispatchA.dispatch_a_block_variable_from_macro_5.8b47e325760aa028beb8a7010bc38e1c_2" ; @@ -99,7 +99,7 @@ digraph cfg { "objc_blockDispatchA.trans_3.2993ae0bfb5e0ec6d91c5c53d1084592_2" [label="2: Exit objc_blockDispatchA.trans_3 \n " color=yellow style=filled] -"objc_blockDispatchA.trans_3.2993ae0bfb5e0ec6d91c5c53d1084592_3" [label="3: BinaryOperatorStmt: Assign \n n$15=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 46, column 23]\n n$16=_fun_DispatchA.init(n$15:DispatchA*) virtual [line 46, column 22]\n *&#GB$DispatchA.trans.sharedInstance:objc_object*=n$16 [line 46, column 5]\n " shape="box"] +"objc_blockDispatchA.trans_3.2993ae0bfb5e0ec6d91c5c53d1084592_3" [label="3: BinaryOperatorStmt: Assign \n n$14=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 46, column 23]\n n$15=_fun_DispatchA.init(n$14:DispatchA*) virtual [line 46, column 22]\n *&#GB$DispatchA.trans.sharedInstance:objc_object*=n$15 [line 46, column 5]\n " shape="box"] "objc_blockDispatchA.trans_3.2993ae0bfb5e0ec6d91c5c53d1084592_3" -> "objc_blockDispatchA.trans_3.2993ae0bfb5e0ec6d91c5c53d1084592_2" ; @@ -118,11 +118,11 @@ digraph cfg { "block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_4" -> "block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_2" ; -"block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_5" [label="5: Compound statement \n n$7=*&a:DispatchA* [line 37, column 24]\n n$9=_fun__dispatch_once(&#GB$DispatchA.block_attribute.once:long*,(_fun_objc_blockDispatchA.block_attribute_2,([by ref]n$7 &a:DispatchA*)):_fn_(*)) [line 37, column 3]\n " shape="box"] +"block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_5" [label="5: Compound statement \n n$8=_fun__dispatch_once(&#GB$DispatchA.block_attribute.once:long*,(_fun_objc_blockDispatchA.block_attribute_2,&a):_fn_(*)) [line 37, column 3]\n " shape="box"] "block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_5" -> "block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_3" ; -"block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_6" [label="6: DeclStmt \n VARIABLE_DECLARED(a:DispatchA*); [line 36, column 3]\n n$10=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 36, column 26]\n n$11=_fun_NSObject.init(n$10:DispatchA*) virtual [line 36, column 26]\n *&a:DispatchA*=n$11 [line 36, column 3]\n " shape="box"] +"block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_6" [label="6: DeclStmt \n VARIABLE_DECLARED(a:DispatchA*); [line 36, column 3]\n n$9=_fun___objc_alloc_no_fail(sizeof(t=DispatchA):unsigned long) [line 36, column 26]\n n$10=_fun_NSObject.init(n$9:DispatchA*) virtual [line 36, column 26]\n *&a:DispatchA*=n$10 [line 36, column 3]\n " shape="box"] "block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_6" -> "block_attribute#DispatchA#class.df997e345dbf19ec3438c667c942e14a_5" ; @@ -133,15 +133,15 @@ digraph cfg { "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_2" [label="2: Exit DispatchA.dispatch_a_block_variable \n " color=yellow style=filled] -"dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_3" [label="3: Return Stmt \n n$17=*&#GB$DispatchA.dispatch_a_block_variable.static_storage__:DispatchA* [line 59, column 10]\n " shape="box"] +"dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_3" [label="3: Return Stmt \n n$16=*&#GB$DispatchA.dispatch_a_block_variable.static_storage__:DispatchA* [line 59, column 10]\n " shape="box"] "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_3" -> "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_4" ; -"dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_4" [label="4: Return Stmt \n *&return:objc_object*=n$17 [line 59, column 3]\n " shape="box"] +"dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_4" [label="4: Return Stmt \n *&return:objc_object*=n$16 [line 59, column 3]\n " shape="box"] "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_4" -> "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_2" ; -"dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_5" [label="5: Call _fun__dispatch_once \n n$18=*&initialization_block__:_fn_(*) [line 58, column 32]\n n$19=_fun__dispatch_once(&#GB$DispatchA.dispatch_a_block_variable.once_token__:long*,(_fun_objc_blockDispatchA.dispatch_a_block_variable_4):_fn_(*)) [line 58, column 3]\n " shape="box"] +"dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_5" [label="5: Call _fun__dispatch_once \n n$17=*&initialization_block__:_fn_(*) [line 58, column 32]\n n$18=_fun__dispatch_once(&#GB$DispatchA.dispatch_a_block_variable.once_token__:long*,(_fun_objc_blockDispatchA.dispatch_a_block_variable_4):_fn_(*)) [line 58, column 3]\n " shape="box"] "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_5" -> "dispatch_a_block_variable#DispatchA#class.3cc12dd22127281b8293b7c046d21bb2_3" ; @@ -156,11 +156,11 @@ digraph cfg { "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_2" [label="2: Exit DispatchA.dispatch_a_block_variable_from_macro \n " color=yellow style=filled] -"dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_3" [label="3: Compound statement \n n$22=*&#GB$DispatchA.dispatch_a_block_variable_from_macro.static_storage__:DispatchA* [line 70, column 5]\n " shape="box"] +"dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_3" [label="3: Compound statement \n n$21=*&#GB$DispatchA.dispatch_a_block_variable_from_macro.static_storage__:DispatchA* [line 70, column 5]\n " shape="box"] "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_3" -> "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_6" ; -"dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_4" [label="4: Call _fun__dispatch_once \n n$23=*&initialization_block__:_fn_(*) [line 69, column 34]\n n$24=_fun__dispatch_once(&#GB$DispatchA.dispatch_a_block_variable_from_macro.once_token__:long*,(_fun_objc_blockDispatchA.dispatch_a_block_variable_from_macro_5):_fn_(*)) [line 69, column 5]\n " shape="box"] +"dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_4" [label="4: Call _fun__dispatch_once \n n$22=*&initialization_block__:_fn_(*) [line 69, column 34]\n n$23=_fun__dispatch_once(&#GB$DispatchA.dispatch_a_block_variable_from_macro.once_token__:long*,(_fun_objc_blockDispatchA.dispatch_a_block_variable_from_macro_5):_fn_(*)) [line 69, column 5]\n " shape="box"] "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_4" -> "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_3" ; @@ -168,7 +168,7 @@ digraph cfg { "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_5" -> "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_4" ; -"dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_6" [label="6: Return Stmt \n *&return:objc_object*=n$22 [line 63, column 3]\n " shape="box"] +"dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_6" [label="6: Return Stmt \n *&return:objc_object*=n$21 [line 63, column 3]\n " shape="box"] "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_6" -> "dispatch_a_block_variable_from_macro#DispatchA#class.92567a38d5ab3cf637f72030b1097441_2" ; @@ -179,19 +179,19 @@ digraph cfg { "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_2" [label="2: Exit DispatchA.dispatch_a_block_variable_from_macro_delivers_initialised_object \n " color=yellow style=filled] -"dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_3" [label="3: Return Stmt \n n$27=*&a:DispatchA* [line 77, column 15]\n n$28=*n$27._x:int [line 77, column 15]\n " shape="box"] +"dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_3" [label="3: Return Stmt \n n$26=*&a:DispatchA* [line 77, column 15]\n n$27=*n$26._x:int [line 77, column 15]\n " shape="box"] "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_3" -> "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_4" ; -"dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_4" [label="4: Return Stmt \n *&return:int=(1 / (n$28 - 5)) [line 77, column 3]\n " shape="box"] +"dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_4" [label="4: Return Stmt \n *&return:int=(1 / (n$27 - 5)) [line 77, column 3]\n " shape="box"] "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_4" -> "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_2" ; -"dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_5" [label="5: BinaryOperatorStmt: Assign \n n$29=*&a:DispatchA* [line 76, column 3]\n *n$29._x:int=5 [line 76, column 3]\n " shape="box"] +"dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_5" [label="5: BinaryOperatorStmt: Assign \n n$28=*&a:DispatchA* [line 76, column 3]\n *n$28._x:int=5 [line 76, column 3]\n " shape="box"] "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_5" -> "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_3" ; -"dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_6" [label="6: DeclStmt \n VARIABLE_DECLARED(a:DispatchA*); [line 75, column 3]\n n$30=_fun_DispatchA.dispatch_a_block_variable_from_macro() [line 75, column 18]\n *&a:DispatchA*=n$30 [line 75, column 3]\n " shape="box"] +"dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_6" [label="6: DeclStmt \n VARIABLE_DECLARED(a:DispatchA*); [line 75, column 3]\n n$29=_fun_DispatchA.dispatch_a_block_variable_from_macro() [line 75, column 18]\n *&a:DispatchA*=n$29 [line 75, column 3]\n " shape="box"] "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_6" -> "dispatch_a_block_variable_from_macro_delivers_initialised_object#DispatchA#class.a58ef5afb5e1e9480b49788e2400c52c_5" ; @@ -221,15 +221,15 @@ digraph cfg { "trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_2" [label="2: Exit DispatchA.trans \n " color=yellow style=filled] -"trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_3" [label="3: Return Stmt \n n$12=*&#GB$DispatchA.trans.sharedInstance:objc_object* [line 49, column 10]\n " shape="box"] +"trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_3" [label="3: Return Stmt \n n$11=*&#GB$DispatchA.trans.sharedInstance:objc_object* [line 49, column 10]\n " shape="box"] "trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_3" -> "trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_4" ; -"trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_4" [label="4: Return Stmt \n *&return:objc_object*=n$12 [line 49, column 3]\n " shape="box"] +"trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_4" [label="4: Return Stmt \n *&return:objc_object*=n$11 [line 49, column 3]\n " shape="box"] "trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_4" -> "trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_2" ; -"trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_5" [label="5: Call n$13 \n n$13=*&dummy_block:_fn_(*) [line 48, column 3]\n n$14=n$13() objc_block [line 48, column 3]\n " shape="box"] +"trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_5" [label="5: Call n$12 \n n$12=*&dummy_block:_fn_(*) [line 48, column 3]\n n$13=n$12() objc_block [line 48, column 3]\n " shape="box"] "trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_5" -> "trans#DispatchA#class.23f9d908a87deca79c235bc76ca6e941_3" ;