diff options
author | Anna Zaks <ganna@apple.com> | 2013-03-26 18:57:58 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-03-26 18:57:58 +0000 |
commit | 8a660eb1084294a903f6dcc00bf2fa4e3bc92cfc (patch) | |
tree | 7ad7bf446b160f3758a89b0695a81ef2ea65674b /test | |
parent | df5f80f8a34e26a4fb77f48f858c7838426a0785 (diff) |
[analyzer] Change inlining policy to inline small functions when reanalyzing ObjC methods as top level.
This allows us to better reason about(inline) small wrapper functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@178063 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/retain-release-inline.m | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Analysis/retain-release-inline.m b/test/Analysis/retain-release-inline.m index 6ff9e9a552..c89f58eab3 100644 --- a/test/Analysis/retain-release-inline.m +++ b/test/Analysis/retain-release-inline.m @@ -361,3 +361,30 @@ CFStringRef testCovariantReturnType() { } return Str; } + +// Test that we reanalyze ObjC methods which have been inlined. When reanalyzing +// them, make sure we inline very small functions. + +@interface MyClass : NSObject +- (id)test_return_retained_NS; +- (void)test_return_retained; +@end + +id returnInputParam(id x) { + return x; +} +@implementation MyClass +- (id)test_return_retained_NS { + // This method does not follow naming conventions, so a warning will be + // reported when it is reanalyzed at top level. + return returnInputParam([[NSString alloc] init]); // expected-warning {{leak}} +} + +- (void)test_return_retained { + id x = test_return_retained_NS(); // expected-warning {{leak}} + [x retain]; + [x release]; +} + +@end + |