diff options
author | Bill Wendling <isanbard@gmail.com> | 2006-11-28 23:33:06 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2006-11-28 23:33:06 +0000 |
commit | a5b31ca85686062408bca0f0a8aa43f9fe58e644 (patch) | |
tree | b215aa75bcb0cf3b98f3c8910457ae6126010fd7 /tools/llvm-dis | |
parent | d96662360f49f9b94d0faa7ea8dba8582bc1b364 (diff) | |
download | external_llvm-a5b31ca85686062408bca0f0a8aa43f9fe58e644.zip external_llvm-a5b31ca85686062408bca0f0a8aa43f9fe58e644.tar.gz external_llvm-a5b31ca85686062408bca0f0a8aa43f9fe58e644.tar.bz2 |
Convert to using llvm streams instead of iostreams.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31989 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-dis')
-rw-r--r-- | tools/llvm-dis/llvm-dis.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/tools/llvm-dis/llvm-dis.cpp b/tools/llvm-dis/llvm-dis.cpp index df0737a..8c2b3fe 100644 --- a/tools/llvm-dis/llvm-dis.cpp +++ b/tools/llvm-dis/llvm-dis.cpp @@ -21,10 +21,11 @@ #include "llvm/Bytecode/Reader.h" #include "llvm/Assembly/PrintModulePass.h" #include "llvm/Support/CommandLine.h" +#include "llvm/Support/Streams.h" #include "llvm/System/Signals.h" +#include <iostream> #include <fstream> #include <memory> - using namespace llvm; static cl::opt<std::string> @@ -47,11 +48,11 @@ int main(int argc, char **argv) { std::auto_ptr<Module> M(ParseBytecodeFile(InputFilename, &ErrorMessage)); if (M.get() == 0) { - std::cerr << argv[0] << ": "; + llvm_cerr << argv[0] << ": "; if (ErrorMessage.size()) - std::cerr << ErrorMessage << "\n"; + llvm_cerr << ErrorMessage << "\n"; else - std::cerr << "bytecode didn't read correctly.\n"; + llvm_cerr << "bytecode didn't read correctly.\n"; return 1; } @@ -59,7 +60,7 @@ int main(int argc, char **argv) { 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! Sending to standard output.\n"; } else { Out = new std::ofstream(OutputFilename.c_str()); @@ -80,7 +81,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! Sending to standard output.\n"; } else { Out = new std::ofstream(OutputFilename.c_str()); @@ -93,14 +94,15 @@ int main(int argc, char **argv) { } if (!Out->good()) { - std::cerr << argv[0] << ": error opening " << OutputFilename + llvm_cerr << argv[0] << ": error opening " << OutputFilename << ": sending to stdout instead!\n"; Out = &std::cout; } // All that llvm-dis does is write the assembly to a file. PassManager Passes; - Passes.add(new PrintModulePass(Out)); + llvm_ostream L(*Out); + Passes.add(new PrintModulePass(&L)); Passes.run(*M.get()); if (Out != &std::cout) { @@ -109,9 +111,9 @@ int main(int argc, char **argv) { } return 0; } catch (const std::string& msg) { - std::cerr << argv[0] << ": " << msg << "\n"; + llvm_cerr << argv[0] << ": " << msg << "\n"; } catch (...) { - std::cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; + llvm_cerr << argv[0] << ": Unexpected unknown exception occurred.\n"; } return 1; } |