commit 8fbfac9193560fbc819d8f14a18c8058208d42c3
parent 25e38be3efeeb9ce737c468665c15c7cc9353201
Author: Kyle Milz <kyle@0x30.net>
Date: Tue, 2 Aug 2016 20:34:51 -0600
src: print error when source can't be rewritten
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/inst_action.cc b/src/inst_action.cc
@@ -73,6 +73,11 @@ InstrumentAction::EndSourceFileAction()
std::error_code ec;
llvm::raw_fd_ostream output(file_name, ec, llvm::sys::fs::F_None);
+ if (ec.value()) {
+ warnx("'%s': %s", file_name.c_str(), ec.message().c_str());
+ return;
+ }
+
// Write the instrumented source file
m_TheRewriter.getEditBuffer(main_fid).write(output);
}