Changeset 32a2a99 for src/SymTab/Validate.cc
- Timestamp:
- Aug 30, 2016, 4:25:55 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, 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:
- 90e2334, fa463f1
- Parents:
- a2a8d2a6 (diff), ced2e989 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
ra2a8d2a6 r32a2a99 49 49 #include "SynTree/Statement.h" 50 50 #include "SynTree/TypeSubstitution.h" 51 #include "GenPoly/ScopedMap.h" 51 52 #include "Indexer.h" 52 53 #include "FixFunction.h" … … 162 163 void addImplicitTypedef( AggDecl * aggDecl ); 163 164 164 typedef std::map< std::string, std::pair< TypedefDecl *, int > > TypedefMap; 165 typedef std::unique_ptr<TypedefDecl> TypedefDeclPtr; 166 typedef GenPoly::ScopedMap< std::string, std::pair< TypedefDeclPtr, int > > TypedefMap; 165 167 typedef std::map< std::string, TypeDecl * > TypeDeclMap; 166 168 TypedefMap typedefNames; … … 531 533 TypeDeclMap::const_iterator base = typedeclNames.find( typeInst->get_name() ); 532 534 assert( base != typedeclNames.end() ); 533 typeInst->set_baseType( base->second ->clone());535 typeInst->set_baseType( base->second ); 534 536 } // if 535 537 return typeInst; … … 549 551 } 550 552 } else { 551 typedefNames[ tyDecl->get_name() ] = std::make_pair( tyDecl, scopeLevel );553 typedefNames[ tyDecl->get_name() ] = std::make_pair( TypedefDeclPtr( tyDecl ), scopeLevel ); 552 554 } // if 553 555 … … 567 569 return new EnumDecl( enumDecl->get_name() ); 568 570 } else { 569 return ret ;571 return ret->clone(); 570 572 } // if 571 573 } … … 582 584 583 585 DeclarationWithType *EliminateTypedef::mutate( FunctionDecl * funcDecl ) { 584 TypedefMap oldNames = typedefNames;586 typedefNames.beginScope(); 585 587 DeclarationWithType *ret = Mutator::mutate( funcDecl ); 586 typedefNames = oldNames;588 typedefNames.endScope(); 587 589 return ret; 588 590 } 589 591 590 592 DeclarationWithType *EliminateTypedef::mutate( ObjectDecl * objDecl ) { 591 TypedefMap oldNames = typedefNames;593 typedefNames.beginScope(); 592 594 DeclarationWithType *ret = Mutator::mutate( objDecl ); 593 typedefNames = oldNames;595 typedefNames.endScope(); 594 596 // is the type a function? 595 597 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) { … … 603 605 604 606 Expression *EliminateTypedef::mutate( CastExpr * castExpr ) { 605 TypedefMap oldNames = typedefNames;607 typedefNames.beginScope(); 606 608 Expression *ret = Mutator::mutate( castExpr ); 607 typedefNames = oldNames;609 typedefNames.endScope(); 608 610 return ret; 609 611 } 610 612 611 613 CompoundStmt *EliminateTypedef::mutate( CompoundStmt * compoundStmt ) { 612 TypedefMap oldNames = typedefNames;614 typedefNames.beginScope(); 613 615 scopeLevel += 1; 614 616 CompoundStmt *ret = Mutator::mutate( compoundStmt ); … … 625 627 i = next; 626 628 } // while 627 typedefNames = oldNames;629 typedefNames.endScope(); 628 630 return ret; 629 631 } … … 656 658 type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ); 657 659 } // if 658 TypedefDecl * tyDecl = new TypedefDecl( aggDecl->get_name(), DeclarationNode::NoStorageClass, type);659 typedefNames[ aggDecl->get_name() ] = std::make_pair( tyDecl, scopeLevel );660 TypedefDeclPtr tyDecl( new TypedefDecl( aggDecl->get_name(), DeclarationNode::NoStorageClass, type ) ); 661 typedefNames[ aggDecl->get_name() ] = std::make_pair( std::move( tyDecl ), scopeLevel ); 660 662 } // if 661 663 }
Note:
See TracChangeset
for help on using the changeset viewer.