diff --git a/infer/src/clang/cFrontend_utils.ml b/infer/src/clang/cFrontend_utils.ml index 8cd90982a..c88029e42 100644 --- a/infer/src/clang/cFrontend_utils.ml +++ b/infer/src/clang/cFrontend_utils.ml @@ -756,6 +756,10 @@ struct | ObjCMethodDecl (_, name_info, mdi) -> let class_name = Ast_utils.get_class_name_from_member name_info in get_objc_method_name name_info mdi class_name + | BlockDecl _ -> + let name = Config.anonymous_block_prefix ^ Config.anonymous_block_num_sep ^ + (string_of_int (get_fresh_block_index ())) in + Procname.mangled_objc_block name | _ -> assert false diff --git a/infer/tests/codetoanalyze/objc/linters/atomic_prop.m b/infer/tests/codetoanalyze/objc/linters/atomic_prop.m index f633e1a6d..29e330ebe 100644 --- a/infer/tests/codetoanalyze/objc/linters/atomic_prop.m +++ b/infer/tests/codetoanalyze/objc/linters/atomic_prop.m @@ -108,4 +108,12 @@ } } +- (void)accessInBlock { + void (^b)(); + b = ^() { + self->_f += 1; + }; + b(); +} + @end diff --git a/infer/tests/endtoend/objc/linters/AtomicPropertyTest.java b/infer/tests/endtoend/objc/linters/AtomicPropertyTest.java index 0b18dd7d2..0641a1b01 100644 --- a/infer/tests/endtoend/objc/linters/AtomicPropertyTest.java +++ b/infer/tests/endtoend/objc/linters/AtomicPropertyTest.java @@ -58,7 +58,8 @@ public class AtomicPropertyTest { 82, 86, 98, - 99 + 99, + 114 })); }