citrun

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

commit 512846331e774634fc3de8dc2babfc541f0c3574
parent d2f8ad54307a1b3068bde28dbee4afdc9252af87
Author: Kyle Milz <kyle@0x30.net>
Date:   Mon,  9 Oct 2017 22:13:17 -0600

bin: some minor improvements

- deduplicate error message
- add concrete destructor (avoids warnings)
- use dir_sep() instead of hardcoding a value

Diffstat:
Mbin/inst_fe.cc | 17+++++++++++++----
Mbin/inst_fe.h | 3++-
2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/bin/inst_fe.cc b/bin/inst_fe.cc @@ -39,6 +39,10 @@ InstFrontend::InstFrontend(int argc, char *argv[], bool is_citrun_inst) : { } +InstFrontend::~InstFrontend() +{ +} + void InstFrontend::log_identity() { @@ -52,7 +56,9 @@ InstFrontend::get_paths() { m_compilers_path = PREFIX ; m_compilers_path += dir_sep() ; - m_compilers_path += "share/citrun" ; + m_compilers_path += "share" ; + m_compilers_path += dir_sep() ; + m_compilers_path += "citrun" ; m_lib_path = PREFIX ; m_lib_path += dir_sep(); @@ -109,8 +115,11 @@ InstFrontend::clean_PATH() // // Error visibly so this can be fixed as soon as possible. // - std::cerr << "Error: '" << m_compilers_path << "' not in PATH." << std::endl; - m_log << "Error: '" << m_compilers_path << "' not in PATH." << std::endl; + std::stringstream err; + err << "Error: '" << m_compilers_path << "' not in PATH."; + + std::cerr << err.str() << std::endl; + m_log << err.str() << std::endl; exit(1); } @@ -118,7 +127,7 @@ InstFrontend::clean_PATH() } // -// Guess if the argument is a sourcefile. If it is stash a backup of the file +// Guess if the argument is a source file. If it is stash a backup of the file // and sync the timestamps. // void diff --git a/bin/inst_fe.h b/bin/inst_fe.h @@ -36,7 +36,8 @@ protected: InstrumentLogger m_log; public: - InstFrontend(int, char *argv[], bool); + InstFrontend(int, char *argv[], bool); + virtual ~InstFrontend() = 0; void log_identity(); void get_paths();