Changeset f203a7a for src


Ignore:
Timestamp:
Nov 22, 2017, 5:05:54 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, 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:
1ba5803
Parents:
83882e9
Message:

Simplify autogenerate and fix resolution problem with polymorphic type in struct definition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    r83882e9 rf203a7a  
    6262                void previsit( FunctionDecl * functionDecl );
    6363
    64                 void previsit( FunctionType * ftype );
    65                 void previsit( PointerType * ptype );
    66 
    6764                void previsit( CompoundStmt * compoundStmt );
    6865
     
    7269                unsigned int functionNesting = 0;     // current level of nested functions
    7370
    74                 InitTweak::ManagedTypes managedTypes;
    7571                std::vector< FuncData > data;
    7672        };
     
    622618        // generate ctor/dtors/assign for typedecls, e.g., otype T = int *;
    623619        void AutogenerateRoutines::previsit( TypeDecl * typeDecl ) {
    624                 visit_children = false;
    625620                if ( ! typeDecl->base ) return;
    626621
     
    628623                TypeFuncGenerator gen( typeDecl, &refType, data, functionNesting, indexer );
    629624                generateFunctions( gen, declsToAddAfter );
    630         }
    631 
    632         void AutogenerateRoutines::previsit( FunctionType *) {
    633                 // ensure that we don't add assignment ops for types defined as part of the function
    634                 visit_children = false;
    635         }
    636 
    637         void AutogenerateRoutines::previsit( PointerType *) {
    638                 // ensure that we don't add assignment ops for types defined as part of the pointer
    639                 visit_children = false;
     625
    640626        }
    641627
     
    645631        }
    646632
    647         void AutogenerateRoutines::previsit( FunctionDecl * functionDecl ) {
    648                 visit_children = false;
    649                 // record the existence of this function as appropriate
    650                 managedTypes.handleDWT( functionDecl );
    651 
    652                 maybeAccept( functionDecl->type, *visitor );
     633        void AutogenerateRoutines::previsit( FunctionDecl * ) {
     634                // Track whether we're currently in a function.
     635                // Can ignore function type idiosyncrasies, because function type can never
     636                // declare a new type.
    653637                functionNesting += 1;
    654                 maybeAccept( functionDecl->statements, *visitor );
    655                 functionNesting -= 1;
     638                GuardAction( [this]()  { functionNesting -= 1; } );
    656639        }
    657640
    658641        void AutogenerateRoutines::previsit( CompoundStmt * ) {
    659                 GuardScope( managedTypes );
    660642                GuardScope( structsDone );
    661643        }
Note: See TracChangeset for help on using the changeset viewer.