Changes in src/CodeTools/DeclStats.cc [6215a5c:fa2de95]
- File:
-
- 1 edited
-
src/CodeTools/DeclStats.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeTools/DeclStats.cc
r6215a5c rfa2de95 22 22 23 23 #include "Common/VectorMap.h" 24 #include "GenPoly/GenPoly.h"25 24 #include "Parser/LinkageSpec.h" 26 25 #include "SynTree/Declaration.h" … … 40 39 /// Count of declarations with each number of return types 41 40 VectorMap<unsigned> by_returns; 42 /// Count of declarations with each number of polymorphic parameters43 VectorMap<unsigned> n_poly_params;44 /// Count of declarations with each number of polymorphic return types45 VectorMap<unsigned> n_poly_returns;46 41 47 Stats() : n_decls(0), mono_decls(0), poly_decls(0), by_name() , by_params(), by_returns(), n_poly_params(), n_poly_returns(){}42 Stats() : n_decls(0), mono_decls(0), poly_decls(0), by_name() {} 48 43 49 44 Stats& operator+= (const Stats& o) { … … 64 59 for ( unsigned i = 0; i < o.by_returns.size(); ++i ) { 65 60 by_returns[i] += o.by_returns[i]; 66 }67 68 n_poly_params.reserve( o.n_poly_params.size() );69 for ( unsigned i = 0; i < o.n_poly_params.size(); ++i ) {70 n_poly_params[i] += o.n_poly_params[i];71 }72 73 n_poly_returns.reserve( o.n_poly_returns.size() );74 for ( unsigned i = 0; i < o.n_poly_returns.size(); ++i ) {75 n_poly_returns[i] += o.n_poly_returns[i];76 61 } 77 62 … … 101 86 102 87 unsigned n_params = 0; 103 unsigned n_poly_params = 0; 104 for ( auto pdecl : fnTy->get_parameters() ) { 105 n_params += pdecl->get_type()->size(); 106 if ( GenPoly::hasPolyBase( pdecl->get_type() ) ) ++n_poly_params; 107 } 88 for ( auto pdecl : fnTy->get_parameters() ) { n_params += pdecl->get_type()->size(); } 108 89 ++stats.by_params.at( n_params ); 109 ++stats.n_poly_params.at( n_poly_params );110 90 111 91 unsigned n_returns = 0; 112 unsigned n_poly_returns = 0; 113 for ( auto rdecl : fnTy->get_returnVals() ) { 114 n_returns += rdecl->get_type()->size(); 115 if ( GenPoly::hasPolyBase( rdecl->get_type() ) ) ++n_poly_returns; 116 } 92 for ( auto rdecl : fnTy->get_returnVals() ) { n_returns += rdecl->get_type()->size(); } 117 93 ++stats.by_returns.at( n_returns ); 118 ++stats.n_poly_returns.at( n_poly_returns );119 94 } 120 95 … … 181 156 182 157 printAllHisto("overloads", [](const Stats& stats) { return stats.by_name; }); 183 printAllMap("n_poly_params", [](const Stats& stats) { return stats.n_poly_params; });184 158 printAllMap("n_params", [](const Stats& stats) { return stats.by_params; }); 185 printAllMap("n_poly_returns", [](const Stats& stats) { return stats.n_poly_returns; });186 159 printAllMap("n_returns", [](const Stats& stats) { return stats.by_returns; }); 187 160 }
Note:
See TracChangeset
for help on using the changeset viewer.