Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r298fe57 r9e7236f4  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Fri Apr 29  9:45:00 2022
    13 // Update Count     : 365
     12// Last Modified On : Fri Nov 12 11:00:00 2021
     13// Update Count     : 364
    1414//
    1515
     
    143143        struct LinkReferenceToTypes_old final : public WithIndexer, public WithGuards, public WithVisitorRef<LinkReferenceToTypes_old>, public WithShortCircuiting {
    144144                LinkReferenceToTypes_old( const Indexer * indexer );
    145 
    146145                void postvisit( TypeInstType * typeInst );
    147146
     
    371370        }
    372371
    373         void linkReferenceToTypes( std::list< Declaration * > & translationUnit ) {
     372        void validate_B( std::list< Declaration * > & translationUnit ) {
    374373                PassVisitor<LinkReferenceToTypes_old> lrt( nullptr );
    375                 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    376         }
    377 
    378         void validate_B( std::list< Declaration * > & translationUnit ) {
    379374                PassVisitor<FixQualifiedTypes> fixQual;
    380375                {
    381376                        Stats::Heap::newPass("validate-B");
    382377                        Stats::Time::BlockGuard guard("validate-B");
    383                         //linkReferenceToTypes( translationUnit );
     378                        acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
    384379                        mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes_old, because aggregate members are accessed
    385380                        HoistStruct::hoistStruct( translationUnit );
     
    765760                } // if
    766761        }
    767 
    768762        void LinkReferenceToTypes_old::postvisit( StructInstType * structInst ) {
    769763                const StructDecl * st = local_indexer->lookupStruct( structInst->name );
     
    891885        void LinkReferenceToTypes_old::postvisit( EnumDecl * enumDecl ) {
    892886                // visit enum members first so that the types of self-referencing members are updated properly
     887                // Replace the enum base; right now it works only for StructEnum
     888                if ( enumDecl->base && dynamic_cast<TypeInstType*>(enumDecl->base) ) {
     889                        std::string baseName = static_cast<TypeInstType*>(enumDecl->base)->name;
     890                        const StructDecl * st = local_indexer->lookupStruct( baseName );
     891                        if ( st ) {
     892                                enumDecl->base = new StructInstType(Type::Qualifiers(),const_cast<StructDecl *>(st)); // Just linking in the node
     893                        }
     894                }
    893895                if ( enumDecl->body ) {
    894896                        ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name );
Note: See TracChangeset for help on using the changeset viewer.