Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    rc0aa336 r207c7e1d  
    1010// Created On       : Thu Mar 03 15:45:56 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Feb  2 18:04:40 2017
    13 // Update Count     : 11
     12// Last Modified On : Tue Jul 12 17:47:17 2016
     13// Update Count     : 2
    1414//
    1515
     
    4343
    4444        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 );
    4945          public:
    5046                std::list< Declaration * > &get_declsToAdd() { return declsToAdd; }
     
    7167                template< typename StmtClass > void visitStatement( StmtClass *stmt );
    7268
    73                 std::list< Declaration * > declsToAdd, declsToAddAfter;
     69                std::list< Declaration * > declsToAdd;
    7470                std::set< std::string > structsDone;
    7571                unsigned int functionNesting = 0;     // current level of nested functions
     
    10298        void autogenerateRoutines( std::list< Declaration * > &translationUnit ) {
    10399                AutogenerateRoutines generator;
    104                 acceptAndAdd( translationUnit, generator );
     100                acceptAndAdd( translationUnit, generator, false );
    105101
    106102                // needs to be done separately because AutogenerateRoutines skips types that appear as function arguments, etc.
     
    571567                        EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() );
    572568                        // enumInst->set_baseEnum( enumDecl );
    573                         makeEnumFunctions( enumDecl, enumInst, functionNesting, declsToAddAfter );
     569                        // declsToAdd.push_back(
     570                        makeEnumFunctions( enumDecl, enumInst, functionNesting, declsToAdd );
    574571                }
    575572        }
     
    584581                        }
    585582                        structInst.set_baseStruct( structDecl );
    586                         makeStructFunctions( structDecl, &structInst, functionNesting, declsToAddAfter, data );
     583                        makeStructFunctions( structDecl, &structInst, functionNesting, declsToAdd, data );
    587584                        structsDone.insert( structDecl->get_name() );
    588585                } // if
     
    596593                                unionInst.get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );
    597594                        }
    598                         makeUnionFunctions( unionDecl, &unionInst, functionNesting, declsToAddAfter );
     595                        makeUnionFunctions( unionDecl, &unionInst, functionNesting, declsToAdd );
    599596                } // if
    600597        }
     
    621618                FunctionDecl *func = genFunc( "?=?", type, functionNesting );
    622619                func->get_statements()->get_kids() = stmts;
    623                 declsToAddAfter.push_back( func );
     620                declsToAdd.push_back( func );
    624621        }
    625622
     
    766763        }
    767764} // 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.