X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fanalyzer.cpp;h=4cebafad175ae6d7cc3a1a2459ffbba4c4d1709e;hb=7c2db9e2b91da953701be233336c5bfa1f3c4af0;hp=2c9cf058d7a565d3849acca028e150d878f4e85c;hpb=55269a63b0875be0b172453714f9190d30fb1dff;p=builder.git diff --git a/source/analyzer.cpp b/source/analyzer.cpp index 2c9cf05..4cebafa 100644 --- a/source/analyzer.cpp +++ b/source/analyzer.cpp @@ -24,15 +24,12 @@ void Analyzer::analyze() if(mode==RDEPS) { rdepends.clear(); - const BuildGraph::TargetMap &targets = builder.get_build_graph().get_targets(); - for(BuildGraph::TargetMap::const_iterator i=targets.begin(); i!=targets.end(); ++i) + for(const auto &kvp: builder.get_build_graph().get_targets()) { - const Target::Dependencies &depends = i->second->get_dependencies(); - for(Target::Dependencies::const_iterator j=depends.begin(); j!=depends.end(); ++j) - rdepends[*j].insert(i->second); - const Target::Dependencies &tdepends = i->second->get_transitive_dependencies(); - for(Target::Dependencies::const_iterator j=tdepends.begin(); j!=tdepends.end(); ++j) - rdepends[*j].insert(i->second); + for(Target *d: kvp.second->get_dependencies()) + rdepends[d].insert(kvp.second); + for(Target *d: kvp.second->get_transitive_dependencies()) + rdepends[d].insert(kvp.second); } } @@ -49,9 +46,8 @@ void Analyzer::analyze() Target &goals = builder.get_build_graph().get_goals(); if(mode==RDEPS) { - const Target::Dependencies &deps = goals.get_dependencies(); - for(Target::Dependencies::const_iterator i=deps.begin(); i!=deps.end(); ++i) - build_depend_table(**i, 0); + for(Target *d: goals.get_dependencies()) + build_depend_table(*d, 0); } else build_depend_table(goals, 0); @@ -120,8 +116,8 @@ void Analyzer::build_depend_table(Target &tgt, unsigned depth) depends.sort(full_paths ? target_order_full : target_order); - for(Target::Dependencies::const_iterator i=depends.begin(); i!=depends.end(); ++i) - build_depend_table(**i, depth+1); + for(Target *d: depends) + build_depend_table(*d, depth+1); } } @@ -130,22 +126,22 @@ void Analyzer::print_table() const vector col_width; // Determine column widths - for(Table::const_iterator i=table.begin(); i!=table.end(); ++i) + for(const vector &r: table) { - if(col_width.size()size()) - col_width.resize(i->size(), 0); - for(unsigned j=0; jsize(); ++j) - col_width[j] = max(col_width[j], (*i)[j].size()); + if(col_width.size() &r: table) { string line; - for(unsigned j=0; jsize(); ++j) + for(unsigned j=0; j0) line += " "; - line += lexical_cast((*i)[j], Fmt("%-s").width(col_width[j])); + line += lexical_cast(r[j], Fmt("%-s").width(col_width[j])); } IO::print("%s\n", line); }