Changeset 1cdfa82 for src/SymTab
- Timestamp:
- Apr 25, 2018, 4:55:53 PM (6 years ago)
- Branches:
- new-env, with_gc
- Children:
- 42107b4
- Parents:
- 2efe4b8 (diff), 9d5fb67 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/SymTab
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
r2efe4b8 r1cdfa82 501 501 502 502 bool addedDeclConflicts( AggregateDecl *existing, AggregateDecl *added ) { 503 if ( existing->get_members().empty()) {503 if ( ! existing->body ) { 504 504 return false; 505 } else if ( ! added->get_members().empty()) {505 } else if ( added->body ) { 506 506 SemanticError( added, "redeclaration of " ); 507 507 } // if -
src/SymTab/Validate.cc
r2efe4b8 r1cdfa82 90 90 void previsit( StructDecl * aggregateDecl ); 91 91 void previsit( UnionDecl * aggregateDecl ); 92 void previsit( StaticAssertDecl * assertDecl ); 92 93 93 94 private: … … 148 149 void previsit( ObjectDecl * object ); 149 150 void previsit( FunctionDecl * func ); 151 void previsit( FunctionType * ftype ); 150 152 void previsit( StructDecl * aggrDecl ); 151 153 void previsit( UnionDecl * aggrDecl ); … … 296 298 } 297 299 298 bool isStructOrUnion( Declaration *decl ) {299 return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl ) ;300 bool shouldHoist( Declaration *decl ) { 301 return dynamic_cast< StructDecl * >( decl ) || dynamic_cast< UnionDecl * >( decl ) || dynamic_cast< StaticAssertDecl * >( decl ); 300 302 } 301 303 … … 310 312 } // if 311 313 // Always remove the hoisted aggregate from the inner structure. 312 GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, isStructOrUnion); } );314 GuardAction( [aggregateDecl]() { filter( aggregateDecl->members, shouldHoist, false ); } ); 313 315 } 314 316 315 317 void HoistStruct::previsit( EnumInstType * inst ) { 316 if ( inst->baseEnum ) {318 if ( inst->baseEnum && inst->baseEnum->body ) { 317 319 declsToAddBefore.push_front( inst->baseEnum ); 318 320 } … … 320 322 321 323 void HoistStruct::previsit( StructInstType * inst ) { 322 if ( inst->baseStruct ) {324 if ( inst->baseStruct && inst->baseStruct->body ) { 323 325 declsToAddBefore.push_front( inst->baseStruct ); 324 326 } … … 326 328 327 329 void HoistStruct::previsit( UnionInstType * inst ) { 328 if ( inst->baseUnion ) {330 if ( inst->baseUnion && inst->baseUnion->body ) { 329 331 declsToAddBefore.push_front( inst->baseUnion ); 332 } 333 } 334 335 void HoistStruct::previsit( StaticAssertDecl * assertDecl ) { 336 if ( parentAggr ) { 337 declsToAddBefore.push_back( assertDecl ); 330 338 } 331 339 } … … 623 631 624 632 void ForallPointerDecay::previsit( ObjectDecl *object ) { 625 forallFixer( object->type->forall, object );626 if ( PointerType *pointer = dynamic_cast< PointerType * >( object->type) ) {627 forallFixer( pointer->base->forall, object);628 } // if633 // ensure that operator names only apply to functions or function pointers 634 if ( CodeGen::isOperator( object->name ) && ! dynamic_cast< FunctionType * >( object->type->stripDeclarator() ) ) { 635 SemanticError( object->location, toCString( "operator ", object->name.c_str(), " is not a function or function pointer." ) ); 636 } 629 637 object->fixUniqueId(); 630 638 } 631 639 632 640 void ForallPointerDecay::previsit( FunctionDecl *func ) { 633 forallFixer( func->type->forall, func );634 641 func->fixUniqueId(); 642 } 643 644 void ForallPointerDecay::previsit( FunctionType * ftype ) { 645 forallFixer( ftype->forall, ftype ); 635 646 } 636 647 … … 681 692 new_static_root<BasicType>( Type::Qualifiers(), BasicType::LongUnsignedInt ); 682 693 } 683 filter( translationUnit, isTypedef );694 filter( translationUnit, isTypedef, true ); 684 695 } 685 696 … … 818 829 } // if 819 830 return false; 820 } 831 }, true); 821 832 return compoundStmt; 822 833 } … … 826 837 template<typename AggDecl> 827 838 AggDecl *EliminateTypedef::handleAggregate( AggDecl * aggDecl ) { 828 filter( aggDecl->members, isTypedef );839 filter( aggDecl->members, isTypedef, true ); 829 840 return aggDecl; 830 841 }
Note: See TracChangeset
for help on using the changeset viewer.