summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-08-10 18:55:58 +0000
committerAnna Zaks <ganna@apple.com>2012-08-10 18:55:58 +0000
commit75f49a9c07b671c7d16f8651b977eadfb260f761 (patch)
treee24eae319b120770df514c0c72101d52c474f8fa /clang/lib/StaticAnalyzer/Core/CallEvent.cpp
parent920af014c1687ba7250dc9a97e08327872d70b9b (diff)
downloadbcm5719-llvm-75f49a9c07b671c7d16f8651b977eadfb260f761.tar.gz
bcm5719-llvm-75f49a9c07b671c7d16f8651b977eadfb260f761.zip
[analyzer] Track if a region can be a subclass in the dynamic type info.
When object is allocated with alloc or init, we assume it cannot be a subclass (currently used only for bifurcation purposes). llvm-svn: 161682
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/CallEvent.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Core/CallEvent.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
index 773600b0964..6635067d0f9 100644
--- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -721,6 +721,7 @@ RuntimeDefinition ObjCMethodCall::getRuntimeDefinition() const {
// Find the the receiver type.
const ObjCObjectPointerType *ReceiverT = 0;
+ bool CanBeSubClassed = false;
QualType SupersType = E->getSuperType();
const MemRegion *Receiver = 0;
@@ -733,17 +734,25 @@ RuntimeDefinition ObjCMethodCall::getRuntimeDefinition() const {
if (!Receiver)
return RuntimeDefinition();
- QualType DynType = getState()->getDynamicTypeInfo(Receiver).getType();
+ DynamicTypeInfo DTI = getState()->getDynamicTypeInfo(Receiver);
+ QualType DynType = DTI.getType();
+ CanBeSubClassed = DTI.canBeASubClass();
ReceiverT = dyn_cast<ObjCObjectPointerType>(DynType);
+
+ if (ReceiverT && CanBeSubClassed)
+ if (ObjCInterfaceDecl *IDecl = ReceiverT->getInterfaceDecl())
+ if (!canBeOverridenInSubclass(IDecl, Sel))
+ CanBeSubClassed = false;
}
// Lookup the method implementation.
if (ReceiverT)
if (ObjCInterfaceDecl *IDecl = ReceiverT->getInterfaceDecl()) {
- if (canBeOverridenInSubclass(IDecl, Sel))
- return RuntimeDefinition(IDecl->lookupPrivateMethod(Sel), Receiver);
+ const ObjCMethodDecl *MD = IDecl->lookupPrivateMethod(Sel);
+ if (CanBeSubClassed)
+ return RuntimeDefinition(MD, Receiver);
else
- return RuntimeDefinition(IDecl->lookupPrivateMethod(Sel), 0);
+ return RuntimeDefinition(MD, 0);
}
} else {
OpenPOWER on IntegriCloud