Changeset 866545b for src/InitTweak


Ignore:
Timestamp:
Jun 6, 2019, 10:23:59 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
46438e4
Parents:
c6a1e8a (diff), 5684736 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    rc6a1e8a r866545b  
    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.