Ignore:
Timestamp:
Nov 13, 2023, 1:40:12 PM (6 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.