aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-08-14 19:19:18 +0000
committerAnna Zaks <ganna@apple.com>2012-08-14 19:19:18 +0000
commit38aee3bb4ffe14c8323785ae2fafed6f627fb577 (patch)
tree0263d5513a52b419b1f595bc64e57d5db4ea4df3
parent95b277e38875ac06faaf8570b5f7594bb6d99e21 (diff)
[analyzer]Assume that the properties cannot be overridden when dot
syntax is used. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161889 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/StaticAnalyzer/Core/CallEvent.cpp3
-rw-r--r--test/Analysis/inlining/DynDispatchBifurcate.m8
2 files changed, 7 insertions, 4 deletions
diff --git a/lib/StaticAnalyzer/Core/CallEvent.cpp b/lib/StaticAnalyzer/Core/CallEvent.cpp
index 496a7461cb..7a0cb4abe4 100644
--- a/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -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
diff --git a/test/Analysis/inlining/DynDispatchBifurcate.m b/test/Analysis/inlining/DynDispatchBifurcate.m
index 58145f11d7..6637dfdba5 100644
--- a/test/Analysis/inlining/DynDispatchBifurcate.m
+++ b/test/Analysis/inlining/DynDispatchBifurcate.m
@@ -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) {