citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit a2f703aaac577aa39bf9cf19fa8e70889f9de8da
parent f895e5d9251d317112336760476f1782e3deb6f4
Author: Kyle Milz <kyle@0x30.net>
Date:   Fri, 12 Aug 2016 21:09:45 -0600

src: deduplicate some warnings

Diffstat:
Msrc/inst_action.cc | 12++++--------
Msrc/inst_main.cc | 5++---
2 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/inst_action.cc b/src/inst_action.cc @@ -42,16 +42,14 @@ InstrumentAction::write_modified_src(clang::FileID const &fid) if (m_is_citruninst) { out_file += ".citrun"; - m_log << "Writing modified source to '" - << out_file << "'.\n"; + m_log << "Writing modified source to '" << out_file << "'.\n"; } std::error_code ec; llvm::raw_fd_ostream output(out_file, ec, llvm::sys::fs::F_None); if (ec.value()) { - m_log << "Error writing modified source: " - << ec.message() << "\n"; - warnx("'%s': %s", out_file.c_str(), ec.message().c_str()); + m_log << "Error writing modified source '" << out_file + << "': " << ec.message() << "\n"; return; } @@ -70,8 +68,6 @@ InstrumentAction::EndSourceFileAction() clang::SourceLocation end = sm.getLocForEndOfFile(main_fid); unsigned int num_lines = sm.getPresumedLineNumber(end); - std::string const file_name = getCurrentFile(); - // // Write instrumentation preamble. Includes: // - runtime header, @@ -88,7 +84,7 @@ InstrumentAction::EndSourceFileAction() << " _citrun,\n" << " " << num_lines << ",\n" << " \"" << m_compiler_file_name << "\",\n" - << " \"" << file_name << "\",\n"; + << " \"" << getCurrentFile().str() << "\",\n"; preamble << "};\n"; preamble << "__attribute__((constructor))\n" << "static void citrun_constructor() {\n" diff --git a/src/inst_main.cc b/src/inst_main.cc @@ -91,10 +91,9 @@ print_toolinfo(const char *argv0) << unsigned(citrun_minor) << " "; struct utsname utsname; - if (uname(&utsname) == -1) { - warn("uname"); + if (uname(&utsname) == -1) llog << "(Unknown OS)\n"; - } else { + else { llog << "(" << utsname.sysname << "-" << utsname.release << " "