Changeset f066321 for src/SymTab


Ignore:
Timestamp:
Nov 19, 2015, 11:12:38 AM (9 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
63afee0
Parents:
ba407ce
Message:

changed AddStructAssignment? to AutogenerateRoutines?, update prelude header so it will be recompiled

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    rba407ce rf066321  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 21:50:04 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Aug 11 16:59:35 2015
    13 // Update Count     : 196
     11// Last Modified By : Rob Schluntz
     12// Last Modified On : Thu Nov 19 10:44:55 2015
     13// Update Count     : 199
    1414//
    1515
     
    126126        };
    127127
    128         class AddStructAssignment : public Visitor {
     128        class AutogenerateRoutines : public Visitor {
    129129          public:
    130130                /// Generates assignment operators for aggregate types as required
    131                 static void addStructAssignment( std::list< Declaration * > &translationUnit );
     131                static void autogenerateRoutines( std::list< Declaration * > &translationUnit );
    132132
    133133                std::list< Declaration * > &get_declsToAdd() { return declsToAdd; }
     
    152152                virtual void visit( CatchStmt *catchStmt );
    153153
    154                 AddStructAssignment() : functionNesting( 0 ) {}
     154                AutogenerateRoutines() : functionNesting( 0 ) {}
    155155          private:
    156156                template< typename StmtClass > void visitStatement( StmtClass *stmt );
     
    196196                acceptAll( translationUnit, pass1 );
    197197                acceptAll( translationUnit, pass2 );
    198                 // need to collect all of the assignment operators prior to
    199                 // this point and only generate assignment operators if one doesn't exist
    200                 AddStructAssignment::addStructAssignment( translationUnit );
     198                AutogenerateRoutines::autogenerateRoutines( translationUnit );
    201199                acceptAll( translationUnit, pass3 );
    202200        }
     
    502500        static const std::list< std::string > noLabels;
    503501
    504         void AddStructAssignment::addStructAssignment( std::list< Declaration * > &translationUnit ) {
    505                 AddStructAssignment visitor;
     502        void AutogenerateRoutines::autogenerateRoutines( std::list< Declaration * > &translationUnit ) {
     503                AutogenerateRoutines visitor;
    506504                acceptAndAdd( translationUnit, visitor, false );
    507505        }
     
    699697        }
    700698
    701         void AddStructAssignment::visit( EnumDecl *enumDecl ) {
     699        void AutogenerateRoutines::visit( EnumDecl *enumDecl ) {
    702700                if ( ! enumDecl->get_members().empty() ) {
    703701                        EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() );
     
    708706        }
    709707
    710         void AddStructAssignment::visit( StructDecl *structDecl ) {
     708        void AutogenerateRoutines::visit( StructDecl *structDecl ) {
    711709                if ( ! structDecl->get_members().empty() && structsDone.find( structDecl->get_name() ) == structsDone.end() ) {
    712710                        StructInstType *structInst = new StructInstType( Type::Qualifiers(), structDecl->get_name() );
     
    717715        }
    718716
    719         void AddStructAssignment::visit( UnionDecl *unionDecl ) {
     717        void AutogenerateRoutines::visit( UnionDecl *unionDecl ) {
    720718                if ( ! unionDecl->get_members().empty() ) {
    721719                        UnionInstType *unionInst = new UnionInstType( Type::Qualifiers(), unionDecl->get_name() );
     
    725723        }
    726724
    727         void AddStructAssignment::visit( TypeDecl *typeDecl ) {
     725        void AutogenerateRoutines::visit( TypeDecl *typeDecl ) {
    728726                CompoundStmt *stmts = 0;
    729727                TypeInstType *typeInst = new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), false );
     
    753751        }
    754752
    755         void AddStructAssignment::visit( FunctionType *) {
     753        void AutogenerateRoutines::visit( FunctionType *) {
    756754                // ensure that we don't add assignment ops for types defined as part of the function
    757755        }
    758756
    759         void AddStructAssignment::visit( PointerType *) {
     757        void AutogenerateRoutines::visit( PointerType *) {
    760758                // ensure that we don't add assignment ops for types defined as part of the pointer
    761759        }
    762760
    763         void AddStructAssignment::visit( ContextDecl *) {
     761        void AutogenerateRoutines::visit( ContextDecl *) {
    764762                // ensure that we don't add assignment ops for types defined as part of the context
    765763        }
    766764
    767765        template< typename StmtClass >
    768         inline void AddStructAssignment::visitStatement( StmtClass *stmt ) {
     766        inline void AutogenerateRoutines::visitStatement( StmtClass *stmt ) {
    769767                std::set< std::string > oldStructs = structsDone;
    770768                addVisit( stmt, *this );
     
    772770        }
    773771
    774         void AddStructAssignment::visit( FunctionDecl *functionDecl ) {
     772        void AutogenerateRoutines::visit( FunctionDecl *functionDecl ) {
    775773                maybeAccept( functionDecl->get_functionType(), *this );
    776774                acceptAll( functionDecl->get_oldDecls(), *this );
     
    780778        }
    781779
    782         void AddStructAssignment::visit( CompoundStmt *compoundStmt ) {
     780        void AutogenerateRoutines::visit( CompoundStmt *compoundStmt ) {
    783781                visitStatement( compoundStmt );
    784782        }
    785783
    786         void AddStructAssignment::visit( IfStmt *ifStmt ) {
     784        void AutogenerateRoutines::visit( IfStmt *ifStmt ) {
    787785                visitStatement( ifStmt );
    788786        }
    789787
    790         void AddStructAssignment::visit( WhileStmt *whileStmt ) {
     788        void AutogenerateRoutines::visit( WhileStmt *whileStmt ) {
    791789                visitStatement( whileStmt );
    792790        }
    793791
    794         void AddStructAssignment::visit( ForStmt *forStmt ) {
     792        void AutogenerateRoutines::visit( ForStmt *forStmt ) {
    795793                visitStatement( forStmt );
    796794        }
    797795
    798         void AddStructAssignment::visit( SwitchStmt *switchStmt ) {
     796        void AutogenerateRoutines::visit( SwitchStmt *switchStmt ) {
    799797                visitStatement( switchStmt );
    800798        }
    801799
    802         void AddStructAssignment::visit( ChooseStmt *switchStmt ) {
     800        void AutogenerateRoutines::visit( ChooseStmt *switchStmt ) {
    803801                visitStatement( switchStmt );
    804802        }
    805803
    806         void AddStructAssignment::visit( CaseStmt *caseStmt ) {
     804        void AutogenerateRoutines::visit( CaseStmt *caseStmt ) {
    807805                visitStatement( caseStmt );
    808806        }
    809807
    810         void AddStructAssignment::visit( CatchStmt *cathStmt ) {
     808        void AutogenerateRoutines::visit( CatchStmt *cathStmt ) {
    811809                visitStatement( cathStmt );
    812810        }
Note: See TracChangeset for help on using the changeset viewer.