Changeset bda58ad


Ignore:
Timestamp:
Aug 30, 2016, 4:02:53 PM (6 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, 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:
90e2334, e491159
Parents:
ced2e989
Message:

Fixed leaks and rename pass1 in validate phase

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    rced2e989 rbda58ad  
    8686
    8787        /// Replaces enum types by int, and function or array types in function parameter and return lists by appropriate pointers.
    88         class Pass1 : public Visitor {
     88        class EnumAndPointerDecayPass : public Visitor {
    8989                typedef Visitor Parent;
    9090                virtual void visit( EnumDecl *aggregateDecl );
     
    189189
    190190        void validate( std::list< Declaration * > &translationUnit, bool doDebug ) {
    191                 Pass1 pass1;
     191                EnumAndPointerDecayPass epc;
    192192                Pass2 pass2( doDebug, 0 );
    193193                Pass3 pass3( 0 );
     
    196196                EliminateTypedef::eliminateTypedef( translationUnit );
    197197                HoistStruct::hoistStruct( translationUnit );
    198                 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs Pass1
    199                 acceptAll( translationUnit, pass1 );
     198                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecayPass
     199                acceptAll( translationUnit, epc );
    200200                acceptAll( translationUnit, pass2 );
    201201                ReturnChecker::checkFunctionReturns( translationUnit );
     
    206206
    207207        void validateType( Type *type, const Indexer *indexer ) {
    208                 Pass1 pass1;
     208                EnumAndPointerDecayPass epc;
    209209                Pass2 pass2( false, indexer );
    210210                Pass3 pass3( indexer );
    211                 type->accept( pass1 );
     211                type->accept( epc );
    212212                type->accept( pass2 );
    213213                type->accept( pass3 );
     
    272272        }
    273273
    274         void Pass1::visit( EnumDecl *enumDecl ) {
     274        void EnumAndPointerDecayPass::visit( EnumDecl *enumDecl ) {
    275275                // Set the type of each member of the enumeration to be EnumConstant
    276276                for ( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) {
     
    296296                                DWTIterator j = i;
    297297                                ++i;
     298                                delete *j;
    298299                                dwts.erase( j );
    299300                                if ( i != end ) {
     
    313314        }
    314315
    315         void Pass1::visit( FunctionType *func ) {
     316        void EnumAndPointerDecayPass::visit( FunctionType *func ) {
    316317                // Fix up parameters and return types
    317318                fixFunctionList( func->get_parameters(), func );
Note: See TracChangeset for help on using the changeset viewer.