diff options
author | Jush Lu <jush.msn@gmail.com> | 2011-03-09 19:39:16 +0800 |
---|---|---|
committer | Jush Lu <jush.msn@gmail.com> | 2011-03-09 19:39:16 +0800 |
commit | b5530586d68bd25831a6796b5d3199cb0769a35c (patch) | |
tree | fac4a03b53b6a64b0c00f433e4d8b3c9f2bc67cd /tools/llvm-prof/llvm-prof.cpp | |
parent | b4e17c5bf4361bbdeced39aa071150d7fa9c3c10 (diff) | |
parent | d01f50f42ce60207ed6d27fb1778e456d83be06c (diff) | |
download | external_llvm-b5530586d68bd25831a6796b5d3199cb0769a35c.zip external_llvm-b5530586d68bd25831a6796b5d3199cb0769a35c.tar.gz external_llvm-b5530586d68bd25831a6796b5d3199cb0769a35c.tar.bz2 |
Merge upstream r127116
Diffstat (limited to 'tools/llvm-prof/llvm-prof.cpp')
-rw-r--r-- | tools/llvm-prof/llvm-prof.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp index 1c63d97..9d0b468 100644 --- a/tools/llvm-prof/llvm-prof.cpp +++ b/tools/llvm-prof/llvm-prof.cpp @@ -29,7 +29,8 @@ #include "llvm/Support/PrettyStackTrace.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/Format.h" -#include "llvm/System/Signals.h" +#include "llvm/Support/Signals.h" +#include "llvm/Support/system_error.h" #include <algorithm> #include <iomanip> #include <map> @@ -263,12 +264,13 @@ int main(int argc, char **argv) { // Read in the bitcode file... std::string ErrorMessage; + OwningPtr<MemoryBuffer> Buffer; + error_code ec; Module *M = 0; - if (MemoryBuffer *Buffer = MemoryBuffer::getFileOrSTDIN(BitcodeFile, - &ErrorMessage)) { - M = ParseBitcodeFile(Buffer, Context, &ErrorMessage); - delete Buffer; - } + if (!(ec = MemoryBuffer::getFileOrSTDIN(BitcodeFile, Buffer))) { + M = ParseBitcodeFile(Buffer.get(), Context, &ErrorMessage); + } else + ErrorMessage = ec.message(); if (M == 0) { errs() << argv[0] << ": " << BitcodeFile << ": " << ErrorMessage << "\n"; |