]> granicus.if.org Git - clang/commitdiff
[analyzer]Assume that the properties cannot be overridden when dot
authorAnna Zaks <ganna@apple.com>
Tue, 14 Aug 2012 19:19:18 +0000 (19:19 +0000)
committerAnna Zaks <ganna@apple.com>
Tue, 14 Aug 2012 19:19:18 +0000 (19:19 +0000)
syntax is used.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161889 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/CallEvent.cpp
test/Analysis/inlining/DynDispatchBifurcate.m

index 496a7461cb790e71827272f78b206d31cd86e444..7a0cb4abe42b17c0ac9ec48624cc5657f1a7c985 100644 (file)
@@ -670,6 +670,9 @@ bool ObjCMethodCall::canBeOverridenInSubclass(ObjCInterfaceDecl *IDecl,
   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
index 58145f11d705fe3119fab4ffb4793af0694aa23c..6637dfdba5712939089bfa50934dd0970314b554 100644 (file)
@@ -160,10 +160,10 @@ int testCallToPublicAPICat(PublicSubClass *p) {
 // 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) {