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 #include @@ -58,10 +59,10 @@ std::string Info; // Read functions. - static llvm::Expected + LLVM_NODISCARD static llvm::Expected readYaml(const BenchmarkResultContext &Context, llvm::StringRef Filename); - static llvm::Expected> + LLVM_NODISCARD static llvm::Expected> readYamls(const BenchmarkResultContext &Context, llvm::StringRef Filename); void readYamlFrom(const BenchmarkResultContext &Context, @@ -70,8 +71,8 @@ // 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); }; //------------------------------------------------------------------------------ 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 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(); }