]> granicus.if.org Git - clang/commitdiff
Objective-C. Return 0 as class of methods in protocols.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 4 Mar 2014 22:57:32 +0000 (22:57 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 4 Mar 2014 22:57:32 +0000 (22:57 +0000)
This simplifies my last patch a bit. No change in
functionality.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@202906 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclObjC.cpp
lib/CodeGen/CGObjCMac.cpp

index ce0845681ab6cbb60ace97582288066576d962d3..94c4d5187a3a086f20e383917fca37d71f23b222 100644 (file)
@@ -950,8 +950,8 @@ ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() {
     return CD->getClassInterface();
   if (ObjCImplDecl *IMD = dyn_cast<ObjCImplDecl>(getDeclContext()))
     return IMD->getClassInterface();
-
-  assert(!isa<ObjCProtocolDecl>(getDeclContext()) && "It's a protocol method");
+  if (isa<ObjCProtocolDecl>(getDeclContext()))
+    return 0;
   llvm_unreachable("unknown method context");
 }
 
index ebbd7007c14c0824f53cad4b06adefe2d5579bc0..d0419ec1632a36c1c5764fc501aa721b1a59a007 100644 (file)
@@ -1455,8 +1455,7 @@ private:
     // interface, we cannot perform this check.
     if (const ObjCMethodDecl *MD =
           dyn_cast_or_null<ObjCMethodDecl>(CGF.CurFuncDecl))
-      if (MD->isInstanceMethod() &&
-          !isa<ObjCProtocolDecl>(MD->getDeclContext()))
+      if (MD->isInstanceMethod())
         if (const ObjCInterfaceDecl *ID = MD->getClassInterface())
           return IV->getContainingInterface()->isSuperClassOf(ID);
     return false;