Changeset 906e24d for src/ResolvExpr/Resolver.cc
- Timestamp:
- Sep 15, 2016, 10:17:16 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:
- aa8f9df
- Parents:
- 96a10cd
- git-author:
- Rob Schluntz <rschlunt@…> (09/14/16 22:32:34)
- git-committer:
- Rob Schluntz <rschlunt@…> (09/15/16 10:17:16)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
r96a10cd r906e24d 19 19 #include "RenameVars.h" 20 20 #include "ResolveTypeof.h" 21 #include "typeops.h" 21 22 #include "SynTree/Statement.h" 22 23 #include "SynTree/Type.h" … … 67 68 void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator & ); 68 69 void fallbackInit( ConstructorInit * ctorInit ); 69 std::list< Type * >functionReturn;70 Type * functionReturn; 70 71 Type *initContext; 71 72 Type *switchType; … … 155 156 const TypeEnvironment *newEnv = 0; 156 157 for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) { 157 if ( i->expr->get_result s().size() == 1 && isIntegralType( i->expr->get_results().front() ) ) {158 if ( i->expr->get_result()->size() == 1 && isIntegralType( i->expr->get_result() ) ) { 158 159 if ( newExpr ) { 159 160 throw SemanticError( "Too many interpretations for case control expression", untyped ); … … 232 233 Type *new_type = resolveTypeof( functionDecl->get_type(), *this ); 233 234 functionDecl->set_type( new_type ); 234 std::list< Type * > oldFunctionReturn = functionReturn; 235 functionReturn.clear(); 236 for ( std::list< DeclarationWithType * >::const_iterator i = functionDecl->get_functionType()->get_returnVals().begin(); i != functionDecl->get_functionType()->get_returnVals().end(); ++i ) { 237 functionReturn.push_back( (*i)->get_type() ); 238 } // for 235 ValueGuard< Type * > oldFunctionReturn( functionReturn ); 236 functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() ); 239 237 SymTab::Indexer::visit( functionDecl ); 240 functionReturn = oldFunctionReturn;241 238 } 242 239 … … 336 333 void Resolver::visit( ReturnStmt *returnStmt ) { 337 334 if ( returnStmt->get_expr() ) { 338 CastExpr *castExpr = new CastExpr( returnStmt->get_expr() ); 339 cloneAll( functionReturn, castExpr->get_results() ); 335 CastExpr *castExpr = new CastExpr( returnStmt->get_expr(), functionReturn->clone() ); 340 336 Expression *newExpr = findSingleExpression( castExpr, *this ); 341 337 delete castExpr; … … 382 378 if ( isCharType( at->get_base() ) ) { 383 379 // check if the resolved type is char * 384 if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result s().front() ) ) {380 if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) { 385 381 if ( isCharType( pt->get_base() ) ) { 386 382 // strip cast if we're initializing a char[] with a char *, e.g. char x[] = "hello";
Note: See TracChangeset
for help on using the changeset viewer.