diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-10-03 17:55:29 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-10-03 17:55:29 +0000 |
commit | 3f001ff471aec590a65a383a25367a4e1c82f5a3 (patch) | |
tree | 7871f14177a640a2379870c0683a27f351711405 /test/FixIt | |
parent | f8d9bd546811a56ebb0b581ce4cc6043b51659a1 (diff) |
objective-C arc: Warn under arc about a use of an ivar inside a block
that doesn't have a 'self' as this implicitly captures 'self' and could
create retain cycles. Provide fixit. // rdar://11194874
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@165133 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/FixIt')
-rw-r--r-- | test/FixIt/fixit-missing-self-in-block.m | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/FixIt/fixit-missing-self-in-block.m b/test/FixIt/fixit-missing-self-in-block.m new file mode 100644 index 0000000000..8fd9564ed0 --- /dev/null +++ b/test/FixIt/fixit-missing-self-in-block.m @@ -0,0 +1,20 @@ +// RUN: cp %s %t +// RUN: %clang_cc1 -x objective-c -fobjc-arc -fblocks -fixit %t +// RUN: %clang_cc1 -x objective-c -fobjc-arc -fblocks -Werror %t +// rdar://11194874 + +@interface Root @end + +@interface I : Root +{ + int _bar; +} +@end + +@implementation I + - (void)foo{ + ^{ + _bar = 3; + }(); + } +@end |