[cfe-commits] r160884 - /cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m

Anna Zaks ganna at apple.com
Fri Jul 27 12:07:34 PDT 2012


Author: zaks
Date: Fri Jul 27 14:07:34 2012
New Revision: 160884

URL: http://llvm.org/viewvc/llvm-project?rev=160884&view=rev
Log:
[analyzer] Another false positive in Class method inlining.
We are currently not setting the self object to the calling class object
during inlining nor do we reason about [AAA class].

Modified:
    cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m

Modified: cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m?rev=160884&r1=160883&r2=160884&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m (original)
+++ cfe/trunk/test/Analysis/inlining/InlineObjCClassMethod.m Fri Jul 27 14:07:34 2012
@@ -132,3 +132,30 @@
   return 5/y; // Would be great to get a warning here.
 }
 @end
+
+// Another false negative due to us not reasoning about self, which in this 
+// case points to the object of the class in the call site and should be equal 
+// to [MyParent class].
+ at interface MyParentSelf : NSObject
++ (int)testSelf;
+ at end
+ at implementation MyParentSelf
++ (int)testSelf {
+  if (self == [MyParentSelf class])
+      return 0;
+    else
+      return 1;
+}
+ at end
+ at interface MyClassSelf : MyParentSelf
+ at end
+ at implementation MyClassSelf
++ (int)testClassMethodByKnownVarDecl {
+  int y = [MyParentSelf testSelf];
+  return 5/y; // Should warn here.
+}
+ at end
+int foo2() {
+  int y = [MyParentSelf testSelf];
+  return 5/y; // Should warn here.
+}





More information about the cfe-commits mailing list