summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDevin Coughlin <dcoughlin@apple.com>2016-06-22 00:20:00 +0000
committerDevin Coughlin <dcoughlin@apple.com>2016-06-22 00:20:00 +0000
commit83b8ce1cb4dc03ae3d9bf499e827dc282da95336 (patch)
tree81713ce1da1a59227dc746e9525df23afb3f6a33 /test
parent5f39118af3261b430d02e4835c96e5cbef033862 (diff)
[analyzer] Teach trackNullOrUndefValue() about class property accessors.
Teach trackNullOrUndefValue() how to properly look through PseudoObjectExprs to find the underlying semantic method call for property getters. This fixes a crash when looking through class property getters that I introduced in r265839. rdar://problem/26796666 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273340 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Analysis/inlining/false-positive-suppression.m28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/Analysis/inlining/false-positive-suppression.m b/test/Analysis/inlining/false-positive-suppression.m
index d9678206c7..1a5ff662c1 100644
--- a/test/Analysis/inlining/false-positive-suppression.m
+++ b/test/Analysis/inlining/false-positive-suppression.m
@@ -49,6 +49,12 @@ __attribute__((objc_root_class))
@end
+@interface SubOfSomeClass : SomeClass
+@end
+
+@implementation SubOfSomeClass
+@end
+
@implementation SomeClass
-(int *)methodReturningNull {
return 0;
@@ -57,6 +63,10 @@ __attribute__((objc_root_class))
-(int *)propertyReturningNull {
return 0;
}
+
++(int *)classPropertyReturningNull {
+ return 0;
+}
@end
void testMethodReturningNull(SomeClass *sc) {
@@ -75,6 +85,24 @@ void testPropertyReturningNull(SomeClass *sc) {
#endif
}
+@implementation SubOfSomeClass (ForTestOfSuperProperty)
+-(void)testSuperPropertyReturningNull {
+ int *result = super.propertyReturningNull;
+ *result = 1;
+#ifndef SUPPRESSED
+ // expected-warning@-2 {{Dereference of null pointer}}
+#endif
+}
+@end
+
+void testClassPropertyReturningNull() {
+ int *result = SomeClass.classPropertyReturningNull;
+ *result = 1;
+#ifndef SUPPRESSED
+ // expected-warning@-2 {{Dereference of null pointer}}
+#endif
+}
+
void testSynthesizedPropertyReturningNull(SomeClass *sc) {
if (sc.synthesizedProperty)
return;