summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2011-06-21 15:13:30 +0000
committerJay Foad <jay.foad@gmail.com>2011-06-21 15:13:30 +0000
commit9a6b09874dab1247224f04d3dc5e9e900c9110a9 (patch)
treef870578396e39c1a4d958ff1adec70ab7f67f9d4 /clang/lib/Frontend
parentccbb77f2396eff2f782b3aab8fff1cc79a7c5cb6 (diff)
downloadbcm5719-llvm-9a6b09874dab1247224f04d3dc5e9e900c9110a9.tar.gz
bcm5719-llvm-9a6b09874dab1247224f04d3dc5e9e900c9110a9.zip
Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue(). llvm-svn: 133515
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r--clang/lib/Frontend/CacheTokens.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/clang/lib/Frontend/CacheTokens.cpp b/clang/lib/Frontend/CacheTokens.cpp
index 06a1fd29838..20b51893fcc 100644
--- a/clang/lib/Frontend/CacheTokens.cpp
+++ b/clang/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.
OpenPOWER on IntegriCloud