Changeset c0aa336 for src/SymTab/Autogen.cc
- Timestamp:
- Feb 6, 2017, 4:19:41 PM (8 years ago)
- 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:
- b4d65c7
- Parents:
- a362f97
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.cc
ra362f97 rc0aa336 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jul 12 17:47:17 201613 // Update Count : 212 // Last Modified On : Thu Feb 2 18:04:40 2017 13 // Update Count : 11 14 14 // 15 15 … … 43 43 44 44 class AutogenerateRoutines final : public Visitor { 45 template< typename Visitor > 46 friend void acceptAndAdd( std::list< Declaration * > &translationUnit, Visitor &visitor ); 47 template< typename Visitor > 48 friend void addVisitStatementList( std::list< Statement* > &stmts, Visitor &visitor ); 45 49 public: 46 50 std::list< Declaration * > &get_declsToAdd() { return declsToAdd; } … … 67 71 template< typename StmtClass > void visitStatement( StmtClass *stmt ); 68 72 69 std::list< Declaration * > declsToAdd ;73 std::list< Declaration * > declsToAdd, declsToAddAfter; 70 74 std::set< std::string > structsDone; 71 75 unsigned int functionNesting = 0; // current level of nested functions … … 98 102 void autogenerateRoutines( std::list< Declaration * > &translationUnit ) { 99 103 AutogenerateRoutines generator; 100 acceptAndAdd( translationUnit, generator , false);104 acceptAndAdd( translationUnit, generator ); 101 105 102 106 // needs to be done separately because AutogenerateRoutines skips types that appear as function arguments, etc. … … 567 571 EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() ); 568 572 // enumInst->set_baseEnum( enumDecl ); 569 // declsToAdd.push_back( 570 makeEnumFunctions( enumDecl, enumInst, functionNesting, declsToAdd ); 573 makeEnumFunctions( enumDecl, enumInst, functionNesting, declsToAddAfter ); 571 574 } 572 575 } … … 581 584 } 582 585 structInst.set_baseStruct( structDecl ); 583 makeStructFunctions( structDecl, &structInst, functionNesting, declsToAdd , data );586 makeStructFunctions( structDecl, &structInst, functionNesting, declsToAddAfter, data ); 584 587 structsDone.insert( structDecl->get_name() ); 585 588 } // if … … 593 596 unionInst.get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) ); 594 597 } 595 makeUnionFunctions( unionDecl, &unionInst, functionNesting, declsToAdd );598 makeUnionFunctions( unionDecl, &unionInst, functionNesting, declsToAddAfter ); 596 599 } // if 597 600 } … … 618 621 FunctionDecl *func = genFunc( "?=?", type, functionNesting ); 619 622 func->get_statements()->get_kids() = stmts; 620 declsToAdd .push_back( func );623 declsToAddAfter.push_back( func ); 621 624 } 622 625 … … 763 766 } 764 767 } // SymTab 768 769 // Local Variables: // 770 // tab-width: 4 // 771 // mode: c++ // 772 // compile-command: "make install" // 773 // End: //
Note: See TracChangeset
for help on using the changeset viewer.