From b4c0f5cc7921a4d08ff78ef6a2ef61eb508ea6d0 Mon Sep 17 00:00:00 2001 From: Kovarththanan Rajaratnam Date: Sun, 14 Mar 2010 08:35:19 +0000 Subject: Add EmitString helper method llvm-svn: 98488 --- clang/lib/Frontend/CacheTokens.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'clang/lib') diff --git a/clang/lib/Frontend/CacheTokens.cpp b/clang/lib/Frontend/CacheTokens.cpp index 029010dc196..3d7f5c0e852 100644 --- a/clang/lib/Frontend/CacheTokens.cpp +++ b/clang/lib/Frontend/CacheTokens.cpp @@ -196,6 +196,11 @@ class PTHWriter { Out.write(Ptr, NumBytes); } + void EmitString(llvm::StringRef V) { + ::Emit16(Out, V.size()); + EmitBuf(V.data(), V.size()); + } + /// EmitIdentifierTable - Emits two tables to the PTH file. The first is /// a hashtable mapping from identifier strings to persistent IDs. /// The second is a straight table mapping from persistent IDs to string data @@ -447,8 +452,7 @@ void PTHWriter::GeneratePTH(const std::string &MainFile) { // Write the name of the MainFile. if (!MainFile.empty()) { - Emit16(MainFile.length()); - EmitBuf(MainFile.data(), MainFile.length()); + EmitString(MainFile); } else { // String with 0 bytes. Emit16(0); -- cgit v1.2.3