[analyzer] Add a test that messages to super invalidate ivars.

llvm-svn: 161021
This commit is contained in:
Jordan Rose 2012-07-31 02:05:30 +00:00
parent 74ec5c03ca
commit 3865c6e670
1 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,33 @@
// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-store=region -fblocks -verify -Wno-objc-root-class %s
void clang_analyzer_eval(int);
@interface Root {
@public
int uniqueID;
}
- (void)refreshID;
@end
void testInvalidation(Root *obj) {
int savedID = obj->uniqueID;
clang_analyzer_eval(savedID == obj->uniqueID); // expected-warning{{TRUE}}
[obj refreshID];
clang_analyzer_eval(savedID == obj->uniqueID); // expected-warning{{UNKNOWN}}
}
@interface Child : Root
@end
@implementation Child
- (void)testSuperInvalidation {
int savedID = self->uniqueID;
clang_analyzer_eval(savedID == self->uniqueID); // expected-warning{{TRUE}}
[super refreshID];
clang_analyzer_eval(savedID == self->uniqueID); // expected-warning{{UNKNOWN}}
}
@end