[llvm] r247873 - Check for errors after reading a sample profile in llvm-profdata.

Diego Novillo via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 17:17:22 PDT 2015


Author: dnovillo
Date: Wed Sep 16 19:17:21 2015
New Revision: 247873

URL: http://llvm.org/viewvc/llvm-project?rev=247873&view=rev
Log:
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.

Modified:
    llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp

Modified: llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp?rev=247873&r1=247872&r2=247873&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp (original)
+++ llvm/trunk/tools/llvm-profdata/llvm-profdata.cpp Wed Sep 16 19:17:21 2015
@@ -195,7 +195,9 @@ static int showSampleProfile(std::string
     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




More information about the llvm-commits mailing list