[PATCH] D48022: [llvm-exegesis] Fix unhandled error.

Guillaume Chatelet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 11 06:35:53 PDT 2018


gchatelet created this revision.
gchatelet added a reviewer: courbet.
Herald added subscribers: llvm-commits, tschuett.

Fixing an unhandled error when calling writeYaml.


Repository:
  rL LLVM

https://reviews.llvm.org/D48022

Files:
  tools/llvm-exegesis/lib/BenchmarkResult.h
  tools/llvm-exegesis/llvm-exegesis.cpp


Index: tools/llvm-exegesis/llvm-exegesis.cpp
===================================================================
--- tools/llvm-exegesis/llvm-exegesis.cpp
+++ tools/llvm-exegesis/llvm-exegesis.cpp
@@ -148,7 +148,7 @@
   std::vector<InstructionBenchmark> Results = ExitOnErr(Runner->run(
       GetOpcodeOrDie(State.getInstrInfo()), Filter, NumRepetitions));
   for (InstructionBenchmark &Result : Results)
-    Result.writeYaml(Context, BenchmarkFile);
+    ExitOnErr(Result.writeYaml(Context, BenchmarkFile));
 
   exegesis::pfm::pfmTerminate();
 }
Index: tools/llvm-exegesis/lib/BenchmarkResult.h
===================================================================
--- tools/llvm-exegesis/lib/BenchmarkResult.h
+++ tools/llvm-exegesis/lib/BenchmarkResult.h
@@ -20,6 +20,7 @@
 #include "llvm/ADT/StringRef.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCInstBuilder.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/YAMLTraits.h"
 #include <limits>
 #include <string>
@@ -58,20 +59,20 @@
   std::string Info;
 
   // Read functions.
-  static llvm::Expected<InstructionBenchmark>
+  LLVM_NODISCARD static llvm::Expected<InstructionBenchmark>
   readYaml(const BenchmarkResultContext &Context, llvm::StringRef Filename);
 
-  static llvm::Expected<std::vector<InstructionBenchmark>>
+  LLVM_NODISCARD static llvm::Expected<std::vector<InstructionBenchmark>>
   readYamls(const BenchmarkResultContext &Context, llvm::StringRef Filename);
 
   void readYamlFrom(const BenchmarkResultContext &Context,
                     llvm::StringRef InputContent);
 
   // Write functions, non-const because of YAML traits.
   void writeYamlTo(const BenchmarkResultContext &Context, llvm::raw_ostream &S);
 
-  llvm::Error writeYaml(const BenchmarkResultContext &Context,
-                        const llvm::StringRef Filename);
+  LLVM_NODISCARD llvm::Error writeYaml(const BenchmarkResultContext &Context,
+                                       const llvm::StringRef Filename);
 };
 
 //------------------------------------------------------------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48022.150737.patch
Type: text/x-patch
Size: 2074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180611/403eccbe/attachment.bin>


More information about the llvm-commits mailing list