From: Benjamin Kramer Date: Sat, 19 Sep 2009 08:02:46 +0000 (+0000) Subject: Simplify code with a StringRef. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c2ff3f85481fbfa79f56a444b5726d4ab394bf4d;p=clang Simplify code with a StringRef. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82308 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Basic/IdentifierTable.h b/include/clang/Basic/IdentifierTable.h index 8512538e45..84c2fc910d 100644 --- a/include/clang/Basic/IdentifierTable.h +++ b/include/clang/Basic/IdentifierTable.h @@ -334,13 +334,8 @@ public: return *II; } - IdentifierInfo &get(const char *Name) { - return get(Name, Name+strlen(Name)); - } - IdentifierInfo &get(const std::string &Name) { - // Don't use c_str() here: no need to be null terminated. - const char *NameBytes = Name.data(); - return get(NameBytes, NameBytes+Name.size()); + IdentifierInfo &get(const llvm::StringRef& Name) { + return get(Name.begin(), Name.end()); } typedef HashTableTy::const_iterator iterator;