diff options
author | Dan Gohman <gohman@apple.com> | 2009-09-03 16:00:08 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-09-03 16:00:08 +0000 |
commit | 99ed416787e73b7965d9c183f23f9d78f996187f (patch) | |
tree | 22bb4352a18800a96ce9322998e993ae82f7d240 /tools/opt/opt.cpp | |
parent | bccfc24c4e8092e1ee18746dd4cee01247728faa (diff) |
Use IRReader.h in opt, to support reading of LLVM Assembly files directly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80922 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/opt/opt.cpp')
-rw-r--r-- | tools/opt/opt.cpp | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/tools/opt/opt.cpp b/tools/opt/opt.cpp index d8bfd61c23..b1f5c0803a 100644 --- a/tools/opt/opt.cpp +++ b/tools/opt/opt.cpp @@ -26,6 +26,7 @@ #include "llvm/Target/TargetMachine.h" #include "llvm/Support/PassNameParser.h" #include "llvm/System/Signals.h" +#include "llvm/Support/IRReader.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/PluginLoader.h" @@ -342,22 +343,14 @@ int main(int argc, char **argv) { // FIXME: The choice of target should be controllable on the command line. std::auto_ptr<TargetMachine> target; - std::string ErrorMessage; + SMDiagnostic Err; // Load the input module... std::auto_ptr<Module> M; - if (MemoryBuffer *Buffer - = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) { - M.reset(ParseBitcodeFile(Buffer, Context, &ErrorMessage)); - delete Buffer; - } + M.reset(ParseIRFile(InputFilename, Err, Context)); if (M.get() == 0) { - errs() << argv[0] << ": "; - if (ErrorMessage.size()) - errs() << ErrorMessage << "\n"; - else - errs() << "bitcode didn't read correctly.\n"; + Err.Print(argv[0], errs()); return 1; } |