diff options
author | Bill Wendling <isanbard@gmail.com> | 2006-11-29 00:19:40 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2006-11-29 00:19:40 +0000 |
commit | 68fe61d6a165ea6090008e281330895a21607daf (patch) | |
tree | 2e0cc1cbd16099aed908dbb3ecda16cf57d04300 /tools/llvm-as/llvm-as.cpp | |
parent | a5b31ca85686062408bca0f0a8aa43f9fe58e644 (diff) |
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
Diffstat (limited to 'tools/llvm-as/llvm-as.cpp')
-rw-r--r-- | tools/llvm-as/llvm-as.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
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 <fstream> #include <iostream> #include <memory> - using namespace llvm; static cl::opt<std::string> @@ -60,27 +60,27 @@ int main(int argc, char **argv) { ParseError Err; std::auto_ptr<Module> 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; } |