summaryrefslogtreecommitdiffstats
path: root/clang/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
commit96c339a661a56fe80d17dbc93cfcb27591274af0 (patch)
tree626ca53f190d7b092c3d66fba542d817d7d93343 /clang/tools/clang-cc/SerializationTest.cpp
parentf7d9e2ba1cf4458bc24ba16a0d69dd29224f764d (diff)
downloadbcm5719-llvm-96c339a661a56fe80d17dbc93cfcb27591274af0.tar.gz
bcm5719-llvm-96c339a661a56fe80d17dbc93cfcb27591274af0.zip
eliminate some wrappers.
llvm-svn: 67904
Diffstat (limited to 'clang/tools/clang-cc/SerializationTest.cpp')
-rw-r--r--clang/tools/clang-cc/SerializationTest.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/clang/tools/clang-cc/SerializationTest.cpp b/clang/tools/clang-cc/SerializationTest.cpp
index fcc047e0156..aa3163f5566 100644
--- a/clang/tools/clang-cc/SerializationTest.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud