summaryrefslogtreecommitdiff
path: root/lib/Target/TargetMachineC.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-06-26 22:52:05 +0000
committerAlp Toker <alp@nuanti.com>2014-06-26 22:52:05 +0000
commit8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d (patch)
tree7da91c52380a71a92a895b0c172ae28b83fb6011 /lib/Target/TargetMachineC.cpp
parenteca517deaa890b1658ed0452704f398ce80e47b8 (diff)
downloadllvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.gz
llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.bz2
llvm-8dd8d5c2b2ad0f9dd1ca01c0a7d8ebac57b8537d.tar.xz
Revert "Introduce a string_ostream string builder facilty"
Temporarily back out commits r211749, r211752 and r211754. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@211814 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/TargetMachineC.cpp')
-rw-r--r--lib/Target/TargetMachineC.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/Target/TargetMachineC.cpp b/lib/Target/TargetMachineC.cpp
index 0b0a09a0ad..20923c97ec 100644
--- a/lib/Target/TargetMachineC.cpp
+++ b/lib/Target/TargetMachineC.cpp
@@ -237,13 +237,15 @@ LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M,
LLVMBool LLVMTargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T,
LLVMModuleRef M, LLVMCodeGenFileType codegen, char** ErrorMessage,
LLVMMemoryBufferRef *OutMemBuf) {
- string_ostream Code;
- formatted_raw_ostream Out(Code);
+ std::string CodeString;
+ raw_string_ostream OStream(CodeString);
+ formatted_raw_ostream Out(OStream);
bool Result = LLVMTargetMachineEmit(T, M, Out, codegen, ErrorMessage);
+ OStream.flush();
- StringRef Buffer = Code.str();
- *OutMemBuf = LLVMCreateMemoryBufferWithMemoryRangeCopy(Buffer.data(),
- Buffer.size(), "");
+ std::string &Data = OStream.str();
+ *OutMemBuf = LLVMCreateMemoryBufferWithMemoryRangeCopy(Data.c_str(),
+ Data.length(), "");
return Result;
}