Changes in src/SymTab/Validate.cc [bbf3fda:a16764a6]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
rbbf3fda ra16764a6 89 89 void previsit( StructDecl * aggregateDecl ); 90 90 void previsit( UnionDecl * aggregateDecl ); 91 void previsit( StaticAssertDecl * assertDecl );92 91 93 92 private: … … 148 147 void previsit( ObjectDecl * object ); 149 148 void previsit( FunctionDecl * func ); 150 void previsit( FunctionType * ftype );151 149 void previsit( StructDecl * aggrDecl ); 152 150 void previsit( UnionDecl * aggrDecl ); … … 298 296 } 299 297 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 ); 302 300 } 303 301 … … 312 310 } // if 313 311 // 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 ); } ); 315 313 } 316 314 … … 330 328 if ( inst->baseUnion ) { 331 329 declsToAddBefore.push_front( inst->baseUnion ); 332 }333 }334 335 void HoistStruct::previsit( StaticAssertDecl * assertDecl ) {336 if ( parentAggr ) {337 declsToAddBefore.push_back( assertDecl );338 330 } 339 331 } … … 634 626 635 627 void ForallPointerDecay::previsit( ObjectDecl *object ) { 636 // ensure that operator names only apply to functions or function pointers637 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 640 632 object->fixUniqueId(); 641 633 } 642 634 643 635 void ForallPointerDecay::previsit( FunctionDecl *func ) { 636 forallFixer( func->type->forall, func ); 644 637 func->fixUniqueId(); 645 }646 647 void ForallPointerDecay::previsit( FunctionType * ftype ) {648 forallFixer( ftype->forall, ftype );649 638 } 650 639
Note:
See TracChangeset
for help on using the changeset viewer.