aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
authorKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2010-03-14 08:35:19 +0000
committerKovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com>2010-03-14 08:35:19 +0000
commitc3cde071b41ca83e43de8dc2abe9a99f77a9ebb8 (patch)
tree1b5cedb5836d394746a309e0dcee11dacdd05754 /lib/Frontend
parent2e6051ad0149c0e7b626558c110fba29bfc754cd (diff)
Add EmitString helper method
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98488 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/CacheTokens.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Frontend/CacheTokens.cpp b/lib/Frontend/CacheTokens.cpp
index 029010dc19..3d7f5c0e85 100644
--- a/lib/Frontend/CacheTokens.cpp
+++ b/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);