Add a new getLength() method to IdentifierInfo, which relies on a newly added

method to StringMapEntry.  Steve, please use this to remove the
strlen calls in selector processing.

llvm-svn: 42481
This commit is contained in:
Chris Lattner 2007-09-30 08:32:27 +00:00
parent b06396c588
commit 2b6abdce50
1 changed files with 11 additions and 2 deletions

View File

@ -53,8 +53,17 @@ public:
/// string is properly null terminated.
///
const char *getName() const {
// String data is stored immediately after the IdentifierInfo object.
return (const char*)(this+1);
// We know that this is embedded into a StringMapEntry, and it knows how to
// efficiently find the string.
return llvm::StringMapEntry<IdentifierInfo>::
GetStringMapEntryFromValue(*this).getKeyData();
}
/// getLength - Efficiently return the length of this identifier info.
///
unsigned getLength() const {
return llvm::StringMapEntry<IdentifierInfo>::
GetStringMapEntryFromValue(*this).getKeyLength();
}
/// getMacroInfo - Return macro information about this identifier, or null if