eliminate some wrappers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67904 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/SerializationTest.cpp b/tools/clang-cc/SerializationTest.cpp
index fcc047e..aa3163f 100644
--- a/tools/clang-cc/SerializationTest.cpp
+++ b/tools/clang-cc/SerializationTest.cpp
@@ -74,7 +74,21 @@
}
// 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,