Ignore:
Timestamp:
Feb 6, 2017, 4:19:41 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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
Message:

third attempt at gcc attributes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    ra362f97 rc0aa336  
    1010// Created On       : Thu Mar 03 15:45:56 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:47:17 2016
    13 // Update Count     : 2
     12// Last Modified On : Thu Feb  2 18:04:40 2017
     13// Update Count     : 11
    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 );
    4549          public:
    4650                std::list< Declaration * > &get_declsToAdd() { return declsToAdd; }
     
    6771                template< typename StmtClass > void visitStatement( StmtClass *stmt );
    6872
    69                 std::list< Declaration * > declsToAdd;
     73                std::list< Declaration * > declsToAdd, declsToAddAfter;
    7074                std::set< std::string > structsDone;
    7175                unsigned int functionNesting = 0;     // current level of nested functions
     
    98102        void autogenerateRoutines( std::list< Declaration * > &translationUnit ) {
    99103                AutogenerateRoutines generator;
    100                 acceptAndAdd( translationUnit, generator, false );
     104                acceptAndAdd( translationUnit, generator );
    101105
    102106                // needs to be done separately because AutogenerateRoutines skips types that appear as function arguments, etc.
     
    567571                        EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() );
    568572                        // enumInst->set_baseEnum( enumDecl );
    569                         // declsToAdd.push_back(
    570                         makeEnumFunctions( enumDecl, enumInst, functionNesting, declsToAdd );
     573                        makeEnumFunctions( enumDecl, enumInst, functionNesting, declsToAddAfter );
    571574                }
    572575        }
     
    581584                        }
    582585                        structInst.set_baseStruct( structDecl );
    583                         makeStructFunctions( structDecl, &structInst, functionNesting, declsToAdd, data );
     586                        makeStructFunctions( structDecl, &structInst, functionNesting, declsToAddAfter, data );
    584587                        structsDone.insert( structDecl->get_name() );
    585588                } // if
     
    593596                                unionInst.get_parameters().push_back( new TypeExpr( new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), typeDecl ) ) );
    594597                        }
    595                         makeUnionFunctions( unionDecl, &unionInst, functionNesting, declsToAdd );
     598                        makeUnionFunctions( unionDecl, &unionInst, functionNesting, declsToAddAfter );
    596599                } // if
    597600        }
     
    618621                FunctionDecl *func = genFunc( "?=?", type, functionNesting );
    619622                func->get_statements()->get_kids() = stmts;
    620                 declsToAdd.push_back( func );
     623                declsToAddAfter.push_back( func );
    621624        }
    622625
     
    763766        }
    764767} // 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.