/// and that it be a simple identifier.
const char *getNameAsCString() const {
assert(getIdentifier() && "Name is not a simple identifier");
- return getIdentifier()->getName();
+ return getIdentifier()->getNameStart();
}
/// getDeclName - Get the actual, stored name of the declaration,
/// 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 {
- return Id ? Id->getName() : "";
+ return Id ? Id->getNameStart() : "";
}
/// @brief Get the name of the class associated with this interface.
+ //
+ // FIXME: Move to StringRef API.
std::string getNameAsString() const {
- return Id ? Id->getName() : "";
+ return Id ? Id->getNameStr() : "";
}
static bool classof(const Decl *D) { return D->getKind() == ObjCCategoryImpl;}
/// 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()->getName();
+ return getIdentifier()->getNameStart();
}
/// @brief Get the name of the class associated with this interface.
+ //
+ // FIXME: Move to StringRef API.
std::string getNameAsString() const {
return getClassInterface()->getNameAsString();
}
/// This is intended to be used for string literals only: II->isStr("foo").
template <std::size_t StrLen>
bool isStr(const char (&Str)[StrLen]) const {
- return getLength() == StrLen-1 && !memcmp(getName(), Str, StrLen-1);
+ return getLength() == StrLen-1 && !memcmp(getNameStart(), Str, StrLen-1);
}
- /// getName - Return the actual string for this identifier. The returned
- /// string is properly null terminated.
+ /// getNameStart - Return the beginning of the actual string for this
+ /// identifier. The returned string is properly null terminated.
///
- const char *getName() const {
+ const char *getNameStart() const {
if (Entry) return Entry->getKeyData();
// FIXME: This is gross. It would be best not to embed specific details
// of the PTH file format here.
// std::pair<IdentifierInfo, const char*>, where internal pointer
// points to the external string data.
const char* p = ((std::pair<IdentifierInfo, const char*>*) this)->second-2;
- return (((unsigned) p[0])
- | (((unsigned) p[1]) << 8)) - 1;
+ return (((unsigned) p[0]) | (((unsigned) p[1]) << 8)) - 1;
+ }
+
+ // FIXME: Deprecated.
+ const char *getName() const {
+ return getNameStart();
+ }
+
+ /// getNameStr - Return the actual identifier string.
+ llvm::StringRef getNameStr() const {
+ return llvm::StringRef(getNameStart(), getLength());
}
/// hasMacroDefinition - Return true if this identifier is #defined to some
const IdentifierInfo *Name) {
llvm::SmallString<100> SelectorName;
SelectorName = "set";
- SelectorName.append(Name->getName(), Name->getName()+Name->getLength());
+ SelectorName += Name->getNameStr();
SelectorName[3] = toupper(SelectorName[3]);
IdentifierInfo *SetterName =
&Idents.get(SelectorName.data(),