diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/CodeGen/LLVMTargetMachine.cpp | 15 | ||||
| -rw-r--r-- | llvm/lib/LTO/LTOCodeGenerator.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/Support/Debug.cpp | 5 | ||||
| -rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 9 | ||||
| -rw-r--r-- | llvm/lib/Target/CppBackend/CPPBackend.cpp | 8 | ||||
| -rw-r--r-- | llvm/lib/Target/CppBackend/CPPTargetMachine.h | 2 | ||||
| -rw-r--r-- | llvm/lib/Target/TargetMachineC.cpp | 4 |
7 files changed, 26 insertions, 22 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp index 4574dcfe9ef..30148446195 100644 --- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp +++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp @@ -140,9 +140,12 @@ static MCContext *addPassesToGenerateCode(LLVMTargetMachine *TM, return &MMI->getContext(); } -bool LLVMTargetMachine::addPassesToEmitFile( - PassManagerBase &PM, raw_ostream &Out, CodeGenFileType FileType, - bool DisableVerify, AnalysisID StartAfter, AnalysisID StopAfter) { +bool LLVMTargetMachine::addPassesToEmitFile(PassManagerBase &PM, + formatted_raw_ostream &Out, + CodeGenFileType FileType, + bool DisableVerify, + AnalysisID StartAfter, + AnalysisID StopAfter) { // Add common CodeGen passes. MCContext *Context = addPassesToGenerateCode(this, PM, DisableVerify, StartAfter, StopAfter); @@ -182,9 +185,9 @@ bool LLVMTargetMachine::addPassesToEmitFile( MCAsmBackend *MAB = getTarget().createMCAsmBackend(MRI, getTargetTriple(), TargetCPU); MCStreamer *S = getTarget().createAsmStreamer( - *Context, cast<formatted_raw_ostream>(Out), - Options.MCOptions.AsmVerbose, Options.MCOptions.MCUseDwarfDirectory, - InstPrinter, MCE, MAB, Options.MCOptions.ShowMCInst); + *Context, Out, Options.MCOptions.AsmVerbose, + Options.MCOptions.MCUseDwarfDirectory, InstPrinter, MCE, MAB, + Options.MCOptions.ShowMCInst); AsmStreamer.reset(S); break; } diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp index 2bcdc27e965..ad73ddc5d7a 100644 --- a/llvm/lib/LTO/LTOCodeGenerator.cpp +++ b/llvm/lib/LTO/LTOCodeGenerator.cpp @@ -38,6 +38,7 @@ #include "llvm/MC/SubtargetFeature.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/FormattedStream.h" #include "llvm/Support/Host.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/Signals.h" @@ -573,11 +574,13 @@ bool LTOCodeGenerator::compileOptimized(raw_ostream &out, std::string &errMsg) { legacy::PassManager codeGenPasses; + formatted_raw_ostream Out(out); + // If the bitcode files contain ARC code and were compiled with optimization, // the ObjCARCContractPass must be run, so do it unconditionally here. codeGenPasses.add(createObjCARCContractPass()); - if (TargetMach->addPassesToEmitFile(codeGenPasses, out, + if (TargetMach->addPassesToEmitFile(codeGenPasses, Out, TargetMachine::CGFT_ObjectFile)) { errMsg = "target file type not supported"; return false; diff --git a/llvm/lib/Support/Debug.cpp b/llvm/lib/Support/Debug.cpp index 896898c185c..a88b18e6c06 100644 --- a/llvm/lib/Support/Debug.cpp +++ b/llvm/lib/Support/Debug.cpp @@ -114,8 +114,9 @@ static void debug_user_sig_handler(void *Cookie) { // know that debug mode is enabled and dbgs() really is a // circular_raw_ostream. If NDEBUG is defined, then dbgs() == // errs() but this will never be invoked. - llvm::circular_raw_ostream &dbgout = cast<circular_raw_ostream>(llvm::dbgs()); - dbgout.flushBufferWithBanner(); + llvm::circular_raw_ostream *dbgout = + static_cast<llvm::circular_raw_ostream *>(&llvm::dbgs()); + dbgout->flushBufferWithBanner(); } /// dbgs - Return a circular-buffered debug stream. diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index a312126fffe..051e2dd252f 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -489,7 +489,7 @@ void format_object_base::home() { raw_fd_ostream::raw_fd_ostream(StringRef Filename, std::error_code &EC, sys::fs::OpenFlags Flags) - : raw_ostream(SK_FD), Error(false), UseAtomicWrites(false), pos(0) { + : Error(false), UseAtomicWrites(false), pos(0) { EC = std::error_code(); // Handle "-" as stdout. Note that when we do this, we consider ourself // the owner of stdout. This means that we can do things like close the @@ -519,8 +519,8 @@ raw_fd_ostream::raw_fd_ostream(StringRef Filename, std::error_code &EC, /// raw_fd_ostream ctor - FD is the file descriptor that this writes to. If /// ShouldClose is true, this closes the file when the stream is destroyed. raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered) - : raw_ostream(SK_FD, unbuffered), FD(fd), ShouldClose(shouldClose), - Error(false), UseAtomicWrites(false) { + : raw_ostream(unbuffered), FD(fd), + ShouldClose(shouldClose), Error(false), UseAtomicWrites(false) { #ifdef O_BINARY // Setting STDOUT to binary mode is necessary in Win32 // to avoid undesirable linefeed conversion. @@ -749,8 +749,7 @@ void raw_string_ostream::write_impl(const char *Ptr, size_t Size) { // capacity. This allows raw_ostream to write directly into the correct place, // and we only need to set the vector size when the data is flushed. -raw_svector_ostream::raw_svector_ostream(SmallVectorImpl<char> &O) - : raw_ostream(SK_SVECTOR), OS(O) { +raw_svector_ostream::raw_svector_ostream(SmallVectorImpl<char> &O) : OS(O) { // Set up the initial external buffer. We make sure that the buffer has at // least 128 bytes free; raw_ostream itself only requires 64, but we want to // make sure that we don't grow the buffer unnecessarily on destruction (when diff --git a/llvm/lib/Target/CppBackend/CPPBackend.cpp b/llvm/lib/Target/CppBackend/CPPBackend.cpp index 0fd6918acc9..d0e2010abfd 100644 --- a/llvm/lib/Target/CppBackend/CPPBackend.cpp +++ b/llvm/lib/Target/CppBackend/CPPBackend.cpp @@ -2146,13 +2146,13 @@ char CppWriter::ID = 0; // External Interface declaration //===----------------------------------------------------------------------===// -bool CPPTargetMachine::addPassesToEmitFile(PassManagerBase &PM, raw_ostream &o, +bool CPPTargetMachine::addPassesToEmitFile(PassManagerBase &PM, + formatted_raw_ostream &o, CodeGenFileType FileType, bool DisableVerify, AnalysisID StartAfter, AnalysisID StopAfter) { - if (FileType != TargetMachine::CGFT_AssemblyFile) - return true; - PM.add(new CppWriter(cast<formatted_raw_ostream>(o))); + if (FileType != TargetMachine::CGFT_AssemblyFile) return true; + PM.add(new CppWriter(o)); return false; } diff --git a/llvm/lib/Target/CppBackend/CPPTargetMachine.h b/llvm/lib/Target/CppBackend/CPPTargetMachine.h index 04f81e9e966..678a932cb28 100644 --- a/llvm/lib/Target/CppBackend/CPPTargetMachine.h +++ b/llvm/lib/Target/CppBackend/CPPTargetMachine.h @@ -29,7 +29,7 @@ struct CPPTargetMachine : public TargetMachine { : TargetMachine(T, "", TT, CPU, FS, Options) {} public: - bool addPassesToEmitFile(PassManagerBase &PM, raw_ostream &Out, + bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out, CodeGenFileType FileType, bool DisableVerify, AnalysisID StartAfter, AnalysisID StopAfter) override; diff --git a/llvm/lib/Target/TargetMachineC.cpp b/llvm/lib/Target/TargetMachineC.cpp index cbfb914d9dc..236cb1bed96 100644 --- a/llvm/lib/Target/TargetMachineC.cpp +++ b/llvm/lib/Target/TargetMachineC.cpp @@ -183,9 +183,7 @@ void LLVMSetTargetMachineAsmVerbosity(LLVMTargetMachineRef T, } static LLVMBool LLVMTargetMachineEmit(LLVMTargetMachineRef T, LLVMModuleRef M, - raw_ostream &OS, - LLVMCodeGenFileType codegen, - char **ErrorMessage) { + formatted_raw_ostream &OS, LLVMCodeGenFileType codegen, char **ErrorMessage) { TargetMachine* TM = unwrap(T); Module* Mod = unwrap(M); |

