Remove cause of misc. "variable might be used uninitialized in this function" warnings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45546 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/SemaExpr.cpp b/Sema/SemaExpr.cpp
index 6c9d8ba..1ec60d9 100644
--- a/Sema/SemaExpr.cpp
+++ b/Sema/SemaExpr.cpp
@@ -2308,7 +2308,7 @@
Expr *RExpr = static_cast<Expr *>(receiver);
QualType receiverType = RExpr->getType();
QualType returnType;
- ObjcMethodDecl *Method;
+ ObjcMethodDecl *Method = 0;
if (receiverType == Context.getObjcIdType() ||
receiverType == Context.getObjcClassType()) {
@@ -2336,7 +2336,7 @@
static_cast<PointerType*>(receiverType.getTypePtr());
receiverType = pointerType->getPointeeType();
}
- ObjcInterfaceDecl* ClassDecl;
+ ObjcInterfaceDecl* ClassDecl = 0;
if (ObjcQualifiedInterfaceType *QIT =
dyn_cast<ObjcQualifiedInterfaceType>(receiverType)) {
ClassDecl = QIT->getDecl();
@@ -2379,9 +2379,10 @@
}
if (!Method) {
// If we have an implementation in scope, check "private" methods.
- if (ObjcImplementationDecl *ImpDecl =
+ if (ClassDecl)
+ if (ObjcImplementationDecl *ImpDecl =
ObjcImplementations[ClassDecl->getIdentifier()])
- Method = ImpDecl->getInstanceMethod(Sel);
+ Method = ImpDecl->getInstanceMethod(Sel);
// If we still haven't found a method, look in the global pool. This
// behavior isn't very desirable, however we need it for GCC compatibility.
if (!Method)