r202906 - Objective-C. Return 0 as class of methods in protocols.
Fariborz Jahanian
fjahanian at apple.com
Tue Mar 4 14:57:33 PST 2014
Author: fjahanian
Date: Tue Mar 4 16:57:32 2014
New Revision: 202906
URL: http://llvm.org/viewvc/llvm-project?rev=202906&view=rev
Log:
Objective-C. Return 0 as class of methods in protocols.
This simplifies my last patch a bit. No change in
functionality.
Modified:
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=202906&r1=202905&r2=202906&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Tue Mar 4 16:57:32 2014
@@ -950,8 +950,8 @@ ObjCInterfaceDecl *ObjCMethodDecl::getCl
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");
}
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=202906&r1=202905&r2=202906&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Mar 4 16:57:32 2014
@@ -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;
More information about the cfe-commits
mailing list