};
class ObjCImplDecl : public ObjCContainerDecl {
- /// Class interface for this category implementation
+ /// Class interface for this class/category implementation
ObjCInterfaceDecl *ClassInterface;
protected:
SourceLocation L, IdentifierInfo *Id,
ObjCInterfaceDecl *classInterface);
- /// getIdentifier - Get the identifier that names the class
+ /// getIdentifier - Get the identifier that names the category
/// interface associated with this implementation.
+ /// FIXME: This is a bad API, we are overriding the NamedDecl::getIdentifier()
+ /// to mean something different. For example:
+ /// ((NamedDecl *)SomeCategoryImplDecl)->getIdentifier()
+ /// returns the class interface name, whereas
+ /// ((ObjCCategoryImplDecl *)SomeCategoryImplDecl)->getIdentifier()
+ /// returns the category name.
IdentifierInfo *getIdentifier() const {
return Id;
}
void setIdentifier(IdentifierInfo *II) { Id = II; }
- ObjCCategoryDecl *getCategoryClass() const;
+ ObjCCategoryDecl *getCategoryDecl() const;
/// getName - Get the name of identifier for the class interface associated
/// with this implementation as a StringRef.
} else if (ObjCCategoryImplDecl *CImplD =
dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
- if (ObjCCategoryDecl *CatD = CImplD->getCategoryClass())
+ if (ObjCCategoryDecl *CatD = CImplD->getCategoryDecl())
Redecl = CatD->getMethod(getSelector(), isInstanceMethod());
}
} else if (ObjCCategoryImplDecl *CImplD =
dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
- if (ObjCCategoryDecl *CatD = CImplD->getCategoryClass())
+ if (ObjCCategoryDecl *CatD = CImplD->getCategoryDecl())
if (ObjCMethodDecl *MD = CatD->getMethod(getSelector(),
isInstanceMethod()))
return MD;
return new (C) ObjCCategoryImplDecl(DC, L, Id, ClassInterface);
}
-ObjCCategoryDecl *ObjCCategoryImplDecl::getCategoryClass() const {
+ObjCCategoryDecl *ObjCCategoryImplDecl::getCategoryDecl() const {
return getClassInterface()->FindCategoryDeclaration(getIdentifier());
}
return OMD->getSelector().getAsString().c_str();
}
if (ObjCCategoryImplDecl *CIMP = dyn_cast<ObjCCategoryImplDecl>(ND))
- return CIMP->getCategoryClass()->getName().data();
+ // No, this isn't the same as the code below. getIdentifier() is non-virtual
+ // and returns different names. NamedDecl returns the class name and
+ // ObjCCategoryImplDecl returns the category name.
+ return CIMP->getIdentifier()->getNameStart();
if (ND->getIdentifier())
return ND->getIdentifier()->getNameStart();