aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Lex/IdentifierTable.h13
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