[cfe-commits] r85528 - in /cfe/trunk: include/clang/AST/DeclObjC.h lib/AST/DeclObjC.cpp tools/CIndex/CIndex.cpp
Steve Naroff
snaroff at apple.com
Thu Oct 29 14:11:04 PDT 2009
Author: snaroff
Date: Thu Oct 29 16:11:04 2009
New Revision: 85528
URL: http://llvm.org/viewvc/llvm-project?rev=85528&view=rev
Log:
- Add/tweak some comments.
- change ObjCCategoryImplDecl::getCategoryClass() to getCategoryDecl().
No functionality change.
Modified:
cfe/trunk/include/clang/AST/DeclObjC.h
cfe/trunk/lib/AST/DeclObjC.cpp
cfe/trunk/tools/CIndex/CIndex.cpp
Modified: cfe/trunk/include/clang/AST/DeclObjC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclObjC.h?rev=85528&r1=85527&r2=85528&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclObjC.h (original)
+++ cfe/trunk/include/clang/AST/DeclObjC.h Thu Oct 29 16:11:04 2009
@@ -862,7 +862,7 @@
};
class ObjCImplDecl : public ObjCContainerDecl {
- /// Class interface for this category implementation
+ /// Class interface for this class/category implementation
ObjCInterfaceDecl *ClassInterface;
protected:
@@ -935,14 +935,20 @@
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.
Modified: cfe/trunk/lib/AST/DeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclObjC.cpp?rev=85528&r1=85527&r2=85528&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclObjC.cpp (original)
+++ cfe/trunk/lib/AST/DeclObjC.cpp Thu Oct 29 16:11:04 2009
@@ -288,7 +288,7 @@
} else if (ObjCCategoryImplDecl *CImplD =
dyn_cast<ObjCCategoryImplDecl>(CtxD)) {
- if (ObjCCategoryDecl *CatD = CImplD->getCategoryClass())
+ if (ObjCCategoryDecl *CatD = CImplD->getCategoryDecl())
Redecl = CatD->getMethod(getSelector(), isInstanceMethod());
}
@@ -306,7 +306,7 @@
} 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;
@@ -635,7 +635,7 @@
return new (C) ObjCCategoryImplDecl(DC, L, Id, ClassInterface);
}
-ObjCCategoryDecl *ObjCCategoryImplDecl::getCategoryClass() const {
+ObjCCategoryDecl *ObjCCategoryImplDecl::getCategoryDecl() const {
return getClassInterface()->FindCategoryDeclaration(getIdentifier());
}
Modified: cfe/trunk/tools/CIndex/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/CIndex/CIndex.cpp?rev=85528&r1=85527&r2=85528&view=diff
==============================================================================
--- cfe/trunk/tools/CIndex/CIndex.cpp (original)
+++ cfe/trunk/tools/CIndex/CIndex.cpp Thu Oct 29 16:11:04 2009
@@ -551,7 +551,10 @@
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();
More information about the cfe-commits
mailing list