diff options
author | Chris Lattner <sabre@nondot.org> | 2007-05-06 23:45:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-05-06 23:45:49 +0000 |
commit | 065344dfd5a7b3502098810b981eb0077e5d81f3 (patch) | |
tree | 6521b00f224a62ade1e796532e30c6cba5d36633 /tools/llvm-link | |
parent | 5499da88331a31a9dcc24dc160f58b411fb0d34a (diff) |
use the new MemoryBuffer interfaces to simplify error reporting in clients.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36900 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-link')
-rw-r--r-- | tools/llvm-link/llvm-link.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp index b19213a6fa..28be3a97f3 100644 --- a/tools/llvm-link/llvm-link.cpp +++ b/tools/llvm-link/llvm-link.cpp @@ -58,13 +58,11 @@ static inline std::auto_ptr<Module> LoadFile(const std::string &FN) { Module* Result = 0; const std::string &FNStr = Filename.toString(); - MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&FNStr[0], - FNStr.size()); - if (Buffer == 0) - ErrorMessage = "Error reading file '" + FNStr + "'"; - else + if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(FNStr, + &ErrorMessage)) { Result = ParseBitcodeFile(Buffer, &ErrorMessage); - delete Buffer; + delete Buffer; + } if (Result) return std::auto_ptr<Module>(Result); // Load successful! if (Verbose) { |