diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-07-31 02:05:30 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-07-31 02:05:30 +0000 |
commit | d72f56de7c79828928147389aed2c6c46f331031 (patch) | |
tree | d0ed0016d3907dc34bfd0dcf93d1bc12c05ab9ea | |
parent | a78a640c5f59720f2c2b8034eca4fbf8525d9026 (diff) |
[analyzer] Add a test that messages to super invalidate ivars.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161021 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/Analysis/ivars.m | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Analysis/ivars.m b/test/Analysis/ivars.m new file mode 100644 index 0000000000..cd01a2886a --- /dev/null +++ b/test/Analysis/ivars.m @@ -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 |