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