Changeset 1db21619 for src/SymTab/Validate.cc
- Timestamp:
- Jul 16, 2015, 5:28:24 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 994ec2c
- Parents:
- 724c2b6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
r724c2b6 r1db21619 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 21:50:04 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : T ue Jul 14 12:27:54201513 // Update Count : 18 611 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jul 16 16:10:02 2015 13 // Update Count : 189 14 14 // 15 15 … … 162 162 class EliminateTypedef : public Mutator { 163 163 public: 164 164 EliminateTypedef() : scopeLevel( 0 ) {} 165 165 static void eliminateTypedef( std::list< Declaration * > &translationUnit ); 166 166 private: … … 168 168 virtual TypeDecl *mutate( TypeDecl *typeDecl ); 169 169 virtual DeclarationWithType *mutate( FunctionDecl *funcDecl ); 170 virtual ObjectDecl*mutate( ObjectDecl *objDecl );170 virtual DeclarationWithType *mutate( ObjectDecl *objDecl ); 171 171 virtual CompoundStmt *mutate( CompoundStmt *compoundStmt ); 172 172 virtual Type *mutate( TypeInstType *aggregateUseType ); … … 612 612 613 613 // need to remove the prototypes, since this may be nested in a routine 614 for ( int start = 0, end = assigns.size()/2; start < end; start++) {614 for ( int start = 0, end = assigns.size() / 2; start < end; start++ ) { 615 615 delete assigns.front(); 616 616 assigns.pop_front(); 617 } 617 } // for 618 618 619 619 declsToAdd.insert( declsToAdd.begin(), assigns.begin(), assigns.end() ); … … 830 830 rtt->get_parameters().clear(); 831 831 cloneAll(typeInst->get_parameters(), rtt->get_parameters()); 832 } 832 } // if 833 833 delete typeInst; 834 834 return ret; … … 884 884 } 885 885 886 ObjectDecl*EliminateTypedef::mutate( ObjectDecl * objDecl ) {886 DeclarationWithType *EliminateTypedef::mutate( ObjectDecl * objDecl ) { 887 887 TypedefMap oldNames = typedefNames; 888 ObjectDecl *ret = Mutator::mutate( objDecl ); 888 DeclarationWithType *ret = Mutator::mutate( objDecl ); 889 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) { 890 return new FunctionDecl( ret->get_name(), ret->get_storageClass(), ret->get_linkage(), funtype, 0, ret->get_isInline(), ret->get_isNoreturn() ); 891 } else if ( objDecl->get_isInline() || objDecl->get_isNoreturn() ) { 892 throw SemanticError( "invalid inline or _Noreturn specification in declaration of ", objDecl ); 893 } // if 889 894 typedefNames = oldNames; 890 895 return ret; … … 950 955 } 951 956 952 957 Declaration *EliminateTypedef::mutate( ContextDecl * contextDecl ) { 953 958 Mutator::mutate( contextDecl ); 954 959 return handleAggregate( contextDecl );
Note: See TracChangeset
for help on using the changeset viewer.