diff options
| author | Devin Coughlin <dcoughlin@apple.com> | 2016-06-22 00:20:00 +0000 |
|---|---|---|
| committer | Devin Coughlin <dcoughlin@apple.com> | 2016-06-22 00:20:00 +0000 |
| commit | 803ee03117bbc4996abb9b917f6c558805646ca9 (patch) | |
| tree | 05fb18e35609a156bd868631dae357b43477d026 /clang/test | |
| parent | 644d9d3a441fe115343a2ab498aa4210b6858ed6 (diff) | |
| download | bcm5719-llvm-803ee03117bbc4996abb9b917f6c558805646ca9.tar.gz bcm5719-llvm-803ee03117bbc4996abb9b917f6c558805646ca9.zip | |
[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
llvm-svn: 273340
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Analysis/inlining/false-positive-suppression.m | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/clang/test/Analysis/inlining/false-positive-suppression.m b/clang/test/Analysis/inlining/false-positive-suppression.m index d9678206c7c..1a5ff662c18 100644 --- a/clang/test/Analysis/inlining/false-positive-suppression.m +++ b/clang/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; |

