[cfe-commits] r98488 - /cfe/trunk/lib/Frontend/CacheTokens.cpp

Kovarththanan Rajaratnam kovarththanan.rajaratnam at gmail.com
Sun Mar 14 00:35:19 PST 2010


Author: krj
Date: Sun Mar 14 03:35:19 2010
New Revision: 98488

URL: http://llvm.org/viewvc/llvm-project?rev=98488&view=rev
Log:
Add EmitString helper method

Modified:
    cfe/trunk/lib/Frontend/CacheTokens.cpp

Modified: cfe/trunk/lib/Frontend/CacheTokens.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CacheTokens.cpp?rev=98488&r1=98487&r2=98488&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CacheTokens.cpp (original)
+++ cfe/trunk/lib/Frontend/CacheTokens.cpp Sun Mar 14 03:35:19 2010
@@ -196,6 +196,11 @@
     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 @@
 
   // 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);





More information about the cfe-commits mailing list