Use the cast machinery to remove dummy uses of formatted_raw_ostream.

If we know we are producing an object, we don't need to wrap the stream
in a formatted_raw_ostream anymore.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234461 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2015-04-09 02:28:12 +00:00
parent 271631a0af
commit 23295f613b
7 changed files with 21 additions and 27 deletions

View File

@@ -2146,13 +2146,13 @@ char CppWriter::ID = 0;
// External Interface declaration
//===----------------------------------------------------------------------===//
bool CPPTargetMachine::addPassesToEmitFile(PassManagerBase &PM,
formatted_raw_ostream &o,
bool CPPTargetMachine::addPassesToEmitFile(PassManagerBase &PM, raw_ostream &o,
CodeGenFileType FileType,
bool DisableVerify,
AnalysisID StartAfter,
AnalysisID StopAfter) {
if (FileType != TargetMachine::CGFT_AssemblyFile) return true;
PM.add(new CppWriter(o));
if (FileType != TargetMachine::CGFT_AssemblyFile)
return true;
PM.add(new CppWriter(cast<formatted_raw_ostream>(o)));
return false;
}

View File

@@ -29,7 +29,7 @@ struct CPPTargetMachine : public TargetMachine {
: TargetMachine(T, "", TT, CPU, FS, Options) {}
public:
bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out,
bool addPassesToEmitFile(PassManagerBase &PM, raw_ostream &Out,
CodeGenFileType FileType, bool DisableVerify,
AnalysisID StartAfter,
AnalysisID StopAfter) override;

View File

@@ -183,7 +183,9 @@ void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T,
}
static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M,
formatted_raw_ostream &OS, LLVMCodeGenFileType codegen, char **ErrorMessage) {
raw_ostream &OS,
LLVMCodeGenFileType codegen,
char **ErrorMessage) {
TargetMachine* TM = unwrap(T);
Module* Mod = unwrap(M);