From: Daniel Dunbar Date: Mon, 19 Oct 2009 01:20:57 +0000 (+0000) Subject: Add ObjCImplementationDecl::getName() for consistency, with FIXME. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d0c10e20d5ba8c1a8a077db128c03eddc3158673;p=clang Add ObjCImplementationDecl::getName() for consistency, with FIXME. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84455 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/AST/DeclObjC.h b/include/clang/AST/DeclObjC.h index d9bac0cff7..729a2f1383 100644 --- a/include/clang/AST/DeclObjC.h +++ b/include/clang/AST/DeclObjC.h @@ -1008,21 +1008,30 @@ public: return getClassInterface()->getIdentifier(); } + /// getName - Get the name of identifier for the class interface associated + /// with this implementation as a StringRef. + // + // FIXME: This is a bad API, we are overriding the NamedDecl::getName, to mean + // something different. + llvm::StringRef getName() const { + assert(getIdentifier() && "Name is not a simple identifier"); + return getIdentifier()->getName(); + } + /// getNameAsCString - Get the name of identifier for the class /// interface associated with this implementation as a C string /// (const char*). // // FIXME: Move to StringRef API. const char *getNameAsCString() const { - assert(getIdentifier() && "Name is not a simple identifier"); - return getIdentifier()->getNameStart(); + return getName().data(); } /// @brief Get the name of the class associated with this interface. // // FIXME: Move to StringRef API. std::string getNameAsString() const { - return getClassInterface()->getNameAsString(); + return getName(); } const ObjCInterfaceDecl *getSuperClass() const { return SuperClass; }