aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-prof/llvm-prof.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-prof/llvm-prof.cpp')
-rw-r--r--tools/llvm-prof/llvm-prof.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/llvm-prof/llvm-prof.cpp b/tools/llvm-prof/llvm-prof.cpp
index aa9cf004c7..9d0b46833b 100644
--- a/tools/llvm-prof/llvm-prof.cpp
+++ b/tools/llvm-prof/llvm-prof.cpp
@@ -264,11 +264,11 @@ 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, ec)) {
- 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) {