Index: llvm/tools/llvm-reduce/deltas/Delta.cpp =================================================================== --- llvm/tools/llvm-reduce/deltas/Delta.cpp +++ llvm/tools/llvm-reduce/deltas/Delta.cpp @@ -81,13 +81,17 @@ if (TmpFilesAsBitcode) { llvm::raw_fd_ostream OutStream(FD, true); - writeBitcode(M, OutStream); - OutStream.close(); + if (OutStream.has_error()) { - errs() << "Error emitting bitcode to file '" << CurrentFilepath << "'!\n"; + errs() << "Error emitting bitcode to file '" << CurrentFilepath + << "': " << OutStream.error().message(); sys::fs::remove(CurrentFilepath); exit(1); } + + writeBitcode(M, OutStream); + OutStream.close(); + bool Res = Test.run(CurrentFilepath); sys::fs::remove(CurrentFilepath); return Res; @@ -96,7 +100,8 @@ M.print(Out.os(), /*AnnotationWriter=*/nullptr); Out.os().close(); if (Out.os().has_error()) { - errs() << "Error emitting bitcode to file '" << CurrentFilepath << "'!\n"; + errs() << "Error emitting bitcode to file '" << CurrentFilepath + << "': " << Out.os().error().message(); exit(1); }