Fix a bug I introduced in my const'ification patch.

llvm-svn: 49262
This commit is contained in:
Chris Lattner 2008-04-06 05:25:03 +00:00
parent 0a5ff0d34a
commit 713e6592be
2 changed files with 6 additions and 7 deletions

View File

@ -125,9 +125,9 @@ public:
NamedDecl *getMethodContext() const { return MethodContext; }
const ObjCInterfaceDecl *getClassInterface() const;
ObjCInterfaceDecl *getClassInterface() {
return (ObjCInterfaceDecl*)((ObjCMethodDecl*)this)->getClassInterface();
ObjCInterfaceDecl *getClassInterface();
const ObjCInterfaceDecl *getClassInterface() const {
return const_cast<ObjCMethodDecl*>(this)->getClassInterface();
}
Selector getSelector() const { return SelName; }

View File

@ -417,7 +417,7 @@ unsigned ObjCMethodDecl::getSynthesizedMethodSize() const {
return length;
}
const ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() const {
ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() {
if (ObjCInterfaceDecl *ID = dyn_cast<ObjCInterfaceDecl>(MethodContext))
return ID;
if (ObjCCategoryDecl *CD = dyn_cast<ObjCCategoryDecl>(MethodContext))
@ -425,8 +425,7 @@ const ObjCInterfaceDecl *ObjCMethodDecl::getClassInterface() const {
if (ObjCImplementationDecl *IMD =
dyn_cast<ObjCImplementationDecl>(MethodContext))
return IMD->getClassInterface();
if (ObjCCategoryImplDecl *CID =
dyn_cast<ObjCCategoryImplDecl>(MethodContext))
if (ObjCCategoryImplDecl *CID = dyn_cast<ObjCCategoryImplDecl>(MethodContext))
return CID->getClassInterface();
assert(false && "unknown method context");
return 0;