Changeset 4ee1efb for src/SymTab
- Timestamp:
- Oct 26, 2017, 11:23:26 AM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 136ccd7
- Parents:
- 0b9be4d (diff), 598f50e (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. - git-author:
- Rob Schluntz <rschlunt@…> (10/26/17 10:43:08)
- git-committer:
- Rob Schluntz <rschlunt@…> (10/26/17 11:23:26)
- Location:
- src/SymTab
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.cc
r0b9be4d r4ee1efb 314 314 void FuncGenerator::generatePrototypes( std::list< FunctionDecl * > & newFuncs ) { 315 315 bool concurrent_type = isConcurrentType(); 316 for ( const FuncData & d ata: data ) {316 for ( const FuncData & d : data ) { 317 317 // generate a function (?{}, ?=?, ^?{}) based on the current FuncData. 318 FunctionType * ftype = d ata.genType( type, true );318 FunctionType * ftype = d.genType( type, true ); 319 319 320 320 // destructor for concurrent type must be mutex 321 if ( concurrent_type && CodeGen::isDestructor( d ata.fname ) ) {321 if ( concurrent_type && CodeGen::isDestructor( d.fname ) ) { 322 322 ftype->parameters.front()->get_type()->set_mutex( true ); 323 323 } 324 324 325 newFuncs.push_back( genFunc( d ata.fname, ftype, functionNesting ) );325 newFuncs.push_back( genFunc( d.fname, ftype, functionNesting ) ); 326 326 } 327 327 } -
src/SymTab/FixFunction.cc
r0b9be4d r4ee1efb 50 50 51 51 void FixFunction::premutate(FunctionDecl *) { visit_children = false; } 52 void FixFunction::premutate(ArrayType *) { visit_children = false; } 52 53 void FixFunction::premutate(BasicType *) { visit_children = false; } 53 54 void FixFunction::premutate(PointerType *) { visit_children = false; } -
src/SymTab/FixFunction.h
r0b9be4d r4ee1efb 31 31 Type * postmutate(ArrayType * arrayType); 32 32 33 void premutate(ArrayType * arrayType); 33 34 void premutate(VoidType * voidType); 34 35 void premutate(BasicType * basicType); -
src/SymTab/Validate.cc
r0b9be4d r4ee1efb 668 668 } 669 669 filter( translationUnit, isTypedef, true ); 670 671 670 } 672 671 … … 676 675 TypedefMap::const_iterator def = typedefNames.find( typeInst->get_name() ); 677 676 if ( def != typedefNames.end() ) { 678 Type *ret = def->second.first-> get_base()->clone();677 Type *ret = def->second.first->base->clone(); 679 678 ret->get_qualifiers() |= typeInst->get_qualifiers(); 680 679 // place instance parameters on the typedef'd type 681 if ( ! typeInst-> get_parameters().empty() ) {680 if ( ! typeInst->parameters.empty() ) { 682 681 ReferenceToType *rtt = dynamic_cast<ReferenceToType*>(ret); 683 682 if ( ! rtt ) { 684 throw SemanticError(" cannot apply type parameters to base type of " + typeInst->get_name());683 throw SemanticError("Cannot apply type parameters to base type of " + typeInst->name); 685 684 } 686 685 rtt->get_parameters().clear(); 687 cloneAll( typeInst-> get_parameters(), rtt->get_parameters());688 mutateAll( rtt-> get_parameters(), *visitor ); // recursively fix typedefs on parameters686 cloneAll( typeInst->parameters, rtt->parameters ); 687 mutateAll( rtt->parameters, *visitor ); // recursively fix typedefs on parameters 689 688 } // if 690 689 delete typeInst; … … 692 691 } else { 693 692 TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->get_name() ); 694 assertf( base != typedeclNames.end(), "Cannot find typedecl name %s", typeInst-> get_name().c_str() );693 assertf( base != typedeclNames.end(), "Cannot find typedecl name %s", typeInst->name.c_str() ); 695 694 typeInst->set_baseType( base->second ); 696 695 } // if 697 696 return typeInst; 697 } 698 699 struct VarLenChecker : WithShortCircuiting { 700 void previsit( FunctionType * ) { visit_children = false; } 701 void previsit( ArrayType * at ) { 702 isVarLen |= at->isVarLen; 703 } 704 bool isVarLen = false; 705 }; 706 707 bool isVariableLength( Type * t ) { 708 PassVisitor<VarLenChecker> varLenChecker; 709 maybeAccept( t, varLenChecker ); 710 return varLenChecker.pass.isVarLen; 698 711 } 699 712 … … 706 719 Type * t2 = typedefNames[ tyDecl->get_name() ].first->get_base(); 707 720 if ( ! ResolvExpr::typesCompatible( t1, t2, Indexer() ) ) { 708 throw SemanticError( "cannot redefine typedef: " + tyDecl->get_name() ); 721 throw SemanticError( "Cannot redefine typedef: " + tyDecl->name ); 722 } 723 // cannot redefine VLA typedefs 724 if ( isVariableLength( t1 ) || isVariableLength( t2 ) ) { 725 throw SemanticError( "Cannot redefine typedef: " + tyDecl->name ); 709 726 } 710 727 } else {
Note: See TracChangeset
for help on using the changeset viewer.