Changeset 0bd3faf


Ignore:
Timestamp:
Nov 13, 2023, 1:40:12 PM (22 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
6ea85b22
Parents:
25f2798
Message:

Removed forward declarations missed in the BaseSyntaxNode removal. Removed code and modified names to support two versions of the ast.

Location:
src
Files:
42 edited

Legend:

Unmodified
Added
Removed
  • src/AST/SymbolTable.cpp

    r25f2798 r0bd3faf  
    3939        static inline auto stats() {
    4040                using namespace Stats::Counters;
    41                 static auto group   = build<CounterGroup>("Indexers");
     41                static auto group   = build<CounterGroup>("Symbol Tables");
    4242                static struct {
    4343                        SimpleCounter * count;
  • src/AST/SymbolTable.hpp

    r25f2798 r0bd3faf  
    8888        using Ptr = std::shared_ptr<const SymbolTable>;
    8989
    90         Ptr prevScope;                 ///< Indexer for parent scope
     90        Ptr prevScope;                 ///< Symbol Table for parent scope
    9191        unsigned long scope;           ///< Scope index of this indexer
    9292        unsigned long repScope;        ///< Scope index of currently represented scope
  • src/CodeGen/CodeGeneratorNew.cpp

    r25f2798 r0bd3faf  
    2424namespace CodeGen {
    2525
    26 int CodeGenerator_new::tabsize = 4;
     26int CodeGenerator::tabsize = 4;
    2727
    2828// The kinds of statements that should be followed by whitespace.
     
    3535}
    3636
    37 void CodeGenerator_new::extension( ast::Expr const * expr ) {
     37void CodeGenerator::extension( ast::Expr const * expr ) {
    3838        if ( expr->extension ) output << "__extension__ ";
    3939}
    4040
    41 void CodeGenerator_new::extension( ast::Decl const * decl ) {
     41void CodeGenerator::extension( ast::Decl const * decl ) {
    4242        if ( decl->extension ) output << "__extension__ ";
    4343}
    4444
    45 void CodeGenerator_new::asmName( ast::DeclWithType const * decl ) {
     45void CodeGenerator::asmName( ast::DeclWithType const * decl ) {
    4646        if ( auto asmName = decl->asmName.as<ast::ConstantExpr>() ) {
    4747                output << " asm ( " << asmName->rep << " )";
     
    4949}
    5050
    51 CodeGenerator_new::LabelPrinter & CodeGenerator_new::LabelPrinter::operator()(
     51CodeGenerator::LabelPrinter & CodeGenerator::LabelPrinter::operator()(
    5252                std::vector<ast::Label> const & l ) {
    5353        labels = &l;
     
    5555}
    5656
    57 std::ostream & CodeGenerator_new::LabelPrinter::operator()( std::ostream & output ) const {
     57std::ostream & CodeGenerator::LabelPrinter::operator()( std::ostream & output ) const {
    5858        const std::vector<ast::Label> & labels = *this->labels;
    5959        for ( const ast::Label & label : labels ) {
     
    6666// Using updateLocation at the beginning of a node and endl within a node
    6767// should become the method of formating.
    68 void CodeGenerator_new::updateLocation( CodeLocation const & to ) {
     68void CodeGenerator::updateLocation( CodeLocation const & to ) {
    6969        // Skip if linemarks shouldn't appear or if location is unset.
    7070        if ( !options.lineMarks || to.isUnset() ) return;
     
    8686}
    8787
    88 void CodeGenerator_new::updateLocation( ast::ParseNode const * to ) {
     88void CodeGenerator::updateLocation( ast::ParseNode const * to ) {
    8989        updateLocation( to->location );
    9090}
    9191
    92 std::ostream & CodeGenerator_new::LineEnder::operator()( std::ostream & os ) const {
     92std::ostream & CodeGenerator::LineEnder::operator()( std::ostream & os ) const {
    9393        os << "\n" << std::flush;
    9494        cg.currentLocation.first_line++;
     
    9696}
    9797
    98 CodeGenerator_new::CodeGenerator_new( std::ostream & os, const Options & options ) :
    99                 indent( 0, CodeGenerator_new::tabsize ), output( os ),
     98CodeGenerator::CodeGenerator( std::ostream & os, const Options & options ) :
     99                indent( 0, CodeGenerator::tabsize ), output( os ),
    100100                options( options ), printLabels( *this ), endl( *this )
    101101{}
    102102
    103 std::string CodeGenerator_new::mangleName( ast::DeclWithType const * decl ) {
     103std::string CodeGenerator::mangleName( ast::DeclWithType const * decl ) {
    104104        // GCC builtins should always be printed unmangled.
    105105        if ( options.pretty || decl->linkage.is_gcc_builtin ) {
     
    112112}
    113113
    114 void CodeGenerator_new::genAttributes(
     114void CodeGenerator::genAttributes(
    115115                const std::vector<ast::ptr<ast::Attribute>> & attributes ) {
    116116        if ( attributes.empty() ) return;
     
    129129}
    130130
    131 void CodeGenerator_new::previsit( ast::Node const * ) {
     131void CodeGenerator::previsit( ast::Node const * ) {
    132132        // All traversal is manual.
    133133        // TODO: Which means the ast::Pass is just providing a default no visit?
     
    135135}
    136136
    137 void CodeGenerator_new::previsit( ast::ParseNode const * node ) {
     137void CodeGenerator::previsit( ast::ParseNode const * node ) {
    138138        previsit( (ast::Node const *)node );
    139139        updateLocation( node );
    140140}
    141141
    142 void CodeGenerator_new::postvisit( ast::Node const * node ) {
     142void CodeGenerator::postvisit( ast::Node const * node ) {
    143143        std::stringstream ss;
    144144        ast::print( ss, node );
     
    146146}
    147147
    148 void CodeGenerator_new::previsit( ast::Expr const * expr ) {
     148void CodeGenerator::previsit( ast::Expr const * expr ) {
    149149        previsit( (ast::ParseNode const *)expr );
    150150        GuardAction( [this, expr](){
     
    155155}
    156156
    157 void CodeGenerator_new::postvisit( ast::FunctionDecl const * decl ) {
     157void CodeGenerator::postvisit( ast::FunctionDecl const * decl ) {
    158158        // Deleted decls should never be used, so don't print them in C.
    159159        if ( decl->isDeleted && options.genC ) return;
     
    168168
    169169        std::ostringstream acc;
    170         ast::Pass<CodeGenerator_new> subCG( acc, subOptions );
     170        ast::Pass<CodeGenerator> subCG( acc, subOptions );
    171171        // Add the forall clause.
    172172        // TODO: These probably should be removed by now and the assert used.
     
    213213}
    214214
    215 //void CodeGenerator_new::postvisit( ast::ObjectDecl const * decl_ ) {
    216 ast::ObjectDecl const * CodeGenerator_new::postvisit(
     215ast::ObjectDecl const * CodeGenerator::postvisit(
    217216                ast::ObjectDecl const * decl ) {
    218217        // Deleted decls should never be used, so don't print them in C.
     
    262261}
    263262
    264 void CodeGenerator_new::handleStorageClass( ast::DeclWithType const * decl ) {
     263void CodeGenerator::handleStorageClass( ast::DeclWithType const * decl ) {
    265264        if ( decl->storage.any() ) {
    266265                ast::print( output, decl->storage );
     
    268267}
    269268
    270 void CodeGenerator_new::handleAggregate(
     269void CodeGenerator::handleAggregate(
    271270                ast::AggregateDecl const * decl, std::string const & kind ) {
    272271        if ( !decl->params.empty() && !options.genC ) {
     
    296295}
    297296
    298 void CodeGenerator_new::postvisit( ast::StructDecl const * decl ) {
     297void CodeGenerator::postvisit( ast::StructDecl const * decl ) {
    299298        extension( decl );
    300299        handleAggregate( decl, "struct " );
    301300}
    302301
    303 void CodeGenerator_new::postvisit( ast::UnionDecl const * decl ) {
     302void CodeGenerator::postvisit( ast::UnionDecl const * decl ) {
    304303        extension( decl );
    305304        handleAggregate( decl, "union " );
     
    332331}
    333332
    334 void CodeGenerator_new::postvisit( ast::EnumDecl const * decl ) {
     333void CodeGenerator::postvisit( ast::EnumDecl const * decl ) {
    335334        extension( decl );
    336335        auto members = decl->members;
     
    370369}
    371370
    372 void CodeGenerator_new::postvisit( ast::TraitDecl const * decl ) {
     371void CodeGenerator::postvisit( ast::TraitDecl const * decl ) {
    373372        assertf( !options.genC, "TraitDecls should not reach code generation." );
    374373        extension( decl );
     
    376375}
    377376
    378 void CodeGenerator_new::postvisit( ast::TypedefDecl const * decl ) {
     377void CodeGenerator::postvisit( ast::TypedefDecl const * decl ) {
    379378        assertf( !options.genC, "Typedefs should not reach code generation." );
    380379        output << "typedef " << genType( decl->base, decl->name, options ) << endl;
    381380}
    382381
    383 void CodeGenerator_new::postvisit( ast::TypeDecl const * decl ) {
     382void CodeGenerator::postvisit( ast::TypeDecl const * decl ) {
    384383        assertf( !options.genC, "TypeDecls should not reach code generation." );
    385384        output << decl->genTypeString() << " " << decl->name;
     
    397396}
    398397
    399 void CodeGenerator_new::postvisit( ast::StaticAssertDecl const * decl ) {
     398void CodeGenerator::postvisit( ast::StaticAssertDecl const * decl ) {
    400399        output << "_Static_assert(";
    401400        decl->cond->accept( *visitor );
     
    405404}
    406405
    407 void CodeGenerator_new::postvisit( ast::Designation const * designation ) {
     406void CodeGenerator::postvisit( ast::Designation const * designation ) {
    408407        auto designators = designation->designators;
    409408        if ( 0 == designators.size() ) return;
     
    423422}
    424423
    425 void CodeGenerator_new::postvisit( ast::SingleInit const * init ) {
     424void CodeGenerator::postvisit( ast::SingleInit const * init ) {
    426425        init->value->accept( *visitor );
    427426}
    428427
    429 void CodeGenerator_new::postvisit( ast::ListInit const * init ) {
     428void CodeGenerator::postvisit( ast::ListInit const * init ) {
    430429        auto initBegin = init->initializers.begin();
    431430        auto initEnd = init->initializers.end();
     
    446445}
    447446
    448 void CodeGenerator_new::postvisit( ast::ConstructorInit const * init ) {
     447void CodeGenerator::postvisit( ast::ConstructorInit const * init ) {
    449448        assertf( !options.genC, "ConstructorInit nodes should not reach code generation." );
    450449        // This isn't actual code, but labels the constructor/destructor pairs.
     
    456455}
    457456
    458 void CodeGenerator_new::postvisit( ast::ApplicationExpr const * expr ) {
     457void CodeGenerator::postvisit( ast::ApplicationExpr const * expr ) {
    459458        extension( expr );
    460459        if ( auto var = expr->func.as<ast::VariableExpr>() ) {
     
    550549}
    551550
    552 void CodeGenerator_new::postvisit( ast::UntypedExpr const * expr ) {
     551void CodeGenerator::postvisit( ast::UntypedExpr const * expr ) {
    553552        extension( expr );
    554553        if ( auto name = expr->func.as<ast::NameExpr>() ) {
     
    638637}
    639638
    640 void CodeGenerator_new::postvisit( ast::RangeExpr const * expr ) {
     639void CodeGenerator::postvisit( ast::RangeExpr const * expr ) {
    641640        expr->low->accept( *visitor );
    642641        output << " ... ";
     
    644643}
    645644
    646 void CodeGenerator_new::postvisit( ast::NameExpr const * expr ) {
     645void CodeGenerator::postvisit( ast::NameExpr const * expr ) {
    647646        extension( expr );
    648647        if ( const OperatorInfo * opInfo = operatorLookup( expr->name ) ) {
     
    657656}
    658657
    659 void CodeGenerator_new::postvisit( ast::DimensionExpr const * expr ) {
     658void CodeGenerator::postvisit( ast::DimensionExpr const * expr ) {
    660659        extension( expr );
    661660        output << "/*non-type*/" << expr->name;
    662661}
    663662
    664 void CodeGenerator_new::postvisit( ast::AddressExpr const * expr ) {
     663void CodeGenerator::postvisit( ast::AddressExpr const * expr ) {
    665664        extension( expr );
    666665        output << "(&";
     
    669668}
    670669
    671 void CodeGenerator_new::postvisit( ast::LabelAddressExpr const * expr ) {
     670void CodeGenerator::postvisit( ast::LabelAddressExpr const * expr ) {
    672671        extension( expr );
    673672        output << "(&&" << expr->arg << ")";
    674673}
    675674
    676 void CodeGenerator_new::postvisit( ast::CastExpr const * expr ) {
     675void CodeGenerator::postvisit( ast::CastExpr const * expr ) {
    677676        extension( expr );
    678677        output << "(";
     
    688687}
    689688
    690 void CodeGenerator_new::postvisit( ast::KeywordCastExpr const * expr ) {
     689void CodeGenerator::postvisit( ast::KeywordCastExpr const * expr ) {
    691690        assertf( !options.genC, "KeywordCastExpr should not reach code generation." );
    692691        extension( expr );
     
    696695}
    697696
    698 void CodeGenerator_new::postvisit( ast::VirtualCastExpr const * expr ) {
     697void CodeGenerator::postvisit( ast::VirtualCastExpr const * expr ) {
    699698        assertf( !options.genC, "VirtualCastExpr should not reach code generation." );
    700699        extension( expr );
     
    705704}
    706705
    707 void CodeGenerator_new::postvisit( ast::UntypedMemberExpr const * expr ) {
     706void CodeGenerator::postvisit( ast::UntypedMemberExpr const * expr ) {
    708707        assertf( !options.genC, "UntypedMemberExpr should not reach code generation." );
    709708        extension( expr );
     
    713712}
    714713
    715 void CodeGenerator_new::postvisit( ast::MemberExpr const * expr ) {
     714void CodeGenerator::postvisit( ast::MemberExpr const * expr ) {
    716715        extension( expr );
    717716        expr->aggregate->accept( *visitor );
     
    719718}
    720719
    721 void CodeGenerator_new::postvisit( ast::VariableExpr const * expr ) {
     720void CodeGenerator::postvisit( ast::VariableExpr const * expr ) {
    722721        extension( expr );
    723722        const OperatorInfo * opInfo;
     
    733732}
    734733
    735 void CodeGenerator_new::postvisit( ast::ConstantExpr const * expr ) {
     734void CodeGenerator::postvisit( ast::ConstantExpr const * expr ) {
    736735        extension( expr );
    737736        output << expr->rep;
    738737}
    739738
    740 void CodeGenerator_new::postvisit( ast::SizeofExpr const * expr ) {
     739void CodeGenerator::postvisit( ast::SizeofExpr const * expr ) {
    741740        extension( expr );
    742741        output << "sizeof(";
     
    749748}
    750749
    751 void CodeGenerator_new::postvisit( ast::AlignofExpr const * expr ) {
     750void CodeGenerator::postvisit( ast::AlignofExpr const * expr ) {
    752751        // Using the GCC extension to avoid changing the std to C11.
    753752        extension( expr );
     
    761760}
    762761
    763 void CodeGenerator_new::postvisit( ast::UntypedOffsetofExpr const * expr ) {
     762void CodeGenerator::postvisit( ast::UntypedOffsetofExpr const * expr ) {
    764763        assertf( !options.genC, "UntypedOffsetofExpr should not reach code generation." );
    765764        output << "offsetof(";
     
    769768}
    770769
    771 void CodeGenerator_new::postvisit( ast::OffsetofExpr const * expr ) {
     770void CodeGenerator::postvisit( ast::OffsetofExpr const * expr ) {
    772771        // Use GCC builtin
    773772        output << "__builtin_offsetof(";
     
    777776}
    778777
    779 void CodeGenerator_new::postvisit( ast::OffsetPackExpr const * expr ) {
     778void CodeGenerator::postvisit( ast::OffsetPackExpr const * expr ) {
    780779        assertf( !options.genC, "OffsetPackExpr should not reach code generation." );
    781780        output << "__CFA_offsetpack(" << genType( expr->type, "", options ) << ")";
    782781}
    783782
    784 void CodeGenerator_new::postvisit( ast::LogicalExpr const * expr ) {
     783void CodeGenerator::postvisit( ast::LogicalExpr const * expr ) {
    785784        extension( expr );
    786785        output << "(";
     
    791790}
    792791
    793 void CodeGenerator_new::postvisit( ast::ConditionalExpr const * expr ) {
     792void CodeGenerator::postvisit( ast::ConditionalExpr const * expr ) {
    794793        extension( expr );
    795794        output << "(";
     
    802801}
    803802
    804 void CodeGenerator_new::postvisit( ast::CommaExpr const * expr ) {
     803void CodeGenerator::postvisit( ast::CommaExpr const * expr ) {
    805804        extension( expr );
    806805        output << "(";
     
    818817}
    819818
    820 void CodeGenerator_new::postvisit( ast::TupleAssignExpr const * expr ) {
     819void CodeGenerator::postvisit( ast::TupleAssignExpr const * expr ) {
    821820        assertf( !options.genC, "TupleAssignExpr should not reach code generation." );
    822821        expr->stmtExpr->accept( *visitor );
    823822}
    824823
    825 void CodeGenerator_new::postvisit( ast::UntypedTupleExpr const * expr ) {
     824void CodeGenerator::postvisit( ast::UntypedTupleExpr const * expr ) {
    826825        assertf( !options.genC, "UntypedTupleExpr should not reach code generation." );
    827826        extension( expr );
     
    831830}
    832831
    833 void CodeGenerator_new::postvisit( ast::TupleExpr const * expr ) {
     832void CodeGenerator::postvisit( ast::TupleExpr const * expr ) {
    834833        assertf( !options.genC, "TupleExpr should not reach code generation." );
    835834        extension( expr );
     
    839838}
    840839
    841 void CodeGenerator_new::postvisit( ast::TupleIndexExpr const * expr ) {
     840void CodeGenerator::postvisit( ast::TupleIndexExpr const * expr ) {
    842841        assertf( !options.genC, "TupleIndexExpr should not reach code generation." );
    843842        extension( expr );
     
    846845}
    847846
    848 void CodeGenerator_new::postvisit( ast::TypeExpr const * expr ) {
     847void CodeGenerator::postvisit( ast::TypeExpr const * expr ) {
    849848        // TODO: Should there be an assertion there?
    850849        if ( !options.genC ) {
     
    853852}
    854853
    855 void CodeGenerator_new::postvisit( ast::AsmExpr const * expr ) {
     854void CodeGenerator::postvisit( ast::AsmExpr const * expr ) {
    856855        if ( !expr->inout.empty() ) {
    857856                output << "[ " << expr->inout << " ] ";
     
    863862}
    864863
    865 void CodeGenerator_new::postvisit( ast::CompoundLiteralExpr const * expr ) {
     864void CodeGenerator::postvisit( ast::CompoundLiteralExpr const * expr ) {
    866865        //assert( expr->result && dynamic_cast<ast::ListInit const *>( expr->init ) );
    867866        assert( expr->result && expr->init.as<ast::ListInit>() );
     
    870869}
    871870
    872 void CodeGenerator_new::postvisit( ast::UniqueExpr const * expr ) {
     871void CodeGenerator::postvisit( ast::UniqueExpr const * expr ) {
    873872        assertf( !options.genC, "UniqueExpr should not reach code generation." );
    874873        output << "unq<" << expr->id << ">{ ";
     
    877876}
    878877
    879 void CodeGenerator_new::postvisit( ast::StmtExpr const * expr ) {
     878void CodeGenerator::postvisit( ast::StmtExpr const * expr ) {
    880879        auto stmts = expr->stmts->kids;
    881880        output << "({" << endl;
     
    905904}
    906905
    907 void CodeGenerator_new::postvisit( ast::ConstructorExpr const * expr ) {
     906void CodeGenerator::postvisit( ast::ConstructorExpr const * expr ) {
    908907        assertf( !options.genC, "ConstructorExpr should not reach code generation." );
    909908        expr->callExpr->accept( *visitor );
    910909}
    911910
    912 void CodeGenerator_new::postvisit( ast::DeletedExpr const * expr ) {
     911void CodeGenerator::postvisit( ast::DeletedExpr const * expr ) {
    913912        assertf( !options.genC, "DeletedExpr should not reach code generation." );
    914913        expr->expr->accept( *visitor );
    915914}
    916915
    917 void CodeGenerator_new::postvisit( ast::DefaultArgExpr const * expr ) {
     916void CodeGenerator::postvisit( ast::DefaultArgExpr const * expr ) {
    918917        assertf( !options.genC, "DefaultArgExpr should not reach code generation." );
    919918        expr->expr->accept( *visitor );
    920919}
    921920
    922 void CodeGenerator_new::postvisit( ast::GenericExpr const * expr ) {
     921void CodeGenerator::postvisit( ast::GenericExpr const * expr ) {
    923922        assertf( !options.genC, "GenericExpr should not reach code generation." );
    924923        output << "_Generic(";
     
    940939}
    941940
    942 void CodeGenerator_new::postvisit( ast::CompoundStmt const * stmt ) {
     941void CodeGenerator::postvisit( ast::CompoundStmt const * stmt ) {
    943942        output << "{" << endl;
    944943
     
    955954}
    956955
    957 void CodeGenerator_new::postvisit( ast::ExprStmt const * stmt ) {
     956void CodeGenerator::postvisit( ast::ExprStmt const * stmt ) {
    958957        assert( stmt );
    959958        // Cast the top-level expression to void to reduce gcc warnings.
     
    967966}
    968967
    969 void CodeGenerator_new::postvisit( ast::AsmStmt const * stmt ) {
     968void CodeGenerator::postvisit( ast::AsmStmt const * stmt ) {
    970969        output << "asm ";
    971970        if ( stmt->isVolatile ) output << "volatile ";
     
    991990}
    992991
    993 void CodeGenerator_new::postvisit( ast::AsmDecl const * decl ) {
     992void CodeGenerator::postvisit( ast::AsmDecl const * decl ) {
    994993        output << "asm ";
    995994        ast::AsmStmt const * stmt = decl->stmt;
     
    999998}
    1000999
    1001 void CodeGenerator_new::postvisit( ast::DirectiveDecl const * decl ) {
     1000void CodeGenerator::postvisit( ast::DirectiveDecl const * decl ) {
    10021001        // endl prevents spaces before the directive.
    10031002        output << endl << decl->stmt->directive;
    10041003}
    10051004
    1006 void CodeGenerator_new::postvisit( ast::DirectiveStmt const * stmt ) {
     1005void CodeGenerator::postvisit( ast::DirectiveStmt const * stmt ) {
    10071006        // endl prevents spaces before the directive.
    10081007        output << endl << stmt->directive;
    10091008}
    10101009
    1011 void CodeGenerator_new::postvisit( ast::IfStmt const * stmt ) {
     1010void CodeGenerator::postvisit( ast::IfStmt const * stmt ) {
    10121011        output << "if ( ";
    10131012        stmt->cond->accept( *visitor );
     
    10221021}
    10231022
    1024 void CodeGenerator_new::postvisit( ast::SwitchStmt const * stmt ) {
     1023void CodeGenerator::postvisit( ast::SwitchStmt const * stmt ) {
    10251024        output << "switch ( ";
    10261025        stmt->cond->accept( *visitor );
     
    10361035}
    10371036
    1038 void CodeGenerator_new::postvisit( ast::CaseClause const * clause ) {
     1037void CodeGenerator::postvisit( ast::CaseClause const * clause ) {
    10391038        updateLocation( clause );
    10401039        output << indent;
     
    10561055}
    10571056
    1058 void CodeGenerator_new::postvisit( ast::BranchStmt const * stmt ) {
     1057void CodeGenerator::postvisit( ast::BranchStmt const * stmt ) {
    10591058        switch ( stmt->kind ) {
    10601059        case ast::BranchStmt::Goto:
     
    10911090}
    10921091
    1093 void CodeGenerator_new::postvisit( ast::ReturnStmt const * stmt ) {
     1092void CodeGenerator::postvisit( ast::ReturnStmt const * stmt ) {
    10941093        output << "return ";
    10951094        if ( stmt->expr ) stmt->expr->accept( *visitor );
     
    10971096}
    10981097
    1099 void CodeGenerator_new::postvisit( ast::ThrowStmt const * stmt ) {
     1098void CodeGenerator::postvisit( ast::ThrowStmt const * stmt ) {
    11001099        assertf( !options.genC, "ThrowStmt should not reach code generation." );
    11011100
     
    11121111}
    11131112
    1114 void CodeGenerator_new::postvisit( ast::CatchClause const * stmt ) {
     1113void CodeGenerator::postvisit( ast::CatchClause const * stmt ) {
    11151114        assertf( !options.genC, "CatchClause should not reach code generation." );
    11161115
     
    11261125}
    11271126
    1128 void CodeGenerator_new::postvisit( ast::WaitForStmt const * stmt ) {
     1127void CodeGenerator::postvisit( ast::WaitForStmt const * stmt ) {
    11291128        assertf( !options.genC, "WaitforStmt should not reach code generation." );
    11301129
     
    11721171}
    11731172
    1174 void CodeGenerator_new::postvisit( ast::WithStmt const * stmt ) {
     1173void CodeGenerator::postvisit( ast::WithStmt const * stmt ) {
    11751174        assertf( !options.genC, "WithStmt should not reach code generation." );
    11761175
     
    11811180}
    11821181
    1183 void CodeGenerator_new::postvisit( ast::WhileDoStmt const * stmt ) {
     1182void CodeGenerator::postvisit( ast::WhileDoStmt const * stmt ) {
    11841183        if ( stmt->isDoWhile ) {
    11851184                output << "do";
     
    11911190        output << " ";
    11921191
    1193         output << CodeGenerator_new::printLabels( stmt->body->labels );
     1192        output << CodeGenerator::printLabels( stmt->body->labels );
    11941193        stmt->body->accept( *visitor );
    11951194
     
    12031202}
    12041203
    1205 void CodeGenerator_new::postvisit( ast::ForStmt const * stmt ) {
     1204void CodeGenerator::postvisit( ast::ForStmt const * stmt ) {
    12061205        // Initializer is always hoised so don't generate it.
    12071206        // TODO: Do an assertion check?
     
    12261225}
    12271226
    1228 void CodeGenerator_new::postvisit( ast::NullStmt const * ) {
     1227void CodeGenerator::postvisit( ast::NullStmt const * ) {
    12291228        output << "/* null statement */ ;";
    12301229}
    12311230
    1232 void CodeGenerator_new::postvisit( ast::DeclStmt const * stmt ) {
     1231void CodeGenerator::postvisit( ast::DeclStmt const * stmt ) {
    12331232        stmt->decl->accept( *visitor );
    12341233
     
    12361235}
    12371236
    1238 void CodeGenerator_new::postvisit( ast::ImplicitCtorDtorStmt const * stmt ) {
     1237void CodeGenerator::postvisit( ast::ImplicitCtorDtorStmt const * stmt ) {
    12391238        assertf( !options.genC, "ImplicitCtorCtorStmt should not reach code generation." );
    12401239        stmt->callStmt->accept( *visitor );
    12411240}
    12421241
    1243 void CodeGenerator_new::postvisit( ast::MutexStmt const * stmt ) {
     1242void CodeGenerator::postvisit( ast::MutexStmt const * stmt ) {
    12441243        assertf( !options.genC, "MutexStmt should not reach code generation." );
    12451244        // TODO: But this isn't what a mutex statement looks like.
  • src/CodeGen/CodeGeneratorNew.hpp

    r25f2798 r0bd3faf  
    2525namespace CodeGen {
    2626
    27 #warning Remove the _new when old version is removed.
    28 struct CodeGenerator_new :
     27struct CodeGenerator final :
    2928                public ast::WithGuards,
    3029                public ast::WithShortCircuiting,
    31                 public ast::WithVisitorRef<CodeGenerator_new> {
    32         CodeGenerator_new( std::ostream & out, Options const & options );
     30                public ast::WithVisitorRef<CodeGenerator> {
     31        CodeGenerator( std::ostream & out, Options const & options );
    3332
    3433        // Turn off visit_children for all nodes.
     
    119118        /// Custom local implementation of endl that updates print location.
    120119        struct LineEnder {
    121                 CodeGenerator_new & cg;
    122                 LineEnder( CodeGenerator_new & cg ) : cg( cg ) {}
     120                CodeGenerator & cg;
     121                LineEnder( CodeGenerator & cg ) : cg( cg ) {}
    123122                std::ostream & operator()( std::ostream & ) const;
    124123        };
     
    129128        /// Wrapper class to help print vectors of Labels.
    130129        struct LabelPrinter {
    131                 LabelPrinter( CodeGenerator_new & cg ) : cg( cg ), labels( nullptr ) {}
     130                LabelPrinter( CodeGenerator & cg ) : cg( cg ), labels( nullptr ) {}
    132131                LabelPrinter & operator()( std::vector<ast::Label> const & l );
    133132                std::ostream & operator()( std::ostream & ) const;
    134                 CodeGenerator_new & cg;
     133                CodeGenerator & cg;
    135134                std::vector<ast::Label> const * labels;
    136135        };
  • src/CodeGen/GenType.cc

    r25f2798 r0bd3faf  
    2121#include "AST/Print.hpp"          // for print
    2222#include "AST/Vector.hpp"         // for vector
    23 #include "CodeGeneratorNew.hpp"   // for CodeGenerator_new
     23#include "CodeGeneratorNew.hpp"   // for CodeGenerator
    2424#include "Common/UniqueName.h"    // for UniqueName
    2525
     
    2828namespace {
    2929
    30 #warning Remove the _new when old version is removed.
    31 struct GenType_new :
     30struct GenType final :
    3231                public ast::WithShortCircuiting,
    33                 public ast::WithVisitorRef<GenType_new> {
     32                public ast::WithVisitorRef<GenType> {
    3433        std::string result;
    35         GenType_new( const std::string &typeString, const Options &options );
     34        GenType( const std::string &typeString, const Options &options );
    3635
    3736        void previsit( ast::Node const * );
     
    6766};
    6867
    69 GenType_new::GenType_new( const std::string &typeString, const Options &options ) : result( typeString ), options( options ) {}
    70 
    71 void GenType_new::previsit( ast::Node const * ) {
     68GenType::GenType( const std::string &typeString, const Options &options ) : result( typeString ), options( options ) {}
     69
     70void GenType::previsit( ast::Node const * ) {
    7271        // Turn off automatic recursion for all nodes, to allow each visitor to
    7372        // precisely control the order in which its children are visited.
     
    7574}
    7675
    77 void GenType_new::postvisit( ast::Node const * node ) {
     76void GenType::postvisit( ast::Node const * node ) {
    7877        std::stringstream ss;
    7978        ast::print( ss, node );
     
    8180}
    8281
    83 void GenType_new::postvisit( ast::VoidType const * type ) {
     82void GenType::postvisit( ast::VoidType const * type ) {
    8483        result = "void " + result;
    8584        handleQualifiers( type );
    8685}
    8786
    88 void GenType_new::postvisit( ast::BasicType const * type ) {
     87void GenType::postvisit( ast::BasicType const * type ) {
    8988        ast::BasicType::Kind kind = type->kind;
    9089        assert( 0 <= kind && kind < ast::BasicType::NUMBER_OF_BASIC_TYPES );
     
    9392}
    9493
    95 void GenType_new::genArray( const ast::CV::Qualifiers & qualifiers, ast::Type const * base, ast::Expr const *dimension, bool isVarLen, bool isStatic ) {
     94void GenType::genArray( const ast::CV::Qualifiers & qualifiers, ast::Type const * base, ast::Expr const *dimension, bool isVarLen, bool isStatic ) {
    9695        std::ostringstream os;
    9796        if ( result != "" ) {
     
    119118        }
    120119        if ( dimension != 0 ) {
    121                 ast::Pass<CodeGenerator_new>::read( dimension, os, options );
     120                ast::Pass<CodeGenerator>::read( dimension, os, options );
    122121        } else if ( isVarLen ) {
    123122                // no dimension expression on a VLA means it came in with the * token
     
    131130}
    132131
    133 void GenType_new::postvisit( ast::PointerType const * type ) {
     132void GenType::postvisit( ast::PointerType const * type ) {
    134133        if ( type->isStatic || type->isVarLen || type->dimension ) {
    135134                genArray( type->qualifiers, type->base, type->dimension, type->isVarLen, type->isStatic );
     
    145144}
    146145
    147 void GenType_new::postvisit( ast::ArrayType const * type ) {
     146void GenType::postvisit( ast::ArrayType const * type ) {
    148147        genArray( type->qualifiers, type->base, type->dimension, type->isVarLen, type->isStatic );
    149148}
    150149
    151 void GenType_new::postvisit( ast::ReferenceType const * type ) {
     150void GenType::postvisit( ast::ReferenceType const * type ) {
    152151        assertf( !options.genC, "Reference types should not reach code generation." );
    153152        handleQualifiers( type );
     
    156155}
    157156
    158 void GenType_new::postvisit( ast::FunctionType const * type ) {
     157void GenType::postvisit( ast::FunctionType const * type ) {
    159158        std::ostringstream os;
    160159
     
    196195                //assertf( !options.genC, "FunctionDecl type parameters should not reach code generation." );
    197196                std::ostringstream os;
    198                 ast::Pass<CodeGenerator_new> cg( os, options );
     197                ast::Pass<CodeGenerator> cg( os, options );
    199198                os << "forall(";
    200199                cg.core.genCommaList( type->forall );
     
    204203}
    205204
    206 std::string GenType_new::handleGeneric( ast::BaseInstType const * type ) {
     205std::string GenType::handleGeneric( ast::BaseInstType const * type ) {
    207206        if ( !type->params.empty() ) {
    208207                std::ostringstream os;
    209                 ast::Pass<CodeGenerator_new> cg( os, options );
     208                ast::Pass<CodeGenerator> cg( os, options );
    210209                os << "(";
    211210                cg.core.genCommaList( type->params );
     
    216215}
    217216
    218 void GenType_new::postvisit( ast::StructInstType const * type )  {
     217void GenType::postvisit( ast::StructInstType const * type )  {
    219218        result = type->name + handleGeneric( type ) + " " + result;
    220219        if ( options.genC ) result = "struct " + result;
     
    222221}
    223222
    224 void GenType_new::postvisit( ast::UnionInstType const * type ) {
     223void GenType::postvisit( ast::UnionInstType const * type ) {
    225224        result = type->name + handleGeneric( type ) + " " + result;
    226225        if ( options.genC ) result = "union " + result;
     
    228227}
    229228
    230 void GenType_new::postvisit( ast::EnumInstType const * type ) {
     229void GenType::postvisit( ast::EnumInstType const * type ) {
    231230        if ( type->base && type->base->base ) {
    232231                result = genType( type->base->base, result, options );
     
    240239}
    241240
    242 void GenType_new::postvisit( ast::TypeInstType const * type ) {
     241void GenType::postvisit( ast::TypeInstType const * type ) {
    243242        assertf( !options.genC, "TypeInstType should not reach code generation." );
    244243        result = type->name + " " + result;
     
    246245}
    247246
    248 void GenType_new::postvisit( ast::TupleType const * type ) {
     247void GenType::postvisit( ast::TupleType const * type ) {
    249248        assertf( !options.genC, "TupleType should not reach code generation." );
    250249        unsigned int i = 0;
     
    259258}
    260259
    261 void GenType_new::postvisit( ast::VarArgsType const * type ) {
     260void GenType::postvisit( ast::VarArgsType const * type ) {
    262261        result = "__builtin_va_list " + result;
    263262        handleQualifiers( type );
    264263}
    265264
    266 void GenType_new::postvisit( ast::ZeroType const * type ) {
     265void GenType::postvisit( ast::ZeroType const * type ) {
    267266        // Ideally these wouldn't hit codegen at all, but should be safe to make them ints.
    268267        result = (options.pretty ? "zero_t " : "long int ") + result;
     
    270269}
    271270
    272 void GenType_new::postvisit( ast::OneType const * type ) {
     271void GenType::postvisit( ast::OneType const * type ) {
    273272        // Ideally these wouldn't hit codegen at all, but should be safe to make them ints.
    274273        result = (options.pretty ? "one_t " : "long int ") + result;
     
    276275}
    277276
    278 void GenType_new::postvisit( ast::GlobalScopeType const * type ) {
     277void GenType::postvisit( ast::GlobalScopeType const * type ) {
    279278        assertf( !options.genC, "GlobalScopeType should not reach code generation." );
    280279        handleQualifiers( type );
    281280}
    282281
    283 void GenType_new::postvisit( ast::TraitInstType const * type ) {
     282void GenType::postvisit( ast::TraitInstType const * type ) {
    284283        assertf( !options.genC, "TraitInstType should not reach code generation." );
    285284        result = type->name + " " + result;
     
    287286}
    288287
    289 void GenType_new::postvisit( ast::TypeofType const * type ) {
     288void GenType::postvisit( ast::TypeofType const * type ) {
    290289        std::ostringstream os;
    291290        os << "typeof(";
    292         ast::Pass<CodeGenerator_new>::read( type, os, options );
     291        ast::Pass<CodeGenerator>::read( type, os, options );
    293292        os << ") " << result;
    294293        result = os.str();
     
    296295}
    297296
    298 void GenType_new::postvisit( ast::VTableType const * type ) {
     297void GenType::postvisit( ast::VTableType const * type ) {
    299298        assertf( !options.genC, "Virtual table types should not reach code generation." );
    300299        std::ostringstream os;
     
    304303}
    305304
    306 void GenType_new::postvisit( ast::QualifiedType const * type ) {
     305void GenType::postvisit( ast::QualifiedType const * type ) {
    307306        assertf( !options.genC, "QualifiedType should not reach code generation." );
    308307        std::ostringstream os;
     
    312311}
    313312
    314 void GenType_new::handleQualifiers( ast::Type const * type ) {
     313void GenType::handleQualifiers( ast::Type const * type ) {
    315314        if ( type->is_const() ) {
    316315                result = "const " + result;
     
    327326}
    328327
    329 std::string GenType_new::genParamList( const ast::vector<ast::Type> & range ) {
     328std::string GenType::genParamList( const ast::vector<ast::Type> & range ) {
    330329        auto cur = range.begin();
    331330        auto end = range.end();
     
    346345        std::ostringstream os;
    347346        if ( !type->attributes.empty() ) {
    348                 ast::Pass<CodeGenerator_new> cg( os, options );
     347                ast::Pass<CodeGenerator> cg( os, options );
    349348                cg.core.genAttributes( type->attributes );
    350349        }
    351350
    352         return os.str() + ast::Pass<GenType_new>::read( type, base, options );
     351        return os.str() + ast::Pass<GenType>::read( type, base, options );
    353352}
    354353
    355354std::string genTypeNoAttr( ast::Type const * type, const std::string & base, const Options & options ) {
    356         return ast::Pass<GenType_new>::read( type, base, options );
     355        return ast::Pass<GenType>::read( type, base, options );
    357356}
    358357
  • src/CodeGen/Generate.cc

    r25f2798 r0bd3faf  
    1919#include <string>                    // for operator<<
    2020
    21 #include "CodeGeneratorNew.hpp"      // for CodeGenerator_new, doSemicolon, ...
     21#include "CodeGeneratorNew.hpp"      // for CodeGenerator, doSemicolon, ...
    2222#include "GenType.h"                 // for genPrettyType
    2323
     
    3232
    3333        /// Removes various nodes that should not exist in CodeGen.
    34         struct TreeCleaner_new {
     34        struct TreeCleaner final {
    3535                ast::CompoundStmt const * previsit( ast::CompoundStmt const * stmt ) {
    3636                        auto mutStmt = ast::mutate( stmt );
     
    5151                bool pretty, bool generateC, bool lineMarks, bool printExprTypes ) {
    5252        erase_if( translationUnit.decls, shouldClean );
    53         ast::Pass<TreeCleaner_new>::run( translationUnit );
     53        ast::Pass<TreeCleaner>::run( translationUnit );
    5454
    55         ast::Pass<CodeGenerator_new> cgv( os,
     55        ast::Pass<CodeGenerator> cgv( os,
    5656                        Options( pretty, generateC, lineMarks, printExprTypes ) );
    5757        for ( auto & decl : translationUnit.decls ) {
  • src/CodeGen/Generate.h

    r25f2798 r0bd3faf  
    1717
    1818#include <iostream>  // for ostream
    19 #include <list>      // for list
    20 
    21 class BaseSyntaxNode;
    22 class Declaration;
    2319
    2420namespace ast {
  • src/InitTweak/FixGlobalInit.cc

    r25f2798 r0bd3faf  
    2727
    2828namespace InitTweak {
    29         class GlobalFixer_new : public ast::WithShortCircuiting {
     29        class GlobalFixer : public ast::WithShortCircuiting {
    3030        public:
    3131                void previsit (const ast::ObjectDecl *);
     
    4242
    4343        void fixGlobalInit(ast::TranslationUnit & translationUnit, bool inLibrary) {
    44                 ast::Pass<GlobalFixer_new> fixer;
     44                ast::Pass<GlobalFixer> fixer;
    4545                accept_all(translationUnit, fixer);
    4646
     
    7373        }
    7474
    75         void GlobalFixer_new::previsit(const ast::ObjectDecl * objDecl) {
     75        void GlobalFixer::previsit(const ast::ObjectDecl * objDecl) {
    7676                auto mutDecl = mutate(objDecl);
    7777                assertf(mutDecl == objDecl, "Global object decl must be unique");
  • src/InitTweak/FixInitNew.cpp

    r25f2798 r0bd3faf  
    917917                                        // static variables with the same name in different functions.
    918918                                        // Note: it isn't sufficient to modify only the mangleName, because
    919                                         // then subsequent Indexer passes can choke on seeing the object's name
     919                                        // then subsequent SymbolTable passes can choke on seeing the object's name
    920920                                        // if another object has the same name and type. An unfortunate side-effect
    921921                                        // of renaming the object is that subsequent NameExprs may fail to resolve,
     
    11691169                                arg2 = new ast::MemberExpr(funcDecl->location, field, new ast::VariableExpr(funcDecl->location, function->params.back() ) );
    11701170                        }
    1171                         InitExpander_new srcParam( arg2 );
     1171                        InitExpander srcParam( arg2 );
    11721172                        // cast away reference type and construct field.
    11731173                        ast::Expr * thisExpr = new ast::CastExpr(funcDecl->location, new ast::VariableExpr(funcDecl->location, thisParam ), thisParam->get_type()->stripReferences());
  • src/InitTweak/GenInit.cc

    r25f2798 r0bd3faf  
    4646namespace {
    4747
    48 #       warning Remove the _New suffix after the conversion is complete.
    49 
    5048        // Outer pass finds declarations, for their type could wrap a type that needs hoisting
    51         struct HoistArrayDimension_NoResolve_New final :
     49        struct HoistArrayDimension_NoResolve final :
    5250                        public ast::WithDeclsToAdd<>, public ast::WithShortCircuiting,
    5351                        public ast::WithGuards, public ast::WithConstTranslationUnit,
    54                         public ast::WithVisitorRef<HoistArrayDimension_NoResolve_New>,
     52                        public ast::WithVisitorRef<HoistArrayDimension_NoResolve>,
    5553                        public ast::WithSymbolTableX<ast::SymbolTable::ErrorDetection::IgnoreErrors> {
    5654
     
    5957                                public ast::WithShortCircuiting, public ast::WithGuards {
    6058
    61                         HoistArrayDimension_NoResolve_New * outer;
    62                         HoistDimsFromTypes( HoistArrayDimension_NoResolve_New * outer ) : outer(outer) {}
     59                        HoistArrayDimension_NoResolve * outer;
     60                        HoistDimsFromTypes( HoistArrayDimension_NoResolve * outer ) : outer(outer) {}
    6361
    6462                        // Only intended for visiting through types.
     
    211209
    212210
    213         struct ReturnFixer_New final :
     211        struct ReturnFixer final :
    214212                        public ast::WithStmtsToAdd<>, ast::WithGuards, ast::WithShortCircuiting {
    215213                void previsit( const ast::FunctionDecl * decl );
     
    219217        };
    220218
    221         void ReturnFixer_New::previsit( const ast::FunctionDecl * decl ) {
     219        void ReturnFixer::previsit( const ast::FunctionDecl * decl ) {
    222220                if (decl->linkage == ast::Linkage::Intrinsic) visit_children = false;
    223221                GuardValue( funcDecl ) = decl;
    224222        }
    225223
    226         const ast::ReturnStmt * ReturnFixer_New::previsit(
     224        const ast::ReturnStmt * ReturnFixer::previsit(
    227225                        const ast::ReturnStmt * stmt ) {
    228226                auto & returns = funcDecl->returns;
     
    265263
    266264        void genInit( ast::TranslationUnit & transUnit ) {
    267                 ast::Pass<HoistArrayDimension_NoResolve_New>::run( transUnit );
    268                 ast::Pass<ReturnFixer_New>::run( transUnit );
     265                ast::Pass<HoistArrayDimension_NoResolve>::run( transUnit );
     266                ast::Pass<ReturnFixer>::run( transUnit );
    269267        }
    270268
    271269        void fixReturnStatements( ast::TranslationUnit & transUnit ) {
    272                 ast::Pass<ReturnFixer_New>::run( transUnit );
    273         }
    274 
    275         bool ManagedTypes_new::isManaged( const ast::Type * type ) const {
     270                ast::Pass<ReturnFixer>::run( transUnit );
     271        }
     272
     273        bool ManagedTypes::isManaged( const ast::Type * type ) const {
    276274                // references are never constructed
    277275                if ( dynamic_cast< const ast::ReferenceType * >( type ) ) return false;
     
    292290        }
    293291
    294         bool ManagedTypes_new::isManaged( const ast::ObjectDecl * objDecl ) const {
     292        bool ManagedTypes::isManaged( const ast::ObjectDecl * objDecl ) const {
    295293                const ast::Type * type = objDecl->type;
    296294                while ( auto at = dynamic_cast< const ast::ArrayType * >( type ) ) {
     
    302300        }
    303301
    304         void ManagedTypes_new::handleDWT( const ast::DeclWithType * dwt ) {
     302        void ManagedTypes::handleDWT( const ast::DeclWithType * dwt ) {
    305303                // if this function is a user-defined constructor or destructor, mark down the type as "managed"
    306304                if ( ! dwt->linkage.is_overrideable && CodeGen::isCtorDtor( dwt->name ) ) {
     
    313311        }
    314312
    315         void ManagedTypes_new::handleStruct( const ast::StructDecl * aggregateDecl ) {
     313        void ManagedTypes::handleStruct( const ast::StructDecl * aggregateDecl ) {
    316314                // don't construct members, but need to take note if there is a managed member,
    317315                // because that means that this type is also managed
     
    329327        }
    330328
    331         void ManagedTypes_new::beginScope() { managedTypes.beginScope(); }
    332         void ManagedTypes_new::endScope() { managedTypes.endScope(); }
     329        void ManagedTypes::beginScope() { managedTypes.beginScope(); }
     330        void ManagedTypes::endScope() { managedTypes.endScope(); }
    333331
    334332        ast::ptr<ast::Stmt> genCtorDtor (const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * objDecl, const ast::Expr * arg) {
    335333                assertf(objDecl, "genCtorDtor passed null objDecl");
    336                 InitExpander_new srcParam(arg);
     334                InitExpander srcParam(arg);
    337335                return SymTab::genImplicitCall(srcParam, new ast::VariableExpr(loc, objDecl), loc, fname, objDecl);
    338336        }
     
    341339        // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor for each
    342340        // constructable object
    343         InitExpander_new srcParam{ objDecl->init }, nullParam{ (const ast::Init *)nullptr };
     341        InitExpander srcParam{ objDecl->init }, nullParam{ (const ast::Init *)nullptr };
    344342        ast::ptr< ast::Expr > dstParam = new ast::VariableExpr(loc, objDecl);
    345343
  • src/InitTweak/GenInit.h

    r25f2798 r0bd3faf  
    3737        ast::ConstructorInit * genCtorInit( const CodeLocation & loc, const ast::ObjectDecl * objDecl );
    3838
    39         class ManagedTypes_new {
     39        class ManagedTypes final {
    4040        public:
    4141                bool isManaged( const ast::ObjectDecl * objDecl ) const ; // determine if object is managed
  • src/InitTweak/InitTweak.cc

    r25f2798 r0bd3faf  
    3939namespace InitTweak {
    4040        namespace {
    41                 struct HasDesignations_new : public ast::WithShortCircuiting {
     41                struct HasDesignations : public ast::WithShortCircuiting {
    4242                        bool result = false;
    4343
     
    5757                };
    5858
    59                 struct InitDepthChecker_new {
     59                struct InitDepthChecker {
    6060                        bool result = true;
    6161                        const ast::Type * type;
    6262                        int curDepth = 0, maxDepth = 0;
    63                         InitDepthChecker_new( const ast::Type * type ) : type( type ) {
     63                        InitDepthChecker( const ast::Type * type ) : type( type ) {
    6464                                const ast::Type * t = type;
    6565                                while ( auto at = dynamic_cast< const ast::ArrayType * >( t ) ) {
     
    7878                };
    7979
    80                 struct InitFlattener_new : public ast::WithShortCircuiting {
     80                struct InitFlattener : public ast::WithShortCircuiting {
    8181                        std::vector< ast::ptr< ast::Expr > > argList;
    8282
     
    9090
    9191        bool isDesignated( const ast::Init * init ) {
    92                 ast::Pass<HasDesignations_new> finder;
     92                ast::Pass<HasDesignations> finder;
    9393                maybe_accept( init, finder );
    9494                return finder.core.result;
     
    9696
    9797        bool checkInitDepth( const ast::ObjectDecl * objDecl ) {
    98                 ast::Pass<InitDepthChecker_new> checker( objDecl->type );
     98                ast::Pass<InitDepthChecker> checker( objDecl->type );
    9999                maybe_accept( objDecl->init.get(), checker );
    100100                return checker.core.result;
     
    102102
    103103std::vector< ast::ptr< ast::Expr > > makeInitList( const ast::Init * init ) {
    104         ast::Pass< InitFlattener_new > flattener;
     104        ast::Pass< InitFlattener > flattener;
    105105        maybe_accept( init, flattener );
    106106        return std::move( flattener.core.argList );
    107107}
    108108
    109 class InitExpander_new::ExpanderImpl {
     109class InitExpander::ExpanderImpl {
    110110public:
    111111        virtual ~ExpanderImpl() = default;
     
    137137        template< typename Out >
    138138        void build(
    139                 ast::UntypedExpr * callExpr, const InitExpander_new::IndexList & indices,
     139                ast::UntypedExpr * callExpr, const InitExpander::IndexList & indices,
    140140                const ast::Init * init, Out & out
    141141        ) {
     
    183183        }
    184184
    185         class InitImpl_new final : public InitExpander_new::ExpanderImpl {
     185        class InitImpl final : public InitExpander::ExpanderImpl {
    186186                ast::ptr< ast::Init > init;
    187187        public:
    188                 InitImpl_new( const ast::Init * i ) : init( i ) {}
    189 
    190                 std::vector< ast::ptr< ast::Expr > > next( InitExpander_new::IndexList & ) override {
     188                InitImpl( const ast::Init * i ) : init( i ) {}
     189
     190                std::vector< ast::ptr< ast::Expr > > next( InitExpander::IndexList & ) override {
    191191                        return makeInitList( init );
    192192                }
    193193
    194194                ast::ptr< ast::Stmt > buildListInit(
    195                         ast::UntypedExpr * callExpr, InitExpander_new::IndexList & indices
     195                        ast::UntypedExpr * callExpr, InitExpander::IndexList & indices
    196196                ) override {
    197197                        // If array came with an initializer list, initialize each element. We may have more
     
    215215        };
    216216
    217         class ExprImpl_new final : public InitExpander_new::ExpanderImpl {
     217        class ExprImpl final : public InitExpander::ExpanderImpl {
    218218                ast::ptr< ast::Expr > arg;
    219219        public:
    220                 ExprImpl_new( const ast::Expr * a ) : arg( a ) {}
     220                ExprImpl( const ast::Expr * a ) : arg( a ) {}
    221221
    222222                std::vector< ast::ptr< ast::Expr > > next(
    223                         InitExpander_new::IndexList & indices
     223                        InitExpander::IndexList & indices
    224224                ) override {
    225225                        if ( ! arg ) return {};
     
    237237
    238238                ast::ptr< ast::Stmt > buildListInit(
    239                         ast::UntypedExpr *, InitExpander_new::IndexList &
     239                        ast::UntypedExpr *, InitExpander::IndexList &
    240240                ) override {
    241241                        return {};
     
    244244} // anonymous namespace
    245245
    246 InitExpander_new::InitExpander_new( const ast::Init * init )
    247 : expander( new InitImpl_new{ init } ), crnt(), indices() {}
    248 
    249 InitExpander_new::InitExpander_new( const ast::Expr * expr )
    250 : expander( new ExprImpl_new{ expr } ), crnt(), indices() {}
    251 
    252 std::vector< ast::ptr< ast::Expr > > InitExpander_new::operator* () { return crnt; }
    253 
    254 InitExpander_new & InitExpander_new::operator++ () {
     246InitExpander::InitExpander( const ast::Init * init )
     247: expander( new InitImpl{ init } ), crnt(), indices() {}
     248
     249InitExpander::InitExpander( const ast::Expr * expr )
     250: expander( new ExprImpl{ expr } ), crnt(), indices() {}
     251
     252std::vector< ast::ptr< ast::Expr > > InitExpander::operator* () { return crnt; }
     253
     254InitExpander & InitExpander::operator++ () {
    255255        crnt = expander->next( indices );
    256256        return *this;
     
    259259/// builds statement which has the same semantics as a C-style list initializer (for array
    260260/// initializers) using callExpr as the base expression to perform initialization
    261 ast::ptr< ast::Stmt > InitExpander_new::buildListInit( ast::UntypedExpr * callExpr ) {
     261ast::ptr< ast::Stmt > InitExpander::buildListInit( ast::UntypedExpr * callExpr ) {
    262262        return expander->buildListInit( callExpr, indices );
    263263}
    264264
    265 void InitExpander_new::addArrayIndex( const ast::Expr * index, const ast::Expr * dimension ) {
     265void InitExpander::addArrayIndex( const ast::Expr * index, const ast::Expr * dimension ) {
    266266        indices.emplace_back( index );
    267267        indices.emplace_back( dimension );
    268268}
    269269
    270 void InitExpander_new::clearArrayIndices() { indices.clear(); }
    271 
    272 bool InitExpander_new::addReference() {
     270void InitExpander::clearArrayIndices() { indices.clear(); }
     271
     272bool InitExpander::addReference() {
    273273        for ( ast::ptr< ast::Expr > & expr : crnt ) {
    274274                expr = new ast::AddressExpr{ expr };
     
    308308        }
    309309
    310         struct CallFinder_new final {
     310        struct CallFinder final {
    311311                std::vector< const ast::Expr * > matches;
    312312                const std::vector< std::string > names;
    313313
    314                 CallFinder_new( std::vector< std::string > && ns ) : matches(), names( std::move(ns) ) {}
     314                CallFinder( std::vector< std::string > && ns ) : matches(), names( std::move(ns) ) {}
    315315
    316316                void handleCallExpr( const ast::Expr * expr ) {
     
    326326
    327327        std::vector< const ast::Expr * > collectCtorDtorCalls( const ast::Stmt * stmt ) {
    328                 ast::Pass< CallFinder_new > finder{ std::vector< std::string >{ "?{}", "^?{}" } };
     328                ast::Pass< CallFinder > finder{ std::vector< std::string >{ "?{}", "^?{}" } };
    329329                maybe_accept( stmt, finder );
    330330                return std::move( finder.core.matches );
     
    381381        }
    382382
    383         struct ConstExprChecker_new : public ast::WithShortCircuiting {
     383        struct ConstExprChecker : public ast::WithShortCircuiting {
    384384                // most expressions are not const expr
    385385                void previsit( const ast::Expr * ) { result = false; visit_children = false; }
     
    426426        bool isConstExpr( const ast::Expr * expr ) {
    427427                if ( expr ) {
    428                         ast::Pass<ConstExprChecker_new> checker;
     428                        ast::Pass<ConstExprChecker> checker;
    429429                        expr->accept( checker );
    430430                        return checker.core.result;
     
    435435        bool isConstExpr( const ast::Init * init ) {
    436436                if ( init ) {
    437                         ast::Pass<ConstExprChecker_new> checker;
     437                        ast::Pass<ConstExprChecker> checker;
    438438                        init->accept( checker );
    439439                        return checker.core.result;
     
    486486        }
    487487
    488 }
     488} // namespace InitTweak
  • src/InitTweak/InitTweak.h

    r25f2798 r0bd3faf  
    7979        void addDataSectionAttribute( ast::ObjectDecl * objDecl );
    8080
    81         class InitExpander_new {
     81        class InitExpander final {
    8282        public:
    8383                using IndexList = std::vector< ast::ptr< ast::Expr > >;
     
    9292        public:
    9393                /// Expand by stepping through init to get each list of arguments
    94                 InitExpander_new( const ast::Init * init );
     94                InitExpander( const ast::Init * init );
    9595
    9696                /// Always expand to expression
    97                 InitExpander_new( const ast::Expr * expr );
     97                InitExpander( const ast::Expr * expr );
    9898
    9999                std::vector< ast::ptr< ast::Expr > > operator* ();
    100                 InitExpander_new & operator++ ();
     100                InitExpander & operator++ ();
    101101
    102102                /// builds statement which has the same semantics as a C-style list initializer (for array
     
    111111                bool addReference();
    112112        };
    113 } // namespace
     113} // namespace InitTweak
    114114
    115115// Local Variables: //
  • src/ResolvExpr/AdjustExprType.cc

    r25f2798 r0bd3faf  
    2323
    2424namespace {
    25         class AdjustExprType_new final : public ast::WithShortCircuiting {
     25        class AdjustExprType final : public ast::WithShortCircuiting {
    2626                const ast::SymbolTable & symtab;
    2727        public:
    2828                const ast::TypeEnvironment & tenv;
    2929
    30                 AdjustExprType_new( const ast::TypeEnvironment & e, const ast::SymbolTable & syms )
     30                AdjustExprType( const ast::TypeEnvironment & e, const ast::SymbolTable & syms )
    3131                : symtab( syms ), tenv( e ) {}
    3232
     
    7575        const ast::Type * type, const ast::TypeEnvironment & env, const ast::SymbolTable & symtab
    7676) {
    77         ast::Pass<AdjustExprType_new> adjuster{ env, symtab };
     77        ast::Pass<AdjustExprType> adjuster{ env, symtab };
    7878        return type->accept( adjuster );
    7979}
  • src/ResolvExpr/AdjustExprType.hpp

    r25f2798 r0bd3faf  
    1616#pragma once
    1717
    18 class Type;
    19 namespace SymTab {
    20         class Indexer;
    21 }
    2218namespace ast {
    2319        class SymbolTable;
     
    2723
    2824namespace ResolvExpr {
    29 
    30 class TypeEnvironment;
    31 
    32 /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function
    33 void adjustExprType( Type *& type, const TypeEnvironment & env, const SymTab::Indexer & indexer );
    34 
    35 /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function using empty TypeEnvironment and Indexer.
    36 void adjustExprType( Type *& type );
    37 
    38 template< typename ForwardIterator >
    39 void adjustExprTypeList( ForwardIterator begin, ForwardIterator end, const TypeEnvironment & env, const SymTab::Indexer & indexer ) {
    40         while ( begin != end ) {
    41                 adjustExprType( *begin++, env, indexer );
    42         } // while
    43 }
    4425
    4526/// Replaces array types with equivalent pointer,
  • src/ResolvExpr/CandidateFinder.cpp

    r25f2798 r0bd3faf  
    6161namespace {
    6262        /// First index is which argument, second is which alternative, third is which exploded element
    63         using ExplodedArgs_new = std::deque< std::vector< ExplodedArg > >;
     63        using ExplodedArgs = std::deque< std::vector< ExplodedArg > >;
    6464
    6565        /// Returns a list of alternatives with the minimum cost in the given list
     
    255255
    256256                /// Gets the list of exploded candidates for this pack
    257                 const ExplodedArg & getExpl( const ExplodedArgs_new & args ) const {
     257                const ExplodedArg & getExpl( const ExplodedArgs & args ) const {
    258258                        return args[ nextArg-1 ][ explAlt ];
    259259                }
     
    281281        bool instantiateArgument(
    282282                const CodeLocation & location,
    283                 const ast::Type * paramType, const ast::Init * init, const ExplodedArgs_new & args,
     283                const ast::Type * paramType, const ast::Init * init, const ExplodedArgs & args,
    284284                std::vector< ArgPack > & results, std::size_t & genStart, const ast::SymbolTable & symtab,
    285285                unsigned nTuples = 0
     
    618618                        const CodeLocation & location,
    619619                        const CandidateRef & func, const ast::FunctionType * funcType,
    620                         const ExplodedArgs_new & args, CandidateList & out );
     620                        const ExplodedArgs & args, CandidateList & out );
    621621
    622622                /// Adds implicit struct-conversions to the alternative list
     
    737737                const CodeLocation & location,
    738738                const CandidateRef & func, const ast::FunctionType * funcType,
    739                 const ExplodedArgs_new & args, CandidateList & out
     739                const ExplodedArgs & args, CandidateList & out
    740740        ) {
    741741                ast::OpenVarSet funcOpen;
     
    997997
    998998                // pre-explode arguments
    999                 ExplodedArgs_new argExpansions;
     999                ExplodedArgs argExpansions;
    10001000                for ( const CandidateFinder & args : argCandidates ) {
    10011001                        argExpansions.emplace_back();
  • src/ResolvExpr/CastCost.cc

    r25f2798 r0bd3faf  
    2626#include "ResolvExpr/ConversionCost.h"   // for conversionCost
    2727#include "ResolvExpr/PtrsCastable.hpp"   // for ptrsCastable
    28 #include "ResolvExpr/typeops.h"          // for ptrsCastable
    2928#include "ResolvExpr/Unify.h"            // for typesCompatibleIgnoreQualifiers
    3029
     
    3837
    3938namespace {
    40         struct CastCost_new : public ConversionCost_new {
    41                 using ConversionCost_new::previsit;
    42                 using ConversionCost_new::postvisit;
     39        struct CastCost : public ConversionCost {
     40                using ConversionCost::previsit;
     41                using ConversionCost::postvisit;
    4342
    44                 CastCost_new(
     43                CastCost(
    4544                        const ast::Type * dst, bool srcIsLvalue, const ast::SymbolTable & symtab,
    4645                        const ast::TypeEnvironment & env, CostCalculation costFunc )
    47                 : ConversionCost_new( dst, srcIsLvalue, symtab, env, costFunc ) {}
     46                : ConversionCost( dst, srcIsLvalue, symtab, env, costFunc ) {}
    4847
    4948                void postvisit( const ast::BasicType * basicType ) {
     
    8584        };
    8685
    87         #warning For overload resolution between the two versions.
    88         int localPtrsCastable(const ast::Type * t1, const ast::Type * t2,
    89                         const ast::SymbolTable & symtab, const ast::TypeEnvironment & env ) {
    90                 return ptrsCastable( t1, t2, symtab, env );
    91         }
    92         Cost localCastCost(
    93                 const ast::Type * src, const ast::Type * dst, bool srcIsLvalue,
    94                 const ast::SymbolTable & symtab, const ast::TypeEnvironment & env
    95         ) { return castCost( src, dst, srcIsLvalue, symtab, env ); }
    9686} // anonymous namespace
    9787
     
    136126        } else if ( auto refType = dynamic_cast< const ast::ReferenceType * >( dst ) ) {
    137127                PRINT( std::cerr << "conversionCost: dest is reference" << std::endl; )
    138                 #warning cast on ptrsCastable artifact of having two functions, remove when port done
    139128                return convertToReferenceCost(
    140                         src, refType, srcIsLvalue, symtab, env, localPtrsCastable );
     129                        src, refType, srcIsLvalue, symtab, env, ptrsCastable );
    141130        } else {
    142                 #warning cast on castCost artifact of having two functions, remove when port done
    143                 ast::Pass< CastCost_new > converter(
    144                         dst, srcIsLvalue, symtab, env, localCastCost );
     131                ast::Pass< CastCost > converter(
     132                        dst, srcIsLvalue, symtab, env, castCost );
    145133                src->accept( converter );
    146134                return converter.core.cost;
  • src/ResolvExpr/CastCost.hpp

    r25f2798 r0bd3faf  
    1818#include "ResolvExpr/Cost.h"     // for Cost
    1919
    20 class Type;
    21 namespace SymTab {
    22         class Indexer;
    23 }
    2420namespace ast {
    2521        class SymbolTable;
     
    3026namespace ResolvExpr {
    3127
    32 class TypeEnvironment;
    33 
    34 Cost castCost(
    35         const Type * src, const Type * dest, bool srcIsLvalue,
    36         const SymTab::Indexer & indexer, const TypeEnvironment & env );
    3728Cost castCost(
    3829        const ast::Type * src, const ast::Type * dst, bool srcIsLvalue,
  • src/ResolvExpr/CommonType.cc

    r25f2798 r0bd3faf  
    343343        );
    344344
    345         class CommonType_new final : public ast::WithShortCircuiting {
     345        class CommonType final : public ast::WithShortCircuiting {
    346346                const ast::Type * type2;
    347347                WidenMode widen;
     
    354354                ast::ptr< ast::Type > result;
    355355
    356                 CommonType_new(
     356                CommonType(
    357357                        const ast::Type * t2, WidenMode w,
    358358                        ast::TypeEnvironment & env, const ast::OpenVarSet & o,
     
    388388                                        result = enumDecl->base.get();
    389389                                } else {
    390                                         #warning remove casts when `commonTypes` moved to new AST
    391390                                        ast::BasicType::Kind kind = commonTypes[ basic->kind ][ ast::BasicType::SignedInt ];
    392391                                        if (
     
    739738        };
    740739
    741         // size_t CommonType_new::traceId = Stats::Heap::new_stacktrace_id("CommonType_new");
     740        // size_t CommonType::traceId = Stats::Heap::new_stacktrace_id("CommonType");
    742741        namespace {
    743742                ast::ptr< ast::Type > handleReference(
     
    811810                }
    812811                // otherwise both are reference types of the same depth and this is handled by the visitor
    813                 ast::Pass<CommonType_new> visitor{ type2, widen, env, open, need, have };
     812                ast::Pass<CommonType> visitor{ type2, widen, env, open, need, have };
    814813                type1->accept( visitor );
    815814                // ast::ptr< ast::Type > result = visitor.core.result;
  • src/ResolvExpr/ConversionCost.cc

    r25f2798 r0bd3faf  
    153153
    154154namespace {
    155         # warning For overload resolution between the two versions.
    156155        int localPtrsAssignable(const ast::Type * t1, const ast::Type * t2,
    157156                        const ast::SymbolTable &, const ast::TypeEnvironment & env ) {
    158157                return ptrsAssignable( t1, t2, env );
    159158        }
    160         Cost localConversionCost(
    161                 const ast::Type * src, const ast::Type * dst, bool srcIsLvalue,
    162                 const ast::SymbolTable & symtab, const ast::TypeEnvironment & env
    163         ) { return conversionCost( src, dst, srcIsLvalue, symtab, env ); }
    164159}
    165160
     
    191186                return convertToReferenceCost( src, refType, srcIsLvalue, symtab, env, localPtrsAssignable );
    192187        } else {
    193                 return ast::Pass<ConversionCost_new>::read( src, dst, srcIsLvalue, symtab, env, localConversionCost );
     188                return ast::Pass<ConversionCost>::read( src, dst, srcIsLvalue, symtab, env, conversionCost );
    194189        }
    195190}
     
    232227                        }
    233228                } else {
    234                         return ast::Pass<ConversionCost_new>::read( src, dst, srcIsLvalue, symtab, env, localConversionCost );
     229                        return ast::Pass<ConversionCost>::read( src, dst, srcIsLvalue, symtab, env, conversionCost );
    235230                }
    236231        } else {
     
    264259}
    265260
    266 void ConversionCost_new::postvisit( const ast::VoidType * voidType ) {
     261void ConversionCost::postvisit( const ast::VoidType * voidType ) {
    267262        (void)voidType;
    268263        cost = Cost::infinity;
    269264}
    270265
    271 void ConversionCost_new::conversionCostFromBasicToBasic( const ast::BasicType * src, const ast::BasicType* dest ) {
     266void ConversionCost::conversionCostFromBasicToBasic( const ast::BasicType * src, const ast::BasicType* dest ) {
    272267        int tableResult = costMatrix[ src->kind ][ dest->kind ];
    273268        if ( tableResult == -1 ) {
     
    280275}
    281276
    282 void ConversionCost_new::postvisit( const ast::BasicType * basicType ) {
     277void ConversionCost::postvisit( const ast::BasicType * basicType ) {
    283278        if ( const ast::BasicType * dstAsBasic = dynamic_cast< const ast::BasicType * >( dst ) ) {
    284279                conversionCostFromBasicToBasic( basicType, dstAsBasic );
     
    286281                const ast::EnumDecl * enumDecl = enumInst->base.get();
    287282                if ( enumDecl->isTyped && !enumDecl->base.get() ) {
    288                         cost = Cost::infinity; 
     283                        cost = Cost::infinity;
    289284                } else if ( const ast::Type * enumType = enumDecl->base.get() ) {
    290285                        if ( const ast::BasicType * enumTypeAsBasic = dynamic_cast<const ast::BasicType *>(enumType) ) {
     
    299294}
    300295
    301 void ConversionCost_new::postvisit( const ast::PointerType * pointerType ) {
     296void ConversionCost::postvisit( const ast::PointerType * pointerType ) {
    302297        if ( const ast::PointerType * dstAsPtr = dynamic_cast< const ast::PointerType * >( dst ) ) {
    303298                ast::CV::Qualifiers tq1 = pointerType->base->qualifiers;
     
    345340}
    346341
    347 void ConversionCost_new::postvisit( const ast::ArrayType * arrayType ) {
     342void ConversionCost::postvisit( const ast::ArrayType * arrayType ) {
    348343        (void)arrayType;
    349344}
    350345
    351 void ConversionCost_new::postvisit( const ast::ReferenceType * refType ) {
     346void ConversionCost::postvisit( const ast::ReferenceType * refType ) {
    352347        assert( nullptr == dynamic_cast< const ast::ReferenceType * >( dst ) );
    353348
     
    367362}
    368363
    369 void ConversionCost_new::postvisit( const ast::FunctionType * functionType ) {
     364void ConversionCost::postvisit( const ast::FunctionType * functionType ) {
    370365        (void)functionType;
    371366}
    372367
    373 void ConversionCost_new::postvisit( const ast::EnumInstType * enumInstType ) {
     368void ConversionCost::postvisit( const ast::EnumInstType * enumInstType ) {
    374369        const ast::EnumDecl * baseEnum = enumInstType->base;
    375370        if ( const ast::Type * baseType = baseEnum->base ) {
     
    384379}
    385380
    386 void ConversionCost_new::postvisit( const ast::TraitInstType * traitInstType ) {
     381void ConversionCost::postvisit( const ast::TraitInstType * traitInstType ) {
    387382        (void)traitInstType;
    388383}
    389384
    390 void ConversionCost_new::postvisit( const ast::TypeInstType * typeInstType ) {
     385void ConversionCost::postvisit( const ast::TypeInstType * typeInstType ) {
    391386        if ( const ast::EqvClass * eqv = env.lookup( *typeInstType ) ) {
    392387                cost = costCalc( eqv->bound, dst, srcIsLvalue, symtab, env );
     
    405400}
    406401
    407 void ConversionCost_new::postvisit( const ast::TupleType * tupleType ) {
     402void ConversionCost::postvisit( const ast::TupleType * tupleType ) {
    408403        Cost c = Cost::zero;
    409404        if ( const ast::TupleType * dstAsTuple = dynamic_cast< const ast::TupleType * >( dst ) ) {
     
    427422}
    428423
    429 void ConversionCost_new::postvisit( const ast::VarArgsType * varArgsType ) {
     424void ConversionCost::postvisit( const ast::VarArgsType * varArgsType ) {
    430425        (void)varArgsType;
    431426        if ( dynamic_cast< const ast::VarArgsType * >( dst ) ) {
     
    434429}
    435430
    436 void ConversionCost_new::postvisit( const ast::ZeroType * zeroType ) {
     431void ConversionCost::postvisit( const ast::ZeroType * zeroType ) {
    437432        (void)zeroType;
    438433        if ( dynamic_cast< const ast::ZeroType * >( dst ) ) {
     
    461456}
    462457
    463 void ConversionCost_new::postvisit( const ast::OneType * oneType ) {
     458void ConversionCost::postvisit( const ast::OneType * oneType ) {
    464459        (void)oneType;
    465460        if ( dynamic_cast< const ast::OneType * >( dst ) ) {
    466461                cost = Cost::zero;
    467462        } else if ( const ast::BasicType * dstAsBasic =
    468                         dynamic_cast< const ast::BasicType * >( dst ) ) {               
     463                        dynamic_cast< const ast::BasicType * >( dst ) ) {
    469464                int tableResult = costMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ];
    470465                if ( -1 == tableResult ) {
     
    475470                        cost.incSign( signMatrix[ ast::BasicType::SignedInt ][ dstAsBasic->kind ] );
    476471                }
    477                
    478                 // cost = Cost::zero;
    479         }
    480 }
    481 // size_t ConversionCost_new::traceId = Stats::Heap::new_stacktrace_id("ConversionCost");
     472        }
     473}
     474
     475// size_t ConversionCost::traceId = Stats::Heap::new_stacktrace_id("ConversionCost");
    482476
    483477} // namespace ResolvExpr
  • src/ResolvExpr/ConversionCost.h

    r25f2798 r0bd3faf  
    2323#include "AST/Pass.hpp"       // for WithShortCircuiting
    2424
    25 namespace SymTab {
    26         class Indexer;
    27 }  // namespace SymTab
    28 
    2925namespace ResolvExpr {
    30         class TypeEnvironment;
    3126
    3227// Some function pointer types, differ in return type.
     
    4439        PtrsCalculation func );
    4540
    46 #warning when the old ConversionCost is removed, get ride of the _new suffix.
    47 class ConversionCost_new : public ast::WithShortCircuiting {
     41class ConversionCost : public ast::WithShortCircuiting {
    4842protected:
    4943        const ast::Type * dst;
     
    5751        Cost result() { return cost; }
    5852
    59         ConversionCost_new( const ast::Type * dst, bool srcIsLvalue, const ast::SymbolTable & symtab,
     53        ConversionCost( const ast::Type * dst, bool srcIsLvalue, const ast::SymbolTable & symtab,
    6054                        const ast::TypeEnvironment & env, CostCalculation costCalc ) :
    6155                dst( dst ), srcIsLvalue( srcIsLvalue ), symtab( symtab ), env( env ),
  • src/ResolvExpr/FindOpenVars.cc

    r25f2798 r0bd3faf  
    2525
    2626        namespace {
    27                 struct FindOpenVars_new final : public ast::WithGuards {
     27                struct FindOpenVars final : public ast::WithGuards {
    2828                        ast::OpenVarSet & open;
    2929                        ast::OpenVarSet & closed;
     
    3333                        bool nextIsOpen;
    3434
    35                         FindOpenVars_new(
     35                        FindOpenVars(
    3636                                ast::OpenVarSet & o, ast::OpenVarSet & c, ast::AssertionSet & n,
    3737                                ast::AssertionSet & h, ast::TypeEnvironment & env, FirstMode firstIsOpen )
     
    7373                        const ast::Type * type, ast::OpenVarSet & open, ast::OpenVarSet & closed,
    7474                        ast::AssertionSet & need, ast::AssertionSet & have, ast::TypeEnvironment & env, FirstMode firstIsOpen ) {
    75                 ast::Pass< FindOpenVars_new > finder{ open, closed, need, have, env, firstIsOpen };
     75                ast::Pass< FindOpenVars > finder{ open, closed, need, have, env, firstIsOpen };
    7676                type->accept( finder );
    7777
  • src/ResolvExpr/PolyCost.cc

    r25f2798 r0bd3faf  
    2121namespace ResolvExpr {
    2222
    23 // TODO: When the old PolyCost is torn out get rid of the _new suffix.
    24 class PolyCost_new {
     23class PolyCost {
    2524        const ast::SymbolTable &symtab;
    2625public:
     
    2827        const ast::TypeEnvironment &env_;
    2928
    30         PolyCost_new( const ast::SymbolTable & symtab, const ast::TypeEnvironment & env )
     29        PolyCost( const ast::SymbolTable & symtab, const ast::TypeEnvironment & env )
    3130        : symtab( symtab ), result( 0 ), env_( env ) {}
    3231
     
    4948        const ast::Type * type, const ast::SymbolTable & symtab, const ast::TypeEnvironment & env
    5049) {
    51         ast::Pass<PolyCost_new> costing( symtab, env );
     50        ast::Pass<PolyCost> costing( symtab, env );
    5251        type->accept( costing );
    5352        return (costing.core.result > 0) ? 1 : 0;
  • src/ResolvExpr/PolyCost.hpp

    r25f2798 r0bd3faf  
    1616#pragma once
    1717
    18 class Type;
    19 namespace SymTab {
    20     class Indexer;
    21 }
    2218namespace ast {
    2319    class SymbolTable;
     
    2824namespace ResolvExpr {
    2925
    30 class TypeEnvironment;
    31 
    32 int polyCost( Type * type,
    33         const TypeEnvironment & env, const SymTab::Indexer & indexer );
    3426int polyCost( const ast::Type * type,
    3527        const ast::SymbolTable & symtab, const ast::TypeEnvironment & env );
  • src/ResolvExpr/PtrsAssignable.cc

    r25f2798 r0bd3faf  
    2222namespace ResolvExpr {
    2323
    24 // TODO: Get rid of the `_new` suffix when the old version is removed.
    25 struct PtrsAssignable_new : public ast::WithShortCircuiting {
     24struct PtrsAssignable : public ast::WithShortCircuiting {
    2625        const ast::Type * dst;
    2726        const ast::TypeEnvironment & typeEnv;
    2827        int result;
    2928
    30         PtrsAssignable_new( const ast::Type * dst, const ast::TypeEnvironment & env ) :
     29        PtrsAssignable( const ast::Type * dst, const ast::TypeEnvironment & env ) :
    3130                dst( dst ), typeEnv( env ), result( 0 ) {}
    3231
    33         void previsit( Type * ) { visit_children = false; }
     32        void previsit( ast::Type * ) { visit_children = false; }
    3433
    3534        void postvisit( const ast::EnumInstType * ) {
     
    6362                return -1;
    6463        } else {
    65                 ast::Pass<PtrsAssignable_new> visitor( dst, env );
     64                ast::Pass<PtrsAssignable> visitor( dst, env );
    6665                src->accept( visitor );
    6766                return visitor.core.result;
  • src/ResolvExpr/PtrsAssignable.hpp

    r25f2798 r0bd3faf  
    1616#pragma once
    1717
    18 class Type;
    1918namespace ast {
    2019        class Type;
     
    2423namespace ResolvExpr {
    2524
    26 class TypeEnvironment;
    27 
    28 int ptrsAssignable( const Type * src, const Type * dest,
    29         const TypeEnvironment & env );
    3025int ptrsAssignable( const ast::Type * src, const ast::Type * dst,
    3126        const ast::TypeEnvironment & env );
  • src/ResolvExpr/PtrsCastable.cc

    r25f2798 r0bd3faf  
    5555        }
    5656
    57         class PtrsCastable_new : public ast::WithShortCircuiting {
     57        class PtrsCastable : public ast::WithShortCircuiting {
    5858                const ast::Type * dst;
    5959                const ast::TypeEnvironment & env;
     
    6262                int result;
    6363
    64                 PtrsCastable_new(
     64                PtrsCastable(
    6565                        const ast::Type * d, const ast::TypeEnvironment & e, const ast::SymbolTable & syms )
    6666                : dst( d ), env( e ), symtab( syms ), result( 0 ) {}
     
    149149                return objectCast( src, env, symtab );
    150150        } else {
    151                 return ast::Pass<PtrsCastable_new>::read( src, dst, env, symtab );
     151                return ast::Pass<PtrsCastable>::read( src, dst, env, symtab );
    152152        }
    153153}
  • src/ResolvExpr/PtrsCastable.hpp

    r25f2798 r0bd3faf  
    1616#pragma once
    1717
    18 class Type;
    19 namespace SymTab {
    20     class Indexer;
    21 }
    2218namespace ast {
    2319    class SymbolTable;
     
    2824namespace ResolvExpr {
    2925
    30 class TypeEnvironment;
    31 
    32 int ptrsCastable(
    33         const Type * src, const Type * dst,
    34         const TypeEnvironment & env, const SymTab::Indexer & indexer );
    3526int ptrsCastable(
    3627        const ast::Type * src, const ast::Type * dst,
  • src/ResolvExpr/RenameVars.cc

    r25f2798 r0bd3faf  
    101101        RenamingData renaming;
    102102
    103         struct RenameVars_new : public ast::PureVisitor /*: public ast::WithForallSubstitutor*/ {
     103        struct RenameVars final : public ast::PureVisitor /*: public ast::WithForallSubstitutor*/ {
    104104                RenameMode mode;
    105105
     
    132132
    133133const ast::Type * renameTyVars( const ast::Type * t, RenameMode mode, bool reset ) {
    134         ast::Pass<RenameVars_new> renamer;
     134        ast::Pass<RenameVars> renamer;
    135135        renamer.core.mode = mode;
    136136        if (mode == GEN_USAGE && reset) {
  • src/ResolvExpr/ResolveTypeof.cc

    r25f2798 r0bd3faf  
    3333
    3434namespace {
    35 struct ResolveTypeof_new : public ast::WithShortCircuiting {
     35struct ResolveTypeof : public ast::WithShortCircuiting {
    3636    const ResolveContext & context;
    3737
    38                 ResolveTypeof_new( const ResolveContext & context ) :
     38                ResolveTypeof( const ResolveContext & context ) :
    3939                        context( context ) {}
    4040
     
    7878
    7979const ast::Type * resolveTypeof( const ast::Type * type , const ResolveContext & context ) {
    80         ast::Pass< ResolveTypeof_new > mutator( context );
     80        ast::Pass< ResolveTypeof > mutator( context );
    8181        return type->accept( mutator );
    8282}
  • src/ResolvExpr/ResolveTypeof.h

    r25f2798 r0bd3faf  
    1616#pragma once
    1717
    18 class Type;
    19 namespace SymTab {
    20 class Indexer;
    21 }  // namespace SymTab
    2218namespace ast {
    2319        class Type;
     
    2824        struct ResolveContext;
    2925
    30         Type *resolveTypeof( Type*, const SymTab::Indexer &indexer );
    3126        const ast::Type * resolveTypeof( const ast::Type *, const ResolveContext & );
    3227        const ast::Type * fixArrayType( const ast::Type *, const ResolveContext & );
    3328        const ast::ObjectDecl * fixObjectType( const ast::ObjectDecl * decl , const ResolveContext & );
    34         const ast::ObjectDecl * fixObjectInit( const ast::ObjectDecl * decl , const ResolveContext &);
     29        const ast::ObjectDecl * fixObjectInit( const ast::ObjectDecl * decl , const ResolveContext & );
    3530} // namespace ResolvExpr
    3631
  • src/ResolvExpr/Resolver.cc

    r25f2798 r0bd3faf  
    6262        namespace {
    6363                /// Finds deleted expressions in an expression tree
    64                 struct DeleteFinder_new final : public ast::WithShortCircuiting, public ast::WithVisitorRef<DeleteFinder_new> {
     64                struct DeleteFinder final : public ast::WithShortCircuiting, public ast::WithVisitorRef<DeleteFinder> {
    6565                        const ast::DeletedExpr * result = nullptr;
    6666
     
    8080                };
    8181
    82                 struct ResolveDesignators_new final : public ast::WithShortCircuiting {
     82                struct ResolveDesignators final : public ast::WithShortCircuiting {
    8383                        ResolveContext& context;
    8484                        bool result = false;
    8585
    86                         ResolveDesignators_new( ResolveContext& _context ): context{_context} {};
     86                        ResolveDesignators( ResolveContext& _context ): context{_context} {};
    8787
    8888                        void previsit( const ast::Node * ) {
     
    113113        /// Check if this expression is or includes a deleted expression
    114114        const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr ) {
    115                 return ast::Pass<DeleteFinder_new>::read( expr );
     115                return ast::Pass<DeleteFinder>::read( expr );
    116116        }
    117117
     
    203203
    204204                /// Strips extraneous casts out of an expression
    205                 struct StripCasts_new final {
     205                struct StripCasts final {
    206206                        const ast::Expr * postvisit( const ast::CastExpr * castExpr ) {
    207207                                if (
     
    217217
    218218                        static void strip( ast::ptr< ast::Expr > & expr ) {
    219                                 ast::Pass< StripCasts_new > stripper;
     219                                ast::Pass< StripCasts > stripper;
    220220                                expr = expr->accept( stripper );
    221221                        }
     
    251251                        expr.get_and_mutate()->env = std::move( newenv );
    252252                        // remove unncecessary casts
    253                         StripCasts_new::strip( expr );
     253                        StripCasts::strip( expr );
    254254                }
    255255
     
    368368        }
    369369
    370         class Resolver_new final
     370        class Resolver final
    371371        : public ast::WithSymbolTable, public ast::WithGuards,
    372           public ast::WithVisitorRef<Resolver_new>, public ast::WithShortCircuiting,
     372          public ast::WithVisitorRef<Resolver>, public ast::WithShortCircuiting,
    373373          public ast::WithStmtsToAdd<> {
    374374
     
    376376                ast::CurrentObject currentObject;
    377377                // for work previously in GenInit
    378                 static InitTweak::ManagedTypes_new managedTypes;
     378                static InitTweak::ManagedTypes managedTypes;
    379379                ResolveContext context;
    380380
     
    383383        public:
    384384                static size_t traceId;
    385                 Resolver_new( const ast::TranslationGlobal & global ) :
     385                Resolver( const ast::TranslationGlobal & global ) :
    386386                        ast::WithSymbolTable(ast::SymbolTable::ErrorDetection::ValidateOnAdd),
    387387                        context{ symtab, global } {}
    388                 Resolver_new( const ResolveContext & context ) :
     388                Resolver( const ResolveContext & context ) :
    389389                        ast::WithSymbolTable{ context.symtab },
    390390                        context{ symtab, context.global } {}
     
    427427                bool on_error(ast::ptr<ast::Decl> & decl);
    428428        };
    429         // size_t Resolver_new::traceId = Stats::Heap::new_stacktrace_id("Resolver");
    430 
    431         InitTweak::ManagedTypes_new Resolver_new::managedTypes;
     429        // size_t Resolver::traceId = Stats::Heap::new_stacktrace_id("Resolver");
     430
     431        InitTweak::ManagedTypes Resolver::managedTypes;
    432432
    433433        void resolve( ast::TranslationUnit& translationUnit ) {
    434                 ast::Pass< Resolver_new >::run( translationUnit, translationUnit.global );
     434                ast::Pass< Resolver >::run( translationUnit, translationUnit.global );
    435435        }
    436436
     
    439439        ) {
    440440                assert( ctorInit );
    441                 ast::Pass< Resolver_new > resolver( context );
     441                ast::Pass< Resolver > resolver( context );
    442442                return ctorInit->accept( resolver );
    443443        }
     
    447447        ) {
    448448                assert( stmtExpr );
    449                 ast::Pass< Resolver_new > resolver( context );
     449                ast::Pass< Resolver > resolver( context );
    450450                auto ret = mutate(stmtExpr->accept(resolver));
    451451                strict_dynamic_cast< ast::StmtExpr * >( ret )->computeResult();
     
    489489        }
    490490
    491         const ast::FunctionDecl * Resolver_new::previsit( const ast::FunctionDecl * functionDecl ) {
     491        const ast::FunctionDecl * Resolver::previsit( const ast::FunctionDecl * functionDecl ) {
    492492                GuardValue( functionReturn );
    493493
     
    563563        }
    564564
    565         const ast::FunctionDecl * Resolver_new::postvisit( const ast::FunctionDecl * functionDecl ) {
     565        const ast::FunctionDecl * Resolver::postvisit( const ast::FunctionDecl * functionDecl ) {
    566566                // default value expressions have an environment which shouldn't be there and trips up
    567567                // later passes.
     
    591591        }
    592592
    593         const ast::ObjectDecl * Resolver_new::previsit( const ast::ObjectDecl * objectDecl ) {
     593        const ast::ObjectDecl * Resolver::previsit( const ast::ObjectDecl * objectDecl ) {
    594594                // To handle initialization of routine pointers [e.g. int (*fp)(int) = foo()],
    595595                // class-variable `initContext` is changed multiple times because the LHS is analyzed
     
    630630                                        // constructed objects cannot be designated
    631631                                        if ( InitTweak::isDesignated( mutDecl->init ) ) {
    632                                                 ast::Pass<ResolveDesignators_new> res( context );
     632                                                ast::Pass<ResolveDesignators> res( context );
    633633                                                maybe_accept( mutDecl->init.get(), res );
    634634                                                if ( !res.core.result ) {
     
    650650        }
    651651
    652         void Resolver_new::previsit( const ast::AggregateDecl * _aggDecl ) {
     652        void Resolver::previsit( const ast::AggregateDecl * _aggDecl ) {
    653653                auto aggDecl = mutate(_aggDecl);
    654654                assertf(aggDecl == _aggDecl, "type declarations must be unique");
     
    662662        }
    663663
    664         void Resolver_new::previsit( const ast::StructDecl * structDecl ) {
     664        void Resolver::previsit( const ast::StructDecl * structDecl ) {
    665665                previsit(static_cast<const ast::AggregateDecl *>(structDecl));
    666666                managedTypes.handleStruct(structDecl);
    667667        }
    668668
    669         void Resolver_new::previsit( const ast::EnumDecl * ) {
     669        void Resolver::previsit( const ast::EnumDecl * ) {
    670670                // in case we decide to allow nested enums
    671671                GuardValue( inEnumDecl );
     
    674674        }
    675675
    676         const ast::StaticAssertDecl * Resolver_new::previsit(
     676        const ast::StaticAssertDecl * Resolver::previsit(
    677677                const ast::StaticAssertDecl * assertDecl
    678678        ) {
     
    694694        }
    695695
    696         const ast::ArrayType * Resolver_new::previsit( const ast::ArrayType * at ) {
     696        const ast::ArrayType * Resolver::previsit( const ast::ArrayType * at ) {
    697697                return handlePtrType( at, context );
    698698        }
    699699
    700         const ast::PointerType * Resolver_new::previsit( const ast::PointerType * pt ) {
     700        const ast::PointerType * Resolver::previsit( const ast::PointerType * pt ) {
    701701                return handlePtrType( pt, context );
    702702        }
    703703
    704         const ast::ExprStmt * Resolver_new::previsit( const ast::ExprStmt * exprStmt ) {
     704        const ast::ExprStmt * Resolver::previsit( const ast::ExprStmt * exprStmt ) {
    705705                visit_children = false;
    706706                assertf( exprStmt->expr, "ExprStmt has null expression in resolver" );
     
    710710        }
    711711
    712         const ast::AsmExpr * Resolver_new::previsit( const ast::AsmExpr * asmExpr ) {
     712        const ast::AsmExpr * Resolver::previsit( const ast::AsmExpr * asmExpr ) {
    713713                visit_children = false;
    714714
     
    719719        }
    720720
    721         const ast::AsmStmt * Resolver_new::previsit( const ast::AsmStmt * asmStmt ) {
     721        const ast::AsmStmt * Resolver::previsit( const ast::AsmStmt * asmStmt ) {
    722722                visitor->maybe_accept( asmStmt, &ast::AsmStmt::input );
    723723                visitor->maybe_accept( asmStmt, &ast::AsmStmt::output );
     
    726726        }
    727727
    728         const ast::IfStmt * Resolver_new::previsit( const ast::IfStmt * ifStmt ) {
     728        const ast::IfStmt * Resolver::previsit( const ast::IfStmt * ifStmt ) {
    729729                return ast::mutate_field(
    730730                        ifStmt, &ast::IfStmt::cond, findIntegralExpression( ifStmt->cond, context ) );
    731731        }
    732732
    733         const ast::WhileDoStmt * Resolver_new::previsit( const ast::WhileDoStmt * whileDoStmt ) {
     733        const ast::WhileDoStmt * Resolver::previsit( const ast::WhileDoStmt * whileDoStmt ) {
    734734                return ast::mutate_field(
    735735                        whileDoStmt, &ast::WhileDoStmt::cond, findIntegralExpression( whileDoStmt->cond, context ) );
    736736        }
    737737
    738         const ast::ForStmt * Resolver_new::previsit( const ast::ForStmt * forStmt ) {
     738        const ast::ForStmt * Resolver::previsit( const ast::ForStmt * forStmt ) {
    739739                if ( forStmt->cond ) {
    740740                        forStmt = ast::mutate_field(
     
    750750        }
    751751
    752         const ast::SwitchStmt * Resolver_new::previsit( const ast::SwitchStmt * switchStmt ) {
     752        const ast::SwitchStmt * Resolver::previsit( const ast::SwitchStmt * switchStmt ) {
    753753                GuardValue( currentObject );
    754754                switchStmt = ast::mutate_field(
     
    759759        }
    760760
    761         const ast::CaseClause * Resolver_new::previsit( const ast::CaseClause * caseStmt ) {
     761        const ast::CaseClause * Resolver::previsit( const ast::CaseClause * caseStmt ) {
    762762                if ( caseStmt->cond ) {
    763763                        std::deque< ast::InitAlternative > initAlts = currentObject.getOptions();
     
    780780        }
    781781
    782         const ast::BranchStmt * Resolver_new::previsit( const ast::BranchStmt * branchStmt ) {
     782        const ast::BranchStmt * Resolver::previsit( const ast::BranchStmt * branchStmt ) {
    783783                visit_children = false;
    784784                // must resolve the argument of a computed goto
     
    793793        }
    794794
    795         const ast::ReturnStmt * Resolver_new::previsit( const ast::ReturnStmt * returnStmt ) {
     795        const ast::ReturnStmt * Resolver::previsit( const ast::ReturnStmt * returnStmt ) {
    796796                visit_children = false;
    797797                if ( returnStmt->expr ) {
     
    803803        }
    804804
    805         const ast::ThrowStmt * Resolver_new::previsit( const ast::ThrowStmt * throwStmt ) {
     805        const ast::ThrowStmt * Resolver::previsit( const ast::ThrowStmt * throwStmt ) {
    806806                visit_children = false;
    807807                if ( throwStmt->expr ) {
     
    818818        }
    819819
    820         const ast::CatchClause * Resolver_new::previsit( const ast::CatchClause * catchClause ) {
     820        const ast::CatchClause * Resolver::previsit( const ast::CatchClause * catchClause ) {
    821821                // Until we are very sure this invarent (ifs that move between passes have then)
    822822                // holds, check it. This allows a check for when to decode the mangling.
     
    834834        }
    835835
    836         const ast::CatchClause * Resolver_new::postvisit( const ast::CatchClause * catchClause ) {
     836        const ast::CatchClause * Resolver::postvisit( const ast::CatchClause * catchClause ) {
    837837                // Decode the catchStmt so everything is stored properly.
    838838                const ast::IfStmt * ifStmt = catchClause->body.as<ast::IfStmt>();
     
    849849        }
    850850
    851         const ast::WaitForStmt * Resolver_new::previsit( const ast::WaitForStmt * stmt ) {
     851        const ast::WaitForStmt * Resolver::previsit( const ast::WaitForStmt * stmt ) {
    852852                visit_children = false;
    853853
     
    11141114        }
    11151115
    1116         const ast::WithStmt * Resolver_new::previsit( const ast::WithStmt * withStmt ) {
     1116        const ast::WithStmt * Resolver::previsit( const ast::WithStmt * withStmt ) {
    11171117                auto mutStmt = mutate(withStmt);
    11181118                resolveWithExprs(mutStmt->exprs, stmtsToAddBefore);
     
    11201120        }
    11211121
    1122         void Resolver_new::resolveWithExprs(std::vector<ast::ptr<ast::Expr>> & exprs, std::list<ast::ptr<ast::Stmt>> & stmtsToAdd) {
     1122        void Resolver::resolveWithExprs(std::vector<ast::ptr<ast::Expr>> & exprs, std::list<ast::ptr<ast::Stmt>> & stmtsToAdd) {
    11231123                for (auto & expr : exprs) {
    11241124                        // only struct- and union-typed expressions are viable candidates
     
    11461146
    11471147
    1148         const ast::SingleInit * Resolver_new::previsit( const ast::SingleInit * singleInit ) {
     1148        const ast::SingleInit * Resolver::previsit( const ast::SingleInit * singleInit ) {
    11491149                visit_children = false;
    11501150                // resolve initialization using the possibilities as determined by the `currentObject`
     
    11951195        }
    11961196
    1197         const ast::ListInit * Resolver_new::previsit( const ast::ListInit * listInit ) {
     1197        const ast::ListInit * Resolver::previsit( const ast::ListInit * listInit ) {
    11981198                // move cursor into brace-enclosed initializer-list
    11991199                currentObject.enterListInit( listInit->location );
     
    12181218        }
    12191219
    1220         const ast::ConstructorInit * Resolver_new::previsit( const ast::ConstructorInit * ctorInit ) {
     1220        const ast::ConstructorInit * Resolver::previsit( const ast::ConstructorInit * ctorInit ) {
    12211221                visitor->maybe_accept( ctorInit, &ast::ConstructorInit::ctor );
    12221222                visitor->maybe_accept( ctorInit, &ast::ConstructorInit::dtor );
     
    12401240
    12411241        // suppress error on autogen functions and mark invalid autogen as deleted.
    1242         bool Resolver_new::on_error(ast::ptr<ast::Decl> & decl) {
     1242        bool Resolver::on_error(ast::ptr<ast::Decl> & decl) {
    12431243                if (auto functionDecl = decl.as<ast::FunctionDecl>()) {
    12441244                        // xxx - can intrinsic gen ever fail?
  • src/ResolvExpr/Resolver.h

    r25f2798 r0bd3faf  
    1616#pragma once
    1717
    18 #include <list>          // for list
    19 
    2018#include "AST/Node.hpp"  // for ptr
    21 
    22 class ConstructorInit;
    23 class Declaration;
    24 class Expression;
    25 class DeletedExpr;
    26 class StmtExpr;
    27 class Type;
    28 namespace SymTab {
    29         class Indexer;
    30 } // namespace SymTab
    3119
    3220namespace ast {
     
    4533
    4634namespace ResolvExpr {
    47         /// Checks types and binds syntactic constructs to typed representations
    48         void resolve( std::list< Declaration * > translationUnit );
    49         void resolveDecl( Declaration *, const SymTab::Indexer & indexer );
    50         Expression *resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer );
    51         void findVoidExpression( Expression *& untyped, const SymTab::Indexer & indexer );
    52         void findSingleExpression( Expression *& untyped, const SymTab::Indexer & indexer );
    53         void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer & indexer );
    54         void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer );
    55         void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer );
    56         /// Searches expr and returns the first DeletedExpr found, otherwise nullptr
    57         DeletedExpr * findDeletedExpr( Expression * expr );
    58         /// Resolves with-stmts and with-clauses on functions
    59         void resolveWithExprs( std::list< Declaration * > & translationUnit );
    6035
    6136        /// Helper Type: Passes around information between various sub-calls.
  • src/ResolvExpr/SpecCost.cc

    r25f2798 r0bd3faf  
    7676
    7777        public:
    78                 int get_count() const { return 0 <= count ? count : 0; }
     78                int result() const { return 0 <= count ? count : 0; }
    7979
    8080                // Mark specialization of base type.
     
    125125                return 0;
    126126        }
    127         ast::Pass<SpecCounter> counter;
    128         type->accept( counter );
    129         return counter.core.get_count();
     127        return ast::Pass<SpecCounter>::read( type );
    130128}
    131129
  • src/ResolvExpr/Unify.cc

    r25f2798 r0bd3faf  
    105105                /// If this isn't done when satifying ttype assertions, then argument lists can have
    106106                /// different size and structure when they should be compatible.
    107                 struct TtypeExpander_new : public ast::WithShortCircuiting, public ast::PureVisitor {
     107                struct TtypeExpander : public ast::WithShortCircuiting, public ast::PureVisitor {
    108108                        ast::TypeEnvironment & tenv;
    109109
    110                         TtypeExpander_new( ast::TypeEnvironment & env ) : tenv( env ) {}
     110                        TtypeExpander( ast::TypeEnvironment & env ) : tenv( env ) {}
    111111
    112112                        const ast::Type * postvisit( const ast::TypeInstType * typeInst ) {
     
    128128                dst.reserve( src.size() );
    129129                for ( const auto & d : src ) {
    130                         ast::Pass<TtypeExpander_new> expander{ env };
     130                        ast::Pass<TtypeExpander> expander{ env };
    131131                        // TtypeExpander pass is impure (may mutate nodes in place)
    132132                        // need to make nodes shared to prevent accidental mutation
     
    268268        }
    269269
    270         class Unify_new final : public ast::WithShortCircuiting {
     270        class Unify final : public ast::WithShortCircuiting {
    271271                const ast::Type * type2;
    272272                ast::TypeEnvironment & tenv;
     
    279279                bool result;
    280280
    281                 Unify_new(
     281                Unify(
    282282                        const ast::Type * type2, ast::TypeEnvironment & env, ast::AssertionSet & need,
    283283                        ast::AssertionSet & have, const ast::OpenVarSet & open, WidenMode widen )
     
    606606                        if ( ! tuple2 ) return;
    607607
    608                         ast::Pass<TtypeExpander_new> expander{ tenv };
     608                        ast::Pass<TtypeExpander> expander{ tenv };
    609609
    610610                        const ast::Type * flat = tuple->accept( expander );
     
    634634        };
    635635
    636         // size_t Unify_new::traceId = Stats::Heap::new_stacktrace_id("Unify_new");
     636        // size_t Unify::traceId = Stats::Heap::new_stacktrace_id("Unify");
     637
    637638        bool unify(
    638639                        const ast::ptr<ast::Type> & type1, const ast::ptr<ast::Type> & type2,
     
    678679                        return env.bindVar( var2, type1, ast::TypeData{var2->base}, need, have, open, widen );
    679680                } else {
    680                         return ast::Pass<Unify_new>::read(
     681                        return ast::Pass<Unify>::read(
    681682                                type1, type2, env, need, have, open, widen );
    682683                }
  • src/ResolvExpr/typeops.h

    r25f2798 r0bd3faf  
    1919
    2020#include "AST/Type.hpp"
    21 
    22 namespace SymTab {
    23         class Indexer;
    24 }
    2521
    2622namespace ResolvExpr {
  • src/SymTab/FixFunction.cc

    r25f2798 r0bd3faf  
    2626
    2727namespace {
    28         struct FixFunction_new final : public ast::WithShortCircuiting {
     28        struct FixFunction final : public ast::WithShortCircuiting {
    2929                bool isVoid = false;
    3030
     
    7070
    7171const ast::DeclWithType * fixFunction( const ast::DeclWithType * dwt, bool & isVoid ) {
    72         ast::Pass< FixFunction_new > fixer;
     72        ast::Pass< FixFunction > fixer;
    7373        dwt = dwt->accept( fixer );
    7474        isVoid |= fixer.core.isVoid;
     
    7777
    7878const ast::Type * fixFunction( const ast::Type * type, bool & isVoid ) {
    79         ast::Pass< FixFunction_new > fixer;
     79        ast::Pass< FixFunction > fixer;
    8080        type = type->accept( fixer );
    8181        isVoid |= fixer.core.isVoid;
  • src/SymTab/GenImplicitCall.cpp

    r25f2798 r0bd3faf  
    3232template< typename OutIter >
    3333ast::ptr< ast::Stmt > genCall(
    34         InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam,
     34        InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
    3535        const CodeLocation & loc, const std::string & fname, OutIter && out,
    3636        const ast::Type * type, const ast::Type * addCast, LoopDirection forward = LoopForward );
     
    4242template< typename OutIter >
    4343ast::ptr< ast::Stmt > genScalarCall(
    44         InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam,
     44        InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
    4545        const CodeLocation & loc, std::string fname, OutIter && out, const ast::Type * type,
    4646        const ast::Type * addCast = nullptr
     
    9898template< typename OutIter >
    9999void genArrayCall(
    100         InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam,
     100        InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
    101101        const CodeLocation & loc, const std::string & fname, OutIter && out,
    102102        const ast::ArrayType * array, const ast::Type * addCast = nullptr,
     
    167167template< typename OutIter >
    168168ast::ptr< ast::Stmt > genCall(
    169         InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam,
     169        InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
    170170        const CodeLocation & loc, const std::string & fname, OutIter && out,
    171171        const ast::Type * type, const ast::Type * addCast, LoopDirection forward
     
    185185
    186186ast::ptr< ast::Stmt > genImplicitCall(
    187         InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam,
     187        InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
    188188        const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * obj,
    189189        LoopDirection forward
  • src/SymTab/GenImplicitCall.hpp

    r25f2798 r0bd3faf  
    2626/// dstParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
    2727ast::ptr<ast::Stmt> genImplicitCall(
    28         InitTweak::InitExpander_new & srcParam, const ast::Expr * dstParam,
     28        InitTweak::InitExpander & srcParam, const ast::Expr * dstParam,
    2929        const CodeLocation & loc, const std::string & fname, const ast::ObjectDecl * obj,
    3030        LoopDirection forward = LoopForward
  • src/SymTab/Mangler.cc

    r25f2798 r0bd3faf  
    3030        namespace {
    3131                /// Mangles names to a unique C identifier
    32                 struct Mangler_new : public ast::WithShortCircuiting, public ast::WithVisitorRef<Mangler_new>, public ast::WithGuards {
    33                         Mangler_new( Mangle::Mode mode );
    34                         Mangler_new( const Mangler_new & ) = delete;
     32                struct Mangler : public ast::WithShortCircuiting, public ast::WithVisitorRef<Mangler>, public ast::WithGuards {
     33                        Mangler( Mangle::Mode mode );
     34                        Mangler( const Mangler & ) = delete;
    3535
    3636                        void previsit( const ast::Node * ) { visit_children = false; }
     
    7272
    7373                  private:
    74                         Mangler_new( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
     74                        Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
    7575                                int nextVarNum, const VarMapType& varNums );
    76                         friend class ast::Pass<Mangler_new>;
     76                        friend class ast::Pass<Mangler>;
    7777
    7878                  private:
     
    8181
    8282                        void printQualifiers( const ast::Type *type );
    83                 }; // Mangler_new
     83                }; // Mangler
    8484        } // namespace
    8585
    8686        std::string mangle( const ast::Node * decl, Mangle::Mode mode ) {
    87                 return ast::Pass<Mangler_new>::read( decl, mode );
     87                return ast::Pass<Mangler>::read( decl, mode );
    8888        }
    8989
    9090        namespace {
    91                 Mangler_new::Mangler_new( Mangle::Mode mode )
     91                Mangler::Mangler( Mangle::Mode mode )
    9292                        : nextVarNum( 0 ), isTopLevel( true ),
    9393                        mangleOverridable  ( ! mode.no_overrideable   ),
     
    9595                        mangleGenericParams( ! mode.no_generic_params ) {}
    9696
    97                 Mangler_new::Mangler_new( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
     97                Mangler::Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams,
    9898                        int nextVarNum, const VarMapType& varNums )
    9999                        : varNums( varNums ), nextVarNum( nextVarNum ), isTopLevel( false ),
     
    101101                        mangleGenericParams( mangleGenericParams ) {}
    102102
    103                 void Mangler_new::mangleDecl( const ast::DeclWithType * decl ) {
     103                void Mangler::mangleDecl( const ast::DeclWithType * decl ) {
    104104                        bool wasTopLevel = isTopLevel;
    105105                        if ( isTopLevel ) {
     
    131131                }
    132132
    133                 void Mangler_new::postvisit( const ast::ObjectDecl * decl ) {
     133                void Mangler::postvisit( const ast::ObjectDecl * decl ) {
    134134                        mangleDecl( decl );
    135135                }
    136136
    137                 void Mangler_new::postvisit( const ast::FunctionDecl * decl ) {
     137                void Mangler::postvisit( const ast::FunctionDecl * decl ) {
    138138                        mangleDecl( decl );
    139139                }
    140140
    141                 void Mangler_new::postvisit( const ast::VoidType * voidType ) {
     141                void Mangler::postvisit( const ast::VoidType * voidType ) {
    142142                        printQualifiers( voidType );
    143143                        mangleName += Encoding::void_t;
    144144                }
    145145
    146                 void Mangler_new::postvisit( const ast::BasicType * basicType ) {
     146                void Mangler::postvisit( const ast::BasicType * basicType ) {
    147147                        printQualifiers( basicType );
    148148                        assertf( basicType->kind < ast::BasicType::NUMBER_OF_BASIC_TYPES, "Unhandled basic type: %d", basicType->kind );
     
    150150                }
    151151
    152                 void Mangler_new::postvisit( const ast::PointerType * pointerType ) {
     152                void Mangler::postvisit( const ast::PointerType * pointerType ) {
    153153                        printQualifiers( pointerType );
    154154                        // mangle void (*f)() and void f() to the same name to prevent overloading on functions and function pointers
     
    157157                }
    158158
    159                 void Mangler_new::postvisit( const ast::ArrayType * arrayType ) {
     159                void Mangler::postvisit( const ast::ArrayType * arrayType ) {
    160160                        // TODO: encode dimension
    161161                        printQualifiers( arrayType );
     
    164164                }
    165165
    166                 void Mangler_new::postvisit( const ast::ReferenceType * refType ) {
     166                void Mangler::postvisit( const ast::ReferenceType * refType ) {
    167167                        // don't print prefix (e.g. 'R') for reference types so that references and non-references do not overload.
    168168                        // Further, do not print the qualifiers for a reference type (but do run printQualifers because of TypeDecls, etc.),
     
    174174                }
    175175
    176                 void Mangler_new::postvisit( const ast::FunctionType * functionType ) {
     176                void Mangler::postvisit( const ast::FunctionType * functionType ) {
    177177                        printQualifiers( functionType );
    178178                        mangleName += Encoding::function;
     
    189189                }
    190190
    191                 void Mangler_new::mangleRef(
     191                void Mangler::mangleRef(
    192192                                const ast::BaseInstType * refType, const std::string & prefix ) {
    193193                        printQualifiers( refType );
     
    206206                }
    207207
    208                 void Mangler_new::postvisit( const ast::StructInstType * aggregateUseType ) {
     208                void Mangler::postvisit( const ast::StructInstType * aggregateUseType ) {
    209209                        mangleRef( aggregateUseType, Encoding::struct_t );
    210210                }
    211211
    212                 void Mangler_new::postvisit( const ast::UnionInstType * aggregateUseType ) {
     212                void Mangler::postvisit( const ast::UnionInstType * aggregateUseType ) {
    213213                        mangleRef( aggregateUseType, Encoding::union_t );
    214214                }
    215215
    216                 void Mangler_new::postvisit( const ast::EnumInstType * aggregateUseType ) {
     216                void Mangler::postvisit( const ast::EnumInstType * aggregateUseType ) {
    217217                        mangleRef( aggregateUseType, Encoding::enum_t );
    218218                }
    219219
    220                 void Mangler_new::postvisit( const ast::TypeInstType * typeInst ) {
     220                void Mangler::postvisit( const ast::TypeInstType * typeInst ) {
    221221                        VarMapType::iterator varNum = varNums.find( typeInst->name );
    222222                        if ( varNum == varNums.end() ) {
     
    234234                }
    235235
    236                 void Mangler_new::postvisit( const ast::TraitInstType * inst ) {
     236                void Mangler::postvisit( const ast::TraitInstType * inst ) {
    237237                        printQualifiers( inst );
    238238                        mangleName += std::to_string( inst->name.size() ) + inst->name;
    239239                }
    240240
    241                 void Mangler_new::postvisit( const ast::TupleType * tupleType ) {
     241                void Mangler::postvisit( const ast::TupleType * tupleType ) {
    242242                        printQualifiers( tupleType );
    243243                        mangleName += Encoding::tuple + std::to_string( tupleType->types.size() );
     
    245245                }
    246246
    247                 void Mangler_new::postvisit( const ast::VarArgsType * varArgsType ) {
     247                void Mangler::postvisit( const ast::VarArgsType * varArgsType ) {
    248248                        printQualifiers( varArgsType );
    249249                        static const std::string vargs = "__builtin_va_list";
     
    251251                }
    252252
    253                 void Mangler_new::postvisit( const ast::ZeroType * ) {
     253                void Mangler::postvisit( const ast::ZeroType * ) {
    254254                        mangleName += Encoding::zero;
    255255                }
    256256
    257                 void Mangler_new::postvisit( const ast::OneType * ) {
     257                void Mangler::postvisit( const ast::OneType * ) {
    258258                        mangleName += Encoding::one;
    259259                }
    260260
    261                 void Mangler_new::postvisit( const ast::QualifiedType * qualType ) {
     261                void Mangler::postvisit( const ast::QualifiedType * qualType ) {
    262262                        bool inqual = inQualifiedType;
    263263                        if ( !inqual ) {
     
    275275                }
    276276
    277                 void Mangler_new::postvisit( const ast::TypeDecl * decl ) {
     277                void Mangler::postvisit( const ast::TypeDecl * decl ) {
    278278                        // TODO: is there any case where mangling a TypeDecl makes sense? If so, this code needs to be
    279279                        // fixed to ensure that two TypeDecls mangle to the same name when they are the same type and vice versa.
     
    281281                        // and the case has not yet come up in practice. Alternatively, if not then this code can be removed
    282282                        // aside from the assert false.
    283                         assertf(false, "Mangler_new should not visit typedecl: %s", toCString(decl));
     283                        assertf(false, "Mangler should not visit typedecl: %s", toCString(decl));
    284284                        assertf( decl->kind < ast::TypeDecl::Kind::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", decl->kind );
    285285                        mangleName += Encoding::typeVariables[ decl->kind ] + std::to_string( decl->name.length() ) + decl->name;
     
    293293                }
    294294
    295                 void Mangler_new::printQualifiers( const ast::Type * type ) {
     295                void Mangler::printQualifiers( const ast::Type * type ) {
    296296                        // skip if not including qualifiers
    297297                        if ( typeMode ) return;
     
    318318                                } // for
    319319                                for ( auto & assert : funcType->assertions ) {
    320                                         assertionNames.push_back( ast::Pass<Mangler_new>::read(
     320                                        assertionNames.push_back( ast::Pass<Mangler>::read(
    321321                                                assert->var.get(),
    322322                                                mangleOverridable, typeMode, mangleGenericParams, nextVarNum, varNums ) );
  • src/Tuples/TupleAssignment.cc

    r25f2798 r0bd3faf  
    6565
    6666        /// Dispatcher for tuple (multiple and mass) assignment operations
    67         class TupleAssignSpotter_new final {
     67        class TupleAssignSpotter final {
    6868                /// Actually finds tuple assignment operations, by subclass
    6969                struct Matcher {
    7070                        ResolvExpr::CandidateList lhs, rhs;
    71                         TupleAssignSpotter_new & spotter;
     71                        TupleAssignSpotter & spotter;
    7272                        CodeLocation location;
    7373                        ResolvExpr::Cost baseCost;
     
    8484
    8585                        Matcher(
    86                                 TupleAssignSpotter_new & s, const CodeLocation & loc,
     86                                TupleAssignSpotter & s, const CodeLocation & loc,
    8787                                const ResolvExpr::CandidateList & l, const ResolvExpr::CandidateList & r )
    8888                        : lhs( l ), rhs( r ), spotter( s ), location( loc ),
     
    161161                struct MassAssignMatcher final : public Matcher {
    162162                        MassAssignMatcher(
    163                                 TupleAssignSpotter_new & s, const CodeLocation & loc,
     163                                TupleAssignSpotter & s, const CodeLocation & loc,
    164164                                const ResolvExpr::CandidateList & l, const ResolvExpr::CandidateList & r )
    165165                        : Matcher( s, loc, l, r ) {}
     
    191191                struct MultipleAssignMatcher final : public Matcher {
    192192                        MultipleAssignMatcher(
    193                                 TupleAssignSpotter_new & s, const CodeLocation & loc,
     193                                TupleAssignSpotter & s, const CodeLocation & loc,
    194194                                const ResolvExpr::CandidateList & l, const ResolvExpr::CandidateList & r )
    195195                        : Matcher( s, loc, l, r ) {}
     
    240240
    241241        public:
    242                 TupleAssignSpotter_new( ResolvExpr::CandidateFinder & f )
     242                TupleAssignSpotter( ResolvExpr::CandidateFinder & f )
    243243                : crntFinder( f ), fname(), matcher() {}
    244244
     
    377377        std::vector< ResolvExpr::CandidateFinder > & args
    378378) {
    379         TupleAssignSpotter_new spotter{ finder };
     379        TupleAssignSpotter spotter{ finder };
    380380        spotter.spot( assign, args );
    381381}
  • src/Validate/Autogen.cpp

    r25f2798 r0bd3faf  
    4949
    5050// --------------------------------------------------------------------------
    51 struct AutogenerateRoutines_new final :
     51struct AutogenerateRoutines final :
    5252                public ast::WithDeclsToAdd<>,
    5353                public ast::WithShortCircuiting {
     
    232232
    233233// --------------------------------------------------------------------------
    234 void AutogenerateRoutines_new::previsit( const ast::EnumDecl * enumDecl ) {
     234void AutogenerateRoutines::previsit( const ast::EnumDecl * enumDecl ) {
    235235        // Must visit children (enum constants) to add them to the symbol table.
    236236        if ( !enumDecl->body ) return;
     
    249249}
    250250
    251 void AutogenerateRoutines_new::previsit( const ast::StructDecl * structDecl ) {
     251void AutogenerateRoutines::previsit( const ast::StructDecl * structDecl ) {
    252252        visit_children = false;
    253253        if ( !structDecl->body ) return;
     
    265265}
    266266
    267 void AutogenerateRoutines_new::previsit( const ast::UnionDecl * unionDecl ) {
     267void AutogenerateRoutines::previsit( const ast::UnionDecl * unionDecl ) {
    268268        visit_children = false;
    269269        if ( !unionDecl->body ) return;
     
    282282
    283283/// Generate ctor/dtors/assign for typedecls, e.g., otype T = int *;
    284 void AutogenerateRoutines_new::previsit( const ast::TypeDecl * typeDecl ) {
     284void AutogenerateRoutines::previsit( const ast::TypeDecl * typeDecl ) {
    285285        if ( !typeDecl->base ) return;
    286286
     
    290290}
    291291
    292 void AutogenerateRoutines_new::previsit( const ast::TraitDecl * ) {
     292void AutogenerateRoutines::previsit( const ast::TraitDecl * ) {
    293293        // Ensure that we don't add assignment ops for types defined as part of the trait
    294294        visit_children = false;
    295295}
    296296
    297 void AutogenerateRoutines_new::previsit( const ast::FunctionDecl * ) {
     297void AutogenerateRoutines::previsit( const ast::FunctionDecl * ) {
    298298        // Track whether we're currently in a function.
    299299        // Can ignore function type idiosyncrasies, because function type can never
     
    302302}
    303303
    304 void AutogenerateRoutines_new::postvisit( const ast::FunctionDecl * ) {
     304void AutogenerateRoutines::postvisit( const ast::FunctionDecl * ) {
    305305        functionNesting -= 1;
    306306}
     
    521521                const ast::Expr * src, const ast::ObjectDecl * field,
    522522                ast::FunctionDecl * func, SymTab::LoopDirection direction ) {
    523         InitTweak::InitExpander_new srcParam( src );
     523        InitTweak::InitExpander srcParam( src );
    524524        // Assign to destination.
    525525        ast::MemberExpr * dstSelect = new ast::MemberExpr(
     
    795795
    796796void autogenerateRoutines( ast::TranslationUnit & translationUnit ) {
    797         ast::Pass<AutogenerateRoutines_new>::run( translationUnit );
     797        ast::Pass<AutogenerateRoutines>::run( translationUnit );
    798798}
    799799
Note: See TracChangeset for help on using the changeset viewer.