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-prof | |
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-prof')
-rw-r--r-- | tools/llvm-prof/llvm-prof.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index 106eed8c3f4..f88f1fcc028 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -118,13 +118,11 @@ int main(int argc, char **argv) { // Read in the bytecode file... std::string ErrorMessage; Module *M; - MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(&BytecodeFile[0], - BytecodeFile.size()); - if (Buffer == 0) - ErrorMessage = "Error reading file '" + BytecodeFile + "'"; - else + if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(BytecodeFile, + &ErrorMessage)) { M = ParseBitcodeFile(Buffer, &ErrorMessage); - delete Buffer; + delete Buffer; + } if (M == 0) { std::cerr << argv[0] << ": " << BytecodeFile << ": " << ErrorMessage << "\n"; |