@@ -81,17 +81,15 @@ bool compilet::doit()
81
81
add_compiler_specific_defines (config);
82
82
83
83
// Parse command line for source and object file names
84
- for (std:: size_t i = 0 ; i < cmdline.args . size (); i++ )
85
- if (add_input_file (cmdline. args [i] ))
84
+ for (const auto &arg : cmdline.args )
85
+ if (add_input_file (arg ))
86
86
return true ;
87
87
88
- for (std::list<std::string>::const_iterator it = libraries.begin ();
89
- it!=libraries.end ();
90
- it++)
88
+ for (const auto &library : libraries)
91
89
{
92
- if (!find_library (*it ))
90
+ if (!find_library (library ))
93
91
// GCC is going to complain if this doesn't exist
94
- debug () << " Library not found: " << *it << " (ignoring)" << eom;
92
+ debug () << " Library not found: " << library << " (ignoring)" << eom;
95
93
}
96
94
97
95
statistics () << " No. of source files: " << source_files.size () << eom;
@@ -308,15 +306,12 @@ bool compilet::find_library(const std::string &name)
308
306
{
309
307
std::string tmp;
310
308
311
- for (std::list<std::string>::const_iterator
312
- it=library_paths.begin ();
313
- it!=library_paths.end ();
314
- it++)
309
+ for (const auto &library_path : library_paths)
315
310
{
316
311
#ifdef _WIN32
317
- tmp = *it + " \\ lib" ;
312
+ tmp = library_path + " \\ lib" ;
318
313
#else
319
- tmp = *it + " /lib" ;
314
+ tmp = library_path + " /lib" ;
320
315
#endif
321
316
322
317
std::ifstream in (tmp+name+" .a" );
@@ -674,21 +669,16 @@ compilet::~compilet()
674
669
{
675
670
// clean up temp dirs
676
671
677
- for (std::list<std::string>::const_iterator it = tmp_dirs.begin ();
678
- it!=tmp_dirs.end ();
679
- it++)
680
- delete_directory (*it);
672
+ for (const auto &dir : tmp_dirs)
673
+ delete_directory (dir);
681
674
}
682
675
683
676
unsigned compilet::function_body_count (const goto_functionst &functions) const
684
677
{
685
678
int fbs=0 ;
686
679
687
- for (goto_functionst::function_mapt::const_iterator it=
688
- functions.function_map .begin ();
689
- it != functions.function_map .end ();
690
- it++)
691
- if (it->second .body_available ())
680
+ for (const auto &f : functions.function_map )
681
+ if (f.second .body_available ())
692
682
fbs++;
693
683
694
684
return fbs;
@@ -719,14 +709,11 @@ void compilet::convert_symbols(goto_functionst &dest)
719
709
symbols.insert (named_symbol.first );
720
710
721
711
// the symbol table iterators aren't stable
722
- for (symbols_sett::const_iterator
723
- it=symbols.begin ();
724
- it!=symbols.end ();
725
- ++it)
712
+ for (const auto &symbol : symbols)
726
713
{
727
- symbol_tablet::symbolst::const_iterator s_it=
728
- symbol_table.symbols .find (*it );
729
- assert (s_it!= symbol_table.symbols .end ());
714
+ symbol_tablet::symbolst::const_iterator s_it =
715
+ symbol_table.symbols .find (symbol );
716
+ CHECK_RETURN (s_it != symbol_table.symbols .end ());
730
717
731
718
if (s_it->second .type .id ()==ID_code &&
732
719
!s_it->second .is_macro &&
@@ -736,7 +723,7 @@ void compilet::convert_symbols(goto_functionst &dest)
736
723
{
737
724
debug () << " Compiling " << s_it->first << eom;
738
725
converter.convert_function (s_it->first , dest.function_map [s_it->first ]);
739
- symbol_table.get_writeable_ref (*it ).value = exprt (" compiled" );
726
+ symbol_table.get_writeable_ref (symbol ).value = exprt (" compiled" );
740
727
}
741
728
}
742
729
}
0 commit comments