Skip to content
Snippets Groups Projects
Commit 4d94c1c4 authored by Zuzana Baranová's avatar Zuzana Baranová
Browse files

CC: Factor out help and version printing into Native::print_info().

parent 0212e99e
No related branches found
No related tags found
No related merge requests found
...@@ -176,6 +176,14 @@ namespace divine::cc ...@@ -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() Native::~Native()
{ {
if ( !_po.toObjectOnly ) if ( !_po.toObjectOnly )
......
...@@ -41,6 +41,7 @@ namespace divine::cc ...@@ -41,6 +41,7 @@ namespace divine::cc
int run(); int run();
virtual std::unique_ptr< llvm::Module > link_bitcode(); virtual std::unique_ptr< llvm::Module > link_bitcode();
void construct_paired_files(); void construct_paired_files();
void print_info( std::string_view version );
cc::ParsedOpts _po; cc::ParsedOpts _po;
PairedFiles _files; PairedFiles _files;
......
...@@ -36,10 +36,7 @@ int main( int argc, char **argv ) ...@@ -36,10 +36,7 @@ int main( int argc, char **argv )
if ( po.hasHelp || po.hasVersion ) if ( po.hasHelp || po.hasVersion )
{ {
if ( po.hasVersion ) nativeCC.print_info( ui::version() );
std::cout << "divine version: " << ui::version() << "\n";
cc::ClangDriver drv;
delete drv.BuildCompilation( { "divcc", po.hasHelp ? "--help" : "--version" } );
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment