[llvm-commits] CVS: llvm/tools/opt/opt.cpp
Chris Lattner
sabre at nondot.org
Sun May 6 16:46:40 PDT 2007
Changes in directory llvm/tools/opt:
opt.cpp updated: 1.141 -> 1.142
---
Log message:
use the new MemoryBuffer interfaces to simplify error reporting in clients.
---
Diffs of the changes: (+4 -7)
opt.cpp | 11 ++++-------
1 files changed, 4 insertions(+), 7 deletions(-)
Index: llvm/tools/opt/opt.cpp
diff -u llvm/tools/opt/opt.cpp:1.141 llvm/tools/opt/opt.cpp:1.142
--- llvm/tools/opt/opt.cpp:1.141 Sun May 6 14:17:23 2007
+++ llvm/tools/opt/opt.cpp Sun May 6 18:45:49 2007
@@ -260,15 +260,12 @@
// Load the input module...
std::auto_ptr<Module> M;
- MemoryBuffer *Buffer
- = MemoryBuffer::getFileOrSTDIN(&InputFilename[0], InputFilename.size());
-
- if (Buffer == 0)
- ErrorMessage = "Error reading file '" + InputFilename + "'";
- else
+ if (MemoryBuffer *Buffer
+ = MemoryBuffer::getFileOrSTDIN(InputFilename, &ErrorMessage)) {
M.reset(ParseBitcodeFile(Buffer, &ErrorMessage));
+ delete Buffer;
+ }
- delete Buffer;
if (M.get() == 0) {
cerr << argv[0] << ": ";
if (ErrorMessage.size())
More information about the llvm-commits
mailing list