diff --git a/divine/cc/native.cpp b/divine/cc/native.cpp index f8a715f6f849bff0335800c643b5d710410e306d..fa5c252ec4ceae8fcaacad35bd49934a87e81204 100644 --- a/divine/cc/native.cpp +++ b/divine/cc/native.cpp @@ -176,6 +176,14 @@ namespace divine::cc } } + void Native::print_info( std::string_view version ) + { + if ( _po.hasVersion ) + std::cout << "divine version: " << version << "\n"; + cc::ClangDriver drv; + delete drv.BuildCompilation( { "divcc", _po.hasHelp ? "--help" : "--version" } ); + } + Native::~Native() { if ( !_po.toObjectOnly ) diff --git a/divine/cc/native.hpp b/divine/cc/native.hpp index b23db6337b430f99554c8d06043040b89548eb6b..34a7e62f02b9abd19309a6c537c37681e8a5446d 100644 --- a/divine/cc/native.hpp +++ b/divine/cc/native.hpp @@ -41,6 +41,7 @@ namespace divine::cc int run(); virtual std::unique_ptr< llvm::Module > link_bitcode(); void construct_paired_files(); + void print_info( std::string_view version ); cc::ParsedOpts _po; PairedFiles _files; diff --git a/tools/divcc.cpp b/tools/divcc.cpp index 1de993148fad8cff3c1815647e650a7fdf1ee68b..a5ad97a88dd60f414e492f72aa236043501d8a37 100644 --- a/tools/divcc.cpp +++ b/tools/divcc.cpp @@ -36,10 +36,7 @@ int main( int argc, char **argv ) if ( po.hasHelp || po.hasVersion ) { - if ( po.hasVersion ) - std::cout << "divine version: " << ui::version() << "\n"; - cc::ClangDriver drv; - delete drv.BuildCompilation( { "divcc", po.hasHelp ? "--help" : "--version" } ); + nativeCC.print_info( ui::version() ); return 0; }