From: Diego Novillo Date: Thu, 17 Sep 2015 00:17:21 +0000 (+0000) Subject: Check for errors after reading a sample profile in llvm-profdata. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1e5eaadbbdf3c1ddf0b2c425e1027e60a3b1b4a7;p=oota-llvm.git 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 --- 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