Changeset 9b4c936


Ignore:
Timestamp:
Aug 30, 2016, 11:46:37 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
8b6b552
Parents:
ad4581b
Message:

fixed memory leaks in init expander

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    rad4581b r9b4c936  
    7979        public:
    8080                ExprImpl( Expression * expr ) : arg( expr ) {}
     81
     82                ~ExprImpl() { delete arg; }
    8183
    8284                virtual std::list< Expression * > next( std::list< Expression * > & indices ) {
     
    122124
    123125        void InitExpander::clearArrayIndices() {
     126                deleteAll( indices );
    124127                indices.clear();
    125128        }
  • src/SymTab/Autogen.cc

    rad4581b r9b4c936  
    6464
    6565        template< typename OutputIterator >
    66         void makeUnionFieldsAssignment( ObjectDecl *srcParam, ObjectDecl *dstParam, UnionInstType *unionType, OutputIterator out ) {
     66        void makeUnionFieldsAssignment( ObjectDecl *srcParam, ObjectDecl *dstParam, OutputIterator out ) {
    6767                UntypedExpr *copy = new UntypedExpr( new NameExpr( "__builtin_memcpy" ) );
    6868                copy->get_args().push_back( new VariableExpr( dstParam ) );
     
    413413                dtorDecl->fixUniqueId();
    414414
    415                 makeUnionFieldsAssignment( srcParam, dstParam, cloneWithParams( refType, unionParams ), back_inserter( assignDecl->get_statements()->get_kids() ) );
    416                 if ( isDynamicLayout ) makeUnionFieldsAssignment( srcParam, returnVal, cloneWithParams( refType, unionParams ), back_inserter( assignDecl->get_statements()->get_kids() ) );
     415                makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( assignDecl->get_statements()->get_kids() ) );
     416                if ( isDynamicLayout ) makeUnionFieldsAssignment( srcParam, returnVal, back_inserter( assignDecl->get_statements()->get_kids() ) );
    417417                else assignDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    418418
     
    434434                                ctor->fixUniqueId();
    435435
    436                                 makeUnionFieldsAssignment( srcParam, dstParam, cloneWithParams( refType, unionParams ), back_inserter( ctor->get_statements()->get_kids() ) );
     436                                makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( ctor->get_statements()->get_kids() ) );
    437437                                memCtors.push_back( ctor );
    438438                                // only generate a ctor for the first field
Note: See TracChangeset for help on using the changeset viewer.