diff options
author | Anna Zaks <ganna@apple.com> | 2012-07-27 19:07:34 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2012-07-27 19:07:34 +0000 |
commit | bccc594946d439351174831949a6a2cf7ff04f66 (patch) | |
tree | ce718e1fcaddc8f861b623923bb56a3af3d4c768 | |
parent | 6fbe0317aa38dbac22a29f7519c52db838aa1990 (diff) |
[analyzer] Another false positive in Class method inlining.
We are currently not setting the self object to the calling class object
during inlining nor do we reason about [AAA class].
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@160884 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis/inlining/InlineObjCClassMethod.m | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Analysis/inlining/InlineObjCClassMethod.m b/test/Analysis/inlining/InlineObjCClassMethod.m index 8c0e733fc5..3bd06ebaab 100644 --- a/test/Analysis/inlining/InlineObjCClassMethod.m +++ b/test/Analysis/inlining/InlineObjCClassMethod.m @@ -132,3 +132,30 @@ int foo() { return 5/y; // Would be great to get a warning here. } @end + +// Another false negative due to us not reasoning about self, which in this +// case points to the object of the class in the call site and should be equal +// to [MyParent class]. +@interface MyParentSelf : NSObject ++ (int)testSelf; +@end +@implementation MyParentSelf ++ (int)testSelf { + if (self == [MyParentSelf class]) + return 0; + else + return 1; +} +@end +@interface MyClassSelf : MyParentSelf +@end +@implementation MyClassSelf ++ (int)testClassMethodByKnownVarDecl { + int y = [MyParentSelf testSelf]; + return 5/y; // Should warn here. +} +@end +int foo2() { + int y = [MyParentSelf testSelf]; + return 5/y; // Should warn here. +} |