From 68fe61d6a165ea6090008e281330895a21607daf Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 29 Nov 2006 00:19:40 +0000 Subject: Replacing std::iostreams with llvm iostreams. Some of these changes involve adding a temporary wrapper around the ostream to make it friendly to functions expecting an LLVM stream. This should be fixed in the future. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31990 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-as/llvm-as.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'tools/llvm-as') diff --git a/tools/llvm-as/llvm-as.cpp b/tools/llvm-as/llvm-as.cpp index 4a1b9adb00..d8f487ee9d 100644 --- a/tools/llvm-as/llvm-as.cpp +++ b/tools/llvm-as/llvm-as.cpp @@ -20,12 +20,12 @@ #include "llvm/Bytecode/Writer.h" #include "llvm/Analysis/Verifier.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include "llvm/Support/SystemUtils.h" #include "llvm/System/Signals.h" #include #include #include - using namespace llvm; static cl::opt @@ -60,27 +60,27 @@ int main(int argc, char **argv) { ParseError Err; std::auto_ptr M(ParseAssemblyFile(InputFilename,&Err)); if (M.get() == 0) { - std::cerr << argv[0] << ": " << Err.getMessage() << "\n"; + llvm_cerr << argv[0] << ": " << Err.getMessage() << "\n"; return 1; } if (!DisableVerify) { std::string Err; if (verifyModule(*M.get(), ReturnStatusAction, &Err)) { - std::cerr << argv[0] + llvm_cerr << argv[0] << ": assembly parsed, but does not verify as correct!\n"; - std::cerr << Err; + llvm_cerr << Err; return 1; } } - if (DumpAsm) std::cerr << "Here's the assembly:\n" << *M.get(); + if (DumpAsm) llvm_cerr << "Here's the assembly:\n" << *M.get(); if (OutputFilename != "") { // Specified an output filename? if (OutputFilename != "-") { // Not stdout? if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - std::cerr << argv[0] << ": error opening '" << OutputFilename + llvm_cerr << argv[0] << ": error opening '" << OutputFilename << "': file exists!\n" << "Use -f command line argument to force output\n"; return 1; @@ -108,7 +108,7 @@ int main(int argc, char **argv) { if (!Force && std::ifstream(OutputFilename.c_str())) { // If force is not specified, make sure not to overwrite a file! - std::cerr << argv[0] << ": error opening '" << OutputFilename + llvm_cerr << argv[0] << ": error opening '" << OutputFilename << "': file exists!\n" << "Use -f command line argument to force output\n"; return 1; @@ -123,18 +123,19 @@ int main(int argc, char **argv) { } if (!Out->good()) { - std::cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; + llvm_cerr << argv[0] << ": error opening " << OutputFilename << "!\n"; return 1; } if (Force || !CheckBytecodeOutputToConsole(Out,true)) { - WriteBytecodeToFile(M.get(), *Out, !NoCompress); + llvm_ostream L(*Out); + WriteBytecodeToFile(M.get(), L, !NoCompress); } } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; exitCode = 1; } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; exitCode = 1; } -- cgit v1.2.3