[CodeGenObjC] Fix a nullptr dyn_cast
ObjCMessageExpr::getInstanceReceiver returns nullptr if the receiver
is 'super'. Make this check more strict, since we don't care about
messages to super here.
rdar://48247290
llvm-svn: 354826
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 1b3e71b..fba1a53 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -433,8 +433,9 @@
// Match the exact pattern '[[MyClass alloc] init]'.
Selector Sel = OME->getSelector();
- if (!OME->isInstanceMessage() || !OME->getType()->isObjCObjectPointerType() ||
- !Sel.isUnarySelector() || Sel.getNameForSlot(0) != "init")
+ if (OME->getReceiverKind() != ObjCMessageExpr::Instance ||
+ !OME->getType()->isObjCObjectPointerType() || !Sel.isUnarySelector() ||
+ Sel.getNameForSlot(0) != "init")
return None;
// Okay, this is '[receiver init]', check if 'receiver' is '[cls alloc]'.