summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/TargetMachineC.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-04-09 17:16:25 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-04-09 17:16:25 +0000
commitf546d0f9c5c9dca127bf08be96ab866712b0ddbb (patch)
tree8d9239a04990c887153732421b6b911b5ffda481 /llvm/lib/Target/TargetMachineC.cpp
parentdf7305a4381f5fec155ab384917474e8c9b9e562 (diff)
downloadbcm5719-llvm-f546d0f9c5c9dca127bf08be96ab866712b0ddbb.tar.gz
bcm5719-llvm-f546d0f9c5c9dca127bf08be96ab866712b0ddbb.zip
Use a raw_svector_ostream instead of a raw_string_ostream.
It saves a bit of copying. llvm-svn: 234507
Diffstat (limited to 'llvm/lib/Target/TargetMachineC.cpp')
-rw-r--r--llvm/lib/Target/TargetMachineC.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/Target/TargetMachineC.cpp b/llvm/lib/Target/TargetMachineC.cpp
index 236cb1bed96..aaa66d3bf61 100644
--- a/llvm/lib/Target/TargetMachineC.cpp
+++ b/llvm/lib/Target/TargetMachineC.cpp
@@ -183,7 +183,9 @@ void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,
}
static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
- formatted_raw_ostream &OS, LLVMCodeGenFileType codegen, char **ErrorMessage) {
+ formatted_raw_ostream &OS,
+ LLVMCodeGenFileType codegen,
+ char **ErrorMessage) {
TargetMachine* TM = unwrap(T);
Module* Mod = unwrap(M);
@@ -238,15 +240,15 @@ LLVMBool LLVMTargetMachineEmitToFile(LLVMTargetMachineRef T, LLVMModuleRef M,
LLVMBool LLVMTargetMachineEmitToMemoryBuffer(LLVMTargetMachineRef T,
LLVMModuleRef M, LLVMCodeGenFileType codegen, char** ErrorMessage,
LLVMMemoryBufferRef *OutMemBuf) {
- std::string CodeString;
- raw_string_ostream OStream(CodeString);
+ SmallString<0> CodeString;
+ raw_svector_ostream OStream(CodeString);
formatted_raw_ostream Out(OStream);
bool Result = LLVMTargetMachineEmit(T, M, Out, codegen, ErrorMessage);
OStream.flush();
- std::string &Data = OStream.str();
- *OutMemBuf = LLVMCreateMemoryBufferWithMemoryRangeCopy(Data.c_str(),
- Data.length(), "");
+ StringRef Data = OStream.str();
+ *OutMemBuf =
+ LLVMCreateMemoryBufferWithMemoryRangeCopy(Data.data(), Data.size(), "");
return Result;
}
OpenPOWER on IntegriCloud