aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Core/CallEvent.cpp
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-07-30 23:48:36 +0000
committerAnna Zaks <ganna@apple.com>2012-07-30 23:48:36 +0000
commitf0324d33967f28758f7243c7bb1a469c5a0394b6 (patch)
tree134c028a648f957fdc2ffb6eda8ac3205ef610a1 /lib/StaticAnalyzer/Core/CallEvent.cpp
parent5d0f37306ef4726c91c1eb1e4050ecc0e860fcf1 (diff)
[analyzer] Handle inlining of instance calls to super.
Use self-init.m for testing. (It used to have a bunch of failing tests with dynamic inlining turned on.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161012 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Core/CallEvent.cpp')
-rw-r--r--lib/StaticAnalyzer/Core/CallEvent.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/StaticAnalyzer/Core/CallEvent.cpp b/lib/StaticAnalyzer/Core/CallEvent.cpp
index ad5a104aa0..bfc00ed2e0 100644
--- a/lib/StaticAnalyzer/Core/CallEvent.cpp
+++ b/lib/StaticAnalyzer/Core/CallEvent.cpp
@@ -592,21 +592,27 @@ ObjCMessageKind ObjCMethodCall::getMessageKind() const {
const Decl *ObjCMethodCall::getRuntimeDefinition() const {
const ObjCMessageExpr *E = getOriginExpr();
- Selector Sel = E->getSelector();
assert(E);
+ Selector Sel = E->getSelector();
if (E->isInstanceMessage()) {
- const MemRegion *Receiver = getReceiverSVal().getAsRegion();
- DynamicTypeInfo TI = getState()->getDynamicTypeInfo(Receiver);
- const ObjCObjectPointerType *T =
- dyn_cast<ObjCObjectPointerType>(TI.getType().getTypePtr());
- if (!T)
- return 0;
- if (ObjCInterfaceDecl *IDecl = T->getInterfaceDecl()) {
- // Find the method implementation.
- return IDecl->lookupPrivateMethod(Sel);
+
+ // Find the the receiver type.
+ const ObjCObjectPointerType *ReceiverT = 0;
+ QualType SupersType = E->getSuperType();
+ if (!SupersType.isNull()) {
+ ReceiverT = cast<ObjCObjectPointerType>(SupersType.getTypePtr());
+ } else {
+ const MemRegion *Receiver = getReceiverSVal().getAsRegion();
+ DynamicTypeInfo TI = getState()->getDynamicTypeInfo(Receiver);
+ ReceiverT = dyn_cast<ObjCObjectPointerType>(TI.getType().getTypePtr());
}
+ // Lookup the method implementation.
+ if (ReceiverT)
+ if (ObjCInterfaceDecl *IDecl = ReceiverT->getInterfaceDecl())
+ return IDecl->lookupPrivateMethod(Sel);
+
} else {
// This is a class method.
// If we have type info for the receiver class, we are calling via