Changeset 83de11e for src/SymTab/Validate.cc
- Timestamp:
- Jun 1, 2016, 5:58:15 PM (8 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, with_gc
- Children:
- 4df85197
- Parents:
- 677c1be
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
r677c1be r83de11e 291 291 292 292 namespace { 293 template< typename DWT Iterator>294 void fixFunctionList( DWT Iterator begin, DWTIterator end, FunctionType *func ) {293 template< typename DWTList > 294 void fixFunctionList( DWTList & dwts, FunctionType * func ) { 295 295 // the only case in which "void" is valid is where it is the only one in the list; then it should be removed 296 296 // entirely other fix ups are handled by the FixFunction class 297 typedef typename DWTList::iterator DWTIterator; 298 DWTIterator begin( dwts.begin() ), end( dwts.end() ); 297 299 if ( begin == end ) return; 298 300 FixFunction fixer; 299 301 DWTIterator i = begin; 300 *i = (*i 302 *i = (*i)->acceptMutator( fixer ); 301 303 if ( fixer.get_isVoid() ) { 302 304 DWTIterator j = i; 303 305 ++i; 304 func->get_parameters().erase( j );306 dwts.erase( j ); 305 307 if ( i != end ) { 306 308 throw SemanticError( "invalid type void in function type ", func ); … … 321 323 void Pass1::visit( FunctionType *func ) { 322 324 // Fix up parameters and return types 323 fixFunctionList( func->get_parameters() .begin(), func->get_parameters().end(), func );324 fixFunctionList( func->get_returnVals() .begin(), func->get_returnVals().end(), func );325 fixFunctionList( func->get_parameters(), func ); 326 fixFunctionList( func->get_returnVals(), func ); 325 327 Visitor::visit( func ); 326 328 }
Note: See TracChangeset
for help on using the changeset viewer.