Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    ra4dd728 r597db97f  
    738738                                                stmtsToAddAfter.push_back( ifStmt );
    739739
    740                                                 Statement * dtor = ctorInit->get_dtor();
    741                                                 objDecl->set_init( NULL );
    742                                                 ctorInit->set_ctor( NULL );
    743                                                 ctorInit->set_dtor( nullptr );
    744                                                 if ( dtor ) {
     740                                                if ( ctorInit->get_dtor() ) {
    745741                                                        // if the object has a non-trivial destructor, have to
    746742                                                        // hoist it and the object into the global space and
    747743                                                        // call the destructor function with atexit.
    748744
    749                                                         Statement * dtorStmt = dtor->clone();
     745                                                        Statement * dtorStmt = ctorInit->get_dtor()->clone();
    750746
    751747                                                        // void __objName_dtor_atexitN(...) {...}
     
    776772                                                        objDecl->set_mangleName( SymTab::Mangler::mangle( objDecl ) );
    777773
     774                                                        objDecl->set_init( NULL );
     775                                                        ctorInit->set_ctor( NULL );
     776                                                        delete ctorInit;
     777
    778778                                                        // xxx - temporary hack: need to return a declaration, but want to hoist the current object out of this scope
    779779                                                        // create a new object which is never used
    780780                                                        static UniqueName dummyNamer( "_dummy" );
    781781                                                        ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } );
    782                                                         delete ctorInit;
    783782                                                        return dummy;
    784783                                                }
Note: See TracChangeset for help on using the changeset viewer.