Changeset 121ac13 for src/SymTab
- Timestamp:
- Nov 6, 2017, 10:28:17 AM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- bbeb908
- Parents:
- 59a0bde (diff), 9f4524b (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:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.cc
r59a0bde r121ac13 696 696 if ( TypeInstType * ty = dynamic_cast< TypeInstType * >( t ) ) { 697 697 if ( ! done.count( ty->get_baseType() ) ) { 698 TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), Type::StorageClasses(), nullptr, TypeDecl:: Any);698 TypeDecl * newDecl = new TypeDecl( ty->get_baseType()->get_name(), Type::StorageClasses(), nullptr, TypeDecl::Dtype, true ); 699 699 TypeInstType * inst = new TypeInstType( Type::Qualifiers(), newDecl->get_name(), newDecl ); 700 700 newDecl->get_assertions().push_back( new FunctionDecl( "?=?", Type::StorageClasses(), LinkageSpec::Cforall, genAssignType( inst ), nullptr, -
src/SymTab/FixFunction.cc
r59a0bde r121ac13 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
r59a0bde r121ac13 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/Mangler.cc
r59a0bde r121ac13 214 214 numStream << varNum->second.first; 215 215 switch ( (TypeDecl::Kind )varNum->second.second ) { 216 case TypeDecl::Any:217 mangleName << "t";218 break;219 216 case TypeDecl::Dtype: 220 217 mangleName << "d"; … … 274 271 for ( Type::ForallList::iterator i = type->forall.begin(); i != type->forall.end(); ++i ) { 275 272 switch ( (*i)->get_kind() ) { 276 case TypeDecl::Any:277 tcount++;278 break;279 273 case TypeDecl::Dtype: 280 274 dcount++; -
src/SymTab/Validate.cc
r59a0bde r121ac13 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.