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 | 2b6abdce509367fe03e511116ee245114dc26531 (patch) | |
| tree | 04ea60f38d5d14a1e66dce209124052dc50fdac9 | |
| parent | b06396c588e929e2efac9755119ee02835f97042 (diff) | |
| download | bcm5719-llvm-2b6abdce509367fe03e511116ee245114dc26531.tar.gz bcm5719-llvm-2b6abdce509367fe03e511116ee245114dc26531.zip | |
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
| -rw-r--r-- | clang/include/clang/Lex/IdentifierTable.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/include/clang/Lex/IdentifierTable.h b/clang/include/clang/Lex/IdentifierTable.h index b98cd9517a0..878f23788e8 100644 --- a/clang/include/clang/Lex/IdentifierTable.h +++ b/clang/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 |

