Ignore:
Timestamp:
Jul 11, 2017, 3:06:40 PM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
fcab269
Parents:
fab6ded
Message:

Cleaned-up some headers using a tool called 'include-what-you-use'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeTools/DeclStats.cc

    rfab6ded rbf2438c  
    1616#include "DeclStats.h"
    1717
    18 #include <iostream>
    19 #include <map>
    20 #include <sstream>
    21 #include <string>
    22 #include <unordered_map>
    23 #include <unordered_set>
    24 
    25 #include "Common/VectorMap.h"
    26 #include "GenPoly/GenPoly.h"
    27 #include "Parser/LinkageSpec.h"
    28 #include "SynTree/Declaration.h"
    29 #include "SynTree/Visitor.h"
     18#include <iostream>                // for operator<<, basic_ostream, cout
     19#include <map>                     // for map
     20#include <string>                  // for string, operator+, operator<<, cha...
     21#include <unordered_map>           // for unordered_map
     22#include <unordered_set>           // for unordered_set
     23#include <utility>                 // for pair, make_pair
     24
     25#include "Common/SemanticError.h"  // for SemanticError
     26#include "Common/VectorMap.h"      // for VectorMap
     27#include "GenPoly/GenPoly.h"       // for hasPolyBase
     28#include "Parser/LinkageSpec.h"    // for ::NoOfSpecs, Spec
     29#include "SynTree/Declaration.h"   // for FunctionDecl, TypeDecl, Declaration
     30#include "SynTree/Expression.h"    // for UntypedExpr, Expression
     31#include "SynTree/Statement.h"     // for CompoundStmt
     32#include "SynTree/Type.h"          // for Type, FunctionType, PointerType
     33#include "SynTree/Visitor.h"       // for maybeAccept, Visitor, acceptAll
    3034
    3135namespace CodeTools {
    32        
     36
    3337        class DeclStats : public Visitor {
    3438                template<typename T>
     
    7579                                sum(n_types, o.n_types);
    7680                                sum(p_new, o.p_new);
    77                                
     81
    7882                                return *this;
    7983                        }
    8084                };
    81                
     85
    8286                struct Stats {
    8387                        unsigned n_decls;     ///< Total number of declarations
     
    98102                        /// Stats for the return list
    99103                        ArgPackStats returns;
    100                        
     104
    101105                        /// Count of declarations with each number of assertions
    102106                        std::map<unsigned, unsigned> n_assns;
     
    105109                        /// Stats for the assertions' return types
    106110                        ArgPackStats assn_returns;
    107                        
     111
    108112                        Stats() : n_decls(0), n_type_params(), by_name(), basic_type_names(), compound_type_names(), basic_type_decls(), compound_type_decls(), params(), returns(), n_assns(), assn_params(), assn_returns() {}
    109113
     
    122126                                sum( assn_params, o.assn_params );
    123127                                sum( assn_returns, o.assn_returns );
    124                                
     128
    125129                                return *this;
    126130                        }
     
    144148
    145149                                n += dt->size();
    146                                
     150
    147151                                std::stringstream ss;
    148152                                dt->print( ss );
     
    176180                        ++pstats.n_types.at( types.size() );
    177181                }
    178                
     182
    179183                void analyzeFunc( FunctionType* fnTy, Stats& stats, ArgPackStats& params, ArgPackStats& returns ) {
    180184                        std::unordered_set<std::string> seen;
     
    186190                        auto& args = expr->get_args();
    187191                        unsigned fanout = args.size();
    188                        
     192
    189193                        ++exprs_by_fanout_at_depth[ std::make_pair(depth, fanout) ];
    190194                        for ( Expression* arg : args ) {
     
    205209                                return;
    206210                        }
    207                        
     211
    208212                        Stats& stats = for_linkage[ decl->get_linkage() ];
    209213
     
    323327                }
    324328
    325                 void printPairMap( const std::string& name, 
     329                void printPairMap( const std::string& name,
    326330                                   const std::map<std::pair<unsigned, unsigned>, unsigned>& map ) {
    327331                        for ( const auto& entry : map ) {
    328332                                const auto& key = entry.first;
    329                                 std::cout << "\"" << name << "\"," << key.first << "," << key.second << "," 
     333                                std::cout << "\"" << name << "\"," << key.first << "," << key.second << ","
    330334                                          << entry.second << std::endl;
    331335                        }
    332336                }
    333                
     337
    334338        public:
    335339                void print() {
     
    366370                stats.print();
    367371        }
    368        
     372
    369373} // namespace CodeTools
    370374
Note: See TracChangeset for help on using the changeset viewer.