Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r298fe57 r7c919559  
    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 );
     
    979974                                        // need to resolve enumerator initializers early so that other passes that determine if an expression is constexpr have the appropriate information.
    980975                                        SingleInit * init = strict_dynamic_cast<SingleInit *>( field->init );
    981                                         if ( !enumDecl->base || dynamic_cast<BasicType *>(enumDecl->base))
    982                                                 ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer );
    983                                         else {
    984                                                 if (dynamic_cast<PointerType *>(enumDecl->base)) {
    985                                                         auto typePtr = dynamic_cast<PointerType *>(enumDecl->base);
    986                                                         ResolvExpr::findSingleExpression( init->value,
    987                                                          new PointerType( Type::Qualifiers(), typePtr->base ), indexer );
    988                                                 } else {
    989                                                         ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer );
    990                                                 }
    991                                         }
    992                                        
     976                                        ResolvExpr::findSingleExpression( init->value, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), indexer );
    993977                                }
    994978                        }
    995 
    996979                } // if
    997980        }
     
    12571240                        declsToAddBefore.push_back( new UnionDecl( aggDecl->name, noAttributes, tyDecl->linkage ) );
    12581241                } else if ( EnumInstType * enumDecl = dynamic_cast< EnumInstType * >( designatorType ) ) {
    1259                         // declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage, enumDecl->baseEnum->base ) );
    1260                         if (enumDecl->baseEnum) {
    1261                                 declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage, enumDecl->baseEnum->base ) );
    1262                         } else {
    1263                                 declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage ) );
    1264                         }
     1242                        declsToAddBefore.push_back( new EnumDecl( enumDecl->name, noAttributes, tyDecl->linkage ) );
    12651243                } // if
    12661244                return tyDecl->clone();
Note: See TracChangeset for help on using the changeset viewer.