[cfe-commits] r161021 - /cfe/trunk/test/Analysis/ivars.m

Jordan Rose jordan_rose at apple.com
Mon Jul 30 19:05:30 PDT 2012


Author: jrose
Date: Mon Jul 30 21:05:30 2012
New Revision: 161021

URL: http://llvm.org/viewvc/llvm-project?rev=161021&view=rev
Log:
[analyzer] Add a test that messages to super invalidate ivars.

Added:
    cfe/trunk/test/Analysis/ivars.m

Added: cfe/trunk/test/Analysis/ivars.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/ivars.m?rev=161021&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/ivars.m (added)
+++ cfe/trunk/test/Analysis/ivars.m Mon Jul 30 21:05:30 2012
@@ -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);
+
+ at interface Root {
+ at public
+  int uniqueID;
+}
+
+- (void)refreshID;
+ at 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}}
+}
+
+
+ at interface Child : Root
+ at end
+
+ at 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}}
+}
+ at end





More information about the cfe-commits mailing list