Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    rbbf3fda ra16764a6  
    8989                void previsit( StructDecl * aggregateDecl );
    9090                void previsit( UnionDecl * aggregateDecl );
    91                 void previsit( StaticAssertDecl * assertDecl );
    9291
    9392          private:
     
    148147                void previsit( ObjectDecl * object );
    149148                void previsit( FunctionDecl * func );
    150                 void previsit( FunctionType * ftype );
    151149                void previsit( StructDecl * aggrDecl );
    152150                void previsit( UnionDecl * aggrDecl );
     
    298296        }
    299297
    300         bool shouldHoist( Declaration *decl ) {
    301                 return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl ) || dynamic_cast< StaticAssertDecl * >( decl );
     298        bool isStructOrUnion( Declaration *decl ) {
     299                return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl );
    302300        }
    303301
     
    312310                } // if
    313311                // Always remove the hoisted aggregate from the inner structure.
    314                 GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, shouldHoist, false ); } );
     312                GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, isStructOrUnion, false ); } );
    315313        }
    316314
     
    330328                if ( inst->baseUnion ) {
    331329                        declsToAddBefore.push_front( inst->baseUnion );
    332                 }
    333         }
    334 
    335         void HoistStruct::previsit( StaticAssertDecl * assertDecl ) {
    336                 if ( parentAggr ) {
    337                         declsToAddBefore.push_back( assertDecl );
    338330                }
    339331        }
     
    634626
    635627        void ForallPointerDecay::previsit( ObjectDecl *object ) {
    636                 // ensure that operator names only apply to functions or function pointers
    637                 if ( CodeGen::isOperator( object->name ) && ! dynamic_cast< FunctionType * >( object->type->stripDeclarator() ) ) {
    638                         SemanticError( object->location, toCString( "operator ", object->name.c_str(), " is not a function or function pointer." ) );
    639                 }
     628                forallFixer( object->type->forall, object );
     629                if ( PointerType *pointer = dynamic_cast< PointerType * >( object->type ) ) {
     630                        forallFixer( pointer->base->forall, object );
     631                } // if
    640632                object->fixUniqueId();
    641633        }
    642634
    643635        void ForallPointerDecay::previsit( FunctionDecl *func ) {
     636                forallFixer( func->type->forall, func );
    644637                func->fixUniqueId();
    645         }
    646 
    647         void ForallPointerDecay::previsit( FunctionType * ftype ) {
    648                 forallFixer( ftype->forall, ftype );
    649638        }
    650639
Note: See TracChangeset for help on using the changeset viewer.