diff --git a/divine/rt/dios-cc.cpp b/divine/rt/dios-cc.cpp index 7aa91ef1d377f607f199491cee2f3eb6e311c404..5a32729b0f09c6362616a94f8e398bc090df52be 100644 --- a/divine/rt/dios-cc.cpp +++ b/divine/rt/dios-cc.cpp @@ -59,6 +59,13 @@ void DiosCC::build( ParsedOpts po ) linkLibs( defaultDIVINELibs ); } +NativeDiosCC::NativeDiosCC( const std::vector< std::string >& opts ) + : Native( opts ) +{ + rt::add_dios_header_paths( _po.opts ); + divine::rt::each( [&]( auto path, auto c ) { _clang.mapVirtualFile( path, c ); } ); +} + auto NativeDiosCC::link_dios_native( bool cxx ) { using namespace brick::fs; diff --git a/divine/rt/dios-cc.hpp b/divine/rt/dios-cc.hpp index f5307fa145cb6217e6490649de9739f00b495c14..05618b481d676a7866fad2ce491be1e41041cb17 100644 --- a/divine/rt/dios-cc.hpp +++ b/divine/rt/dios-cc.hpp @@ -34,6 +34,8 @@ void add_dios_header_paths( std::vector< std::string >& paths ); struct NativeDiosCC : cc::Native { + NativeDiosCC( const std::vector< std::string >& opts ); + auto link_dios_native( bool cxx ); std::unique_ptr< llvm::Module > link_bitcode() override; void link(); diff --git a/tools/divcc.cpp b/tools/divcc.cpp index 43e505e05da408dea922a506d17680d87f9b1287..1eb43ef0095f9488135fa7345c4fd86b4142ae50 100644 --- a/tools/divcc.cpp +++ b/tools/divcc.cpp @@ -47,21 +47,14 @@ using FileType = cc::FileType; int main( int argc, char **argv ) { try { - rt::NativeDiosCC nativeCC; + rt::NativeDiosCC nativeCC( { argv + 1, argv + argc } ); cc::CC1& clang = nativeCC._clang; - divine::rt::each( [&]( auto path, auto c ) { clang.mapVirtualFile( path, c ); } ); - - std::vector< std::string > opts; - std::copy( argv + 1, argv + argc, std::back_inserter( opts ) ); - nativeCC._po = cc::parseOpts( opts ); auto& po = nativeCC._po; auto& pairedFiles = nativeCC._files; using namespace brick::fs; - rt::add_dios_header_paths( po.opts ); - // count files, i.e. not libraries auto num_files = std::count_if( po.files.begin(), po.files.end(), []( cc::FileEntry f ){ return f.is< cc::File >(); } );