[cfe-commits] r161889 - in /cfe/trunk: lib/StaticAnalyzer/Core/CallEvent.cpp test/Analysis/inlining/DynDispatchBifurcate.m

Anna Zaks ganna at apple.com
Tue Aug 14 12:19:19 PDT 2012


Author: zaks
Date: Tue Aug 14 14:19:18 2012
New Revision: 161889

URL: http://llvm.org/viewvc/llvm-project?rev=161889&view=rev
Log:
[analyzer]Assume that the properties cannot be overridden when dot
syntax is used.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
    cfe/trunk/test/Analysis/inlining/DynDispatchBifurcate.m

Modified: cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp?rev=161889&r1=161888&r2=161889&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp Tue Aug 14 14:19:18 2012
@@ -670,6 +670,9 @@
   if (InterfLoc.isValid() && SM.isFromMainFile(InterfLoc))
     return false;
 
+  // Assume that property accessors are not overridden.
+  if (getMessageKind() == OCM_PropertyAccess)
+    return false;
 
   // We assume that if the method is public (declared outside of main file) or
   // has a parent which publicly declares the method, the method could be

Modified: cfe/trunk/test/Analysis/inlining/DynDispatchBifurcate.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/inlining/DynDispatchBifurcate.m?rev=161889&r1=161888&r2=161889&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/inlining/DynDispatchBifurcate.m (original)
+++ cfe/trunk/test/Analysis/inlining/DynDispatchBifurcate.m Tue Aug 14 14:19:18 2012
@@ -160,10 +160,10 @@
 // weither they are "public" or private. 
 int testPublicProperty(PublicClass *p) {
   int x = 0;
-  [p setValue3:0];
-  if ([p value3] != 0)
-    return 5/x; // expected-warning {{Division by zero}} // TODO: no warning, we should always inline the property.
-  return 5/[p value3];// expected-warning {{Division by zero}}
+  p.value3 = 0;
+  if (p.value3 != 0)
+    return 5/x; 
+  return 5/p.value3;// expected-warning {{Division by zero}}
 }
 
 int testExtension(PublicClass *p) {





More information about the cfe-commits mailing list