aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-08-14 18:35:06 +0000
committerAnna Zaks <ganna@apple.com>2012-08-14 18:35:06 +0000
commit95b277e38875ac06faaf8570b5f7594bb6d99e21 (patch)
treeeeb245ac7bbd24743bbf455313514a7ba9cdff13
parent550a9d823a939366a9f776b58f18883acd905a93 (diff)
[analyzer] Address Jordan's comments for r161822, r161683.
Add a TODO test case for r161822 - calling self from a class method. Remove a TODO comment for r161683 - value2 is not a property - we just have method names that look like they are getters/setters for a property. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161884 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Analysis/inlining/DynDispatchBifurcate.m2
-rw-r--r--test/Analysis/inlining/InlineObjCClassMethod.m30
2 files changed, 31 insertions, 1 deletions
diff --git a/test/Analysis/inlining/DynDispatchBifurcate.m b/test/Analysis/inlining/DynDispatchBifurcate.m
index e78b90bb8c..58145f11d7 100644
--- a/test/Analysis/inlining/DynDispatchBifurcate.m
+++ b/test/Analysis/inlining/DynDispatchBifurcate.m
@@ -170,7 +170,7 @@ int testExtension(PublicClass *p) {
int x = 0;
[p setValue2:0];
if ([p value2] != 0)
- return 5/x; // expected-warning {{Division by zero}} // TODO: no warning, we should always inline the property.
+ return 5/x; // expected-warning {{Division by zero}}
return 5/[p value2]; // expected-warning {{Division by zero}}
}
diff --git a/test/Analysis/inlining/InlineObjCClassMethod.m b/test/Analysis/inlining/InlineObjCClassMethod.m
index 7e8b51fe0b..814d437a52 100644
--- a/test/Analysis/inlining/InlineObjCClassMethod.m
+++ b/test/Analysis/inlining/InlineObjCClassMethod.m
@@ -179,3 +179,33 @@ int foo2() {
int y = [MyParentSelf testSelf];
return 5/y; // Should warn here.
}
+
+// TODO: We do not inline 'getNum' in the following case, where the value of
+// 'self' in call '[self getNum]' is available and evaualtes to
+// 'SelfUsedInParentChild' if it's called from fooA.
+// Self region should get created before we call foo and yje call to super
+// should keep it live.
+@interface SelfUsedInParent : NSObject
++ (int)getNum;
++ (int)foo;
+@end
+@implementation SelfUsedInParent
++ (int)getNum {return 5;}
++ (int)foo {
+ return [self getNum];
+}
+@end
+@interface SelfUsedInParentChild : SelfUsedInParent
++ (int)getNum;
++ (int)fooA;
+@end
+@implementation SelfUsedInParentChild
++ (int)getNum {return 0;}
++ (int)fooA {
+ return [super foo];
+}
+@end
+int checkSelfUsedInparentClassMethod() {
+ return 5/[SelfUsedInParentChild fooA];
+}
+