Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r4741dfe rf46bfd2f  
    262262                        // unwrap implicit statement wrapper
    263263                        Statement * dtor = input;
    264                         if ( ImplicitCtorDtorStmt * implicit = dynamic_cast< ImplicitCtorDtorStmt * >( input ) ) {
    265                                 // dtor = implicit->callStmt;
    266                                 // implicit->callStmt = nullptr;
    267                         }
    268264                        assert( dtor );
    269265                        std::list< Expression * > matches;
     
    291287                        // wraps the more complicated code.
    292288                        static UniqueName dtorNamer( "__cleanup_dtor" );
    293                         FunctionDecl * dtorFunc = FunctionDecl::newFunction( dtorNamer.newName(), SymTab::genDefaultType( objDecl->type->stripReferences(), false ), new CompoundStmt() );
     289                        std::string name = dtorNamer.newName();
     290                        FunctionDecl * dtorFunc = FunctionDecl::newFunction( name, SymTab::genDefaultType( objDecl->type->stripReferences(), false ), new CompoundStmt() );
    294291                        stmtsToAdd.push_back( new DeclStmt( dtorFunc ) );
    295292
     
    304301                                replacement = new CastExpr( replacement, base->clone() );
    305302                        }
    306                         DeclReplacer::replace( dtor, { std::make_pair( objDecl, replacement ) } );
     303                        size_t replaced = DeclReplacer::replace( dtor, { std::make_pair( objDecl, replacement ) } );
     304                        if(replaced == 0) {
     305                                objDecl->print(std::cerr);
     306                                std::cerr << "-----" << std::endl;
     307                                dtor->print(std::cerr);
     308                                std::cerr << "Failed to replace " << objDecl << std::endl;
     309                                abort();
     310                        }
    307311                        dtorFunc->statements->push_back( strict_dynamic_cast<Statement *>( dtor ) );
    308312
Note: See TracChangeset for help on using the changeset viewer.