From 1e5eaadbbdf3c1ddf0b2c425e1027e60a3b1b4a7 Mon Sep 17 00:00:00 2001 From: Diego Novillo Date: Thu, 17 Sep 2015 00:17:21 +0000 Subject: [PATCH] Check for errors after reading a sample profile in llvm-profdata. After reading the profile, check if the reader returned any errors before showing the profile. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247873 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-profdata/llvm-profdata.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/llvm-profdata/llvm-profdata.cpp b/tools/llvm-profdata/llvm-profdata.cpp index 6fb48d8fad5..23fa7b40f50 100644 --- a/tools/llvm-profdata/llvm-profdata.cpp +++ b/tools/llvm-profdata/llvm-profdata.cpp @@ -195,7 +195,9 @@ static int showSampleProfile(std::string Filename, bool ShowCounts, exitWithError(EC.message(), Filename); auto Reader = std::move(ReaderOrErr.get()); - Reader->read(); + if (std::error_code EC = Reader->read()) + exitWithError(EC.message(), Filename); + if (ShowAllFunctions || ShowFunction.empty()) Reader->dump(OS); else -- 2.11.0