diff options
author | Jay Foad <jay.foad@gmail.com> | 2011-06-21 15:13:30 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@gmail.com> | 2011-06-21 15:13:30 +0000 |
commit | 65aa6885818d4b4eea2e5a9d12085b2398148662 (patch) | |
tree | 7bd303c20cc28939158f9db96576f2b39316d55f /lib/Frontend/CacheTokens.cpp | |
parent | 468eb7ddd69b5d545139fc46a3b730268c458f38 (diff) |
Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133515 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/CacheTokens.cpp')
-rw-r--r-- | lib/Frontend/CacheTokens.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp index 06a1fd2983..20b51893fc 100644 --- a/lib/Frontend/CacheTokens.cpp +++ b/lib/Frontend/CacheTokens.cpp @@ -247,17 +247,16 @@ void PTHWriter::EmitToken(const Token& T) { } else { // We cache *un-cleaned* spellings. This gives us 100% fidelity with the // source code. - const char* s = T.getLiteralData(); - unsigned len = T.getLength(); + llvm::StringRef s(T.getLiteralData(), T.getLength()); // Get the string entry. - llvm::StringMapEntry<OffsetOpt> *E = &CachedStrs.GetOrCreateValue(s, s+len); + llvm::StringMapEntry<OffsetOpt> *E = &CachedStrs.GetOrCreateValue(s); // If this is a new string entry, bump the PTH offset. if (!E->getValue().hasOffset()) { E->getValue().setOffset(CurStrOffset); StrEntries.push_back(E); - CurStrOffset += len + 1; + CurStrOffset += s.size() + 1; } // Emit the relative offset into the PTH file for the spelling string. |