diff options
author | Chris Lattner <sabre@nondot.org> | 2007-09-30 08:32:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-09-30 08:32:27 +0000 |
commit | 1f945f632ae993bbb9f9e69d908f7526924c1a88 (patch) | |
tree | 0f08bda825fbd75e90133da9a2543da179d7330b | |
parent | 5c0fa3001713e6570632f426af7ac4e20b1d34ff (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42481 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Lex/IdentifierTable.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/include/clang/Lex/IdentifierTable.h b/include/clang/Lex/IdentifierTable.h index b98cd9517a..878f23788e 100644 --- a/include/clang/Lex/IdentifierTable.h +++ b/include/clang/Lex/IdentifierTable.h @@ -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 |