aboutsummaryrefslogtreecommitdiff
path: root/tools/clang-cc/SerializationTest.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-03-28 03:53:02 +0000
committerChris Lattner <sabre@nondot.org>2009-03-28 03:53:02 +0000
commit80a033358d8da09d1f62b0b3ba98cee0346c0a49 (patch)
tree960a571d602c900cd564a1a2b13f3ba1367f5f78 /tools/clang-cc/SerializationTest.cpp
parent5f737ccd3854b55a3eb9ab3aa54f2b1c3212418f (diff)
eliminate some wrappers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-cc/SerializationTest.cpp')
-rw-r--r--tools/clang-cc/SerializationTest.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/clang-cc/SerializationTest.cpp b/tools/clang-cc/SerializationTest.cpp
index fcc047e015..aa3163f556 100644
--- a/tools/clang-cc/SerializationTest.cpp
+++ b/tools/clang-cc/SerializationTest.cpp
@@ -74,7 +74,21 @@ bool SerializationTest::Serialize(llvm::sys::Path& Filename,
}
// Serialize the translation unit.
- return EmitASTBitcodeFile(TU,Filename);
+
+ // Reserve 256K for bitstream buffer.
+ std::vector<unsigned char> Buffer;
+ Buffer.reserve(256*1024);
+
+ EmitASTBitcodeBuffer(TU,Buffer);
+
+ // Write the bits to disk.
+ if (FILE* fp = fopen(Filename.c_str(),"wb")) {
+ fwrite((char*)&Buffer.front(), sizeof(char), Buffer.size(), fp);
+ fclose(fp);
+ return true;
+ }
+
+ return false;
}
bool SerializationTest::Deserialize(llvm::sys::Path& Filename,