| 1 |
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.core -analyzer-checker=osx.cocoa.IncompatibleMethodTypes -verify -Wno-objc-root-class %s |
| 2 |
|
| 3 |
int printf(const char *, ...); |
| 4 |
|
| 5 |
@interface MyBase |
| 6 |
-(long long)length; |
| 7 |
-(long long)suppressedLength; |
| 8 |
@end |
| 9 |
|
| 10 |
@interface MySub : MyBase{} |
| 11 |
-(double)length; |
| 12 |
-(double)suppressedLength; |
| 13 |
@end |
| 14 |
|
| 15 |
@implementation MyBase |
| 16 |
-(long long)length{ |
| 17 |
printf("Called MyBase -length;\n"); |
| 18 |
return 3; |
| 19 |
} |
| 20 |
-(long long)suppressedLength{ |
| 21 |
printf("Called MyBase -length;\n"); |
| 22 |
return 3; |
| 23 |
} |
| 24 |
@end |
| 25 |
|
| 26 |
@implementation MySub |
| 27 |
-(double)length{ // expected-warning{{types are incompatible}} |
| 28 |
printf("Called MySub -length;\n"); |
| 29 |
return 3.3; |
| 30 |
} |
| 31 |
-(double)suppressedLength [[clang::suppress]]{ // no-warning |
| 32 |
printf("Called MySub -length;\n"); |
| 33 |
return 3.3; |
| 34 |
} |
| 35 |
@end |