summaryrefslogtreecommitdiff
path: root/unittests/Bitcode
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2012-02-29 20:30:56 +0000
committerDaniel Dunbar <daniel@zuster.org>2012-02-29 20:30:56 +0000
commitfdc8f785cd52a4438d5bf914594253b7787ab80e (patch)
tree8bf824d6e34688576dd9f52def1d95c74affb9ef /unittests/Bitcode
parent9fd58f05d5f87ca4c4113eb3f78e1932a4e2f8d5 (diff)
Bitcode: Don't expose WriteBitcodeToStream to clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151747 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Bitcode')
-rw-r--r--unittests/Bitcode/BitReaderTest.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/unittests/Bitcode/BitReaderTest.cpp b/unittests/Bitcode/BitReaderTest.cpp
index 91e6c15155..68cfe2836a 100644
--- a/unittests/Bitcode/BitReaderTest.cpp
+++ b/unittests/Bitcode/BitReaderTest.cpp
@@ -7,6 +7,7 @@
//
//===----------------------------------------------------------------------===//
+#include "llvm/ADT/SmallString.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Bitcode/BitstreamWriter.h"
#include "llvm/Bitcode/ReaderWriter.h"
@@ -43,17 +44,16 @@ static Module *makeLLVMModule() {
return Mod;
}
-static void writeModuleToBuffer(std::vector<unsigned char> &Buffer) {
+static void writeModuleToBuffer(SmallVectorImpl<char> &Buffer) {
Module *Mod = makeLLVMModule();
- BitstreamWriter Stream(Buffer);
- WriteBitcodeToStream(Mod, Stream);
+ raw_svector_ostream OS(Buffer);
+ WriteBitcodeToFile(Mod, OS);
}
TEST(BitReaderTest, MaterializeFunctionsForBlockAddr) { // PR11677
- std::vector<unsigned char> Mem;
+ SmallString<1024> Mem;
writeModuleToBuffer(Mem);
- StringRef Data((const char*)&Mem[0], Mem.size());
- MemoryBuffer *Buffer = MemoryBuffer::getMemBuffer(Data, "test", false);
+ MemoryBuffer *Buffer = MemoryBuffer::getMemBuffer(Mem.str(), "test", false);
std::string errMsg;
Module *m = getLazyBitcodeModule(Buffer, getGlobalContext(), &errMsg);
PassManager passes;