Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeTools/DeclStats.cc

    r6215a5c rfa2de95  
    2222
    2323#include "Common/VectorMap.h"
    24 #include "GenPoly/GenPoly.h"
    2524#include "Parser/LinkageSpec.h"
    2625#include "SynTree/Declaration.h"
     
    4039                        /// Count of declarations with each number of return types
    4140                        VectorMap<unsigned> by_returns;
    42                         /// Count of declarations with each number of polymorphic parameters
    43                         VectorMap<unsigned> n_poly_params;
    44                         /// Count of declarations with each number of polymorphic return types
    45                         VectorMap<unsigned> n_poly_returns;
    4641
    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() {}
    4843
    4944                        Stats& operator+= (const Stats& o) {
     
    6459                                for ( unsigned i = 0; i < o.by_returns.size(); ++i ) {
    6560                                        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];
    7661                                }
    7762
     
    10186
    10287                        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(); }
    10889                        ++stats.by_params.at( n_params );
    109                         ++stats.n_poly_params.at( n_poly_params );
    11090
    11191                        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(); }
    11793                        ++stats.by_returns.at( n_returns );
    118                         ++stats.n_poly_returns.at( n_poly_returns );
    11994                }
    12095
     
    181156
    182157                        printAllHisto("overloads", [](const Stats& stats) { return stats.by_name; });
    183                         printAllMap("n_poly_params", [](const Stats& stats) { return stats.n_poly_params; });
    184158                        printAllMap("n_params", [](const Stats& stats) { return stats.by_params; });
    185                         printAllMap("n_poly_returns", [](const Stats& stats) { return stats.n_poly_returns; });
    186159                        printAllMap("n_returns", [](const Stats& stats) { return stats.by_returns; });
    187160                }
Note: See TracChangeset for help on using the changeset viewer.