Changeset f066321 for src/SymTab
- Timestamp:
- Nov 19, 2015, 11:12:38 AM (9 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
rba407ce rf066321 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:50:04 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : T ue Aug 11 16:59:35 201513 // Update Count : 19 611 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Nov 19 10:44:55 2015 13 // Update Count : 199 14 14 // 15 15 … … 126 126 }; 127 127 128 class A ddStructAssignment: public Visitor {128 class AutogenerateRoutines : public Visitor { 129 129 public: 130 130 /// Generates assignment operators for aggregate types as required 131 static void a ddStructAssignment( std::list< Declaration * > &translationUnit );131 static void autogenerateRoutines( std::list< Declaration * > &translationUnit ); 132 132 133 133 std::list< Declaration * > &get_declsToAdd() { return declsToAdd; } … … 152 152 virtual void visit( CatchStmt *catchStmt ); 153 153 154 A ddStructAssignment() : functionNesting( 0 ) {}154 AutogenerateRoutines() : functionNesting( 0 ) {} 155 155 private: 156 156 template< typename StmtClass > void visitStatement( StmtClass *stmt ); … … 196 196 acceptAll( translationUnit, pass1 ); 197 197 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 ); 201 199 acceptAll( translationUnit, pass3 ); 202 200 } … … 502 500 static const std::list< std::string > noLabels; 503 501 504 void A ddStructAssignment::addStructAssignment( std::list< Declaration * > &translationUnit ) {505 A ddStructAssignmentvisitor;502 void AutogenerateRoutines::autogenerateRoutines( std::list< Declaration * > &translationUnit ) { 503 AutogenerateRoutines visitor; 506 504 acceptAndAdd( translationUnit, visitor, false ); 507 505 } … … 699 697 } 700 698 701 void A ddStructAssignment::visit( EnumDecl *enumDecl ) {699 void AutogenerateRoutines::visit( EnumDecl *enumDecl ) { 702 700 if ( ! enumDecl->get_members().empty() ) { 703 701 EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() ); … … 708 706 } 709 707 710 void A ddStructAssignment::visit( StructDecl *structDecl ) {708 void AutogenerateRoutines::visit( StructDecl *structDecl ) { 711 709 if ( ! structDecl->get_members().empty() && structsDone.find( structDecl->get_name() ) == structsDone.end() ) { 712 710 StructInstType *structInst = new StructInstType( Type::Qualifiers(), structDecl->get_name() ); … … 717 715 } 718 716 719 void A ddStructAssignment::visit( UnionDecl *unionDecl ) {717 void AutogenerateRoutines::visit( UnionDecl *unionDecl ) { 720 718 if ( ! unionDecl->get_members().empty() ) { 721 719 UnionInstType *unionInst = new UnionInstType( Type::Qualifiers(), unionDecl->get_name() ); … … 725 723 } 726 724 727 void A ddStructAssignment::visit( TypeDecl *typeDecl ) {725 void AutogenerateRoutines::visit( TypeDecl *typeDecl ) { 728 726 CompoundStmt *stmts = 0; 729 727 TypeInstType *typeInst = new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), false ); … … 753 751 } 754 752 755 void A ddStructAssignment::visit( FunctionType *) {753 void AutogenerateRoutines::visit( FunctionType *) { 756 754 // ensure that we don't add assignment ops for types defined as part of the function 757 755 } 758 756 759 void A ddStructAssignment::visit( PointerType *) {757 void AutogenerateRoutines::visit( PointerType *) { 760 758 // ensure that we don't add assignment ops for types defined as part of the pointer 761 759 } 762 760 763 void A ddStructAssignment::visit( ContextDecl *) {761 void AutogenerateRoutines::visit( ContextDecl *) { 764 762 // ensure that we don't add assignment ops for types defined as part of the context 765 763 } 766 764 767 765 template< typename StmtClass > 768 inline void A ddStructAssignment::visitStatement( StmtClass *stmt ) {766 inline void AutogenerateRoutines::visitStatement( StmtClass *stmt ) { 769 767 std::set< std::string > oldStructs = structsDone; 770 768 addVisit( stmt, *this ); … … 772 770 } 773 771 774 void A ddStructAssignment::visit( FunctionDecl *functionDecl ) {772 void AutogenerateRoutines::visit( FunctionDecl *functionDecl ) { 775 773 maybeAccept( functionDecl->get_functionType(), *this ); 776 774 acceptAll( functionDecl->get_oldDecls(), *this ); … … 780 778 } 781 779 782 void A ddStructAssignment::visit( CompoundStmt *compoundStmt ) {780 void AutogenerateRoutines::visit( CompoundStmt *compoundStmt ) { 783 781 visitStatement( compoundStmt ); 784 782 } 785 783 786 void A ddStructAssignment::visit( IfStmt *ifStmt ) {784 void AutogenerateRoutines::visit( IfStmt *ifStmt ) { 787 785 visitStatement( ifStmt ); 788 786 } 789 787 790 void A ddStructAssignment::visit( WhileStmt *whileStmt ) {788 void AutogenerateRoutines::visit( WhileStmt *whileStmt ) { 791 789 visitStatement( whileStmt ); 792 790 } 793 791 794 void A ddStructAssignment::visit( ForStmt *forStmt ) {792 void AutogenerateRoutines::visit( ForStmt *forStmt ) { 795 793 visitStatement( forStmt ); 796 794 } 797 795 798 void A ddStructAssignment::visit( SwitchStmt *switchStmt ) {796 void AutogenerateRoutines::visit( SwitchStmt *switchStmt ) { 799 797 visitStatement( switchStmt ); 800 798 } 801 799 802 void A ddStructAssignment::visit( ChooseStmt *switchStmt ) {800 void AutogenerateRoutines::visit( ChooseStmt *switchStmt ) { 803 801 visitStatement( switchStmt ); 804 802 } 805 803 806 void A ddStructAssignment::visit( CaseStmt *caseStmt ) {804 void AutogenerateRoutines::visit( CaseStmt *caseStmt ) { 807 805 visitStatement( caseStmt ); 808 806 } 809 807 810 void A ddStructAssignment::visit( CatchStmt *cathStmt ) {808 void AutogenerateRoutines::visit( CatchStmt *cathStmt ) { 811 809 visitStatement( cathStmt ); 812 810 }
Note: See TracChangeset
for help on using the changeset viewer.