Changeset 1132b62 for src/Tuples/TupleExpansion.cc
- Timestamp:
- Sep 20, 2016, 7:14:15 PM (7 years ago)
- Branches:
- aaron-thesis, arm-eh, 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:
- 65660bd
- Parents:
- 23b6643f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Tuples/TupleExpansion.cc
r23b6643f r1132b62 27 27 #include "SymTab/Mangler.h" 28 28 #include "Common/ScopedMap.h" 29 #include "ResolvExpr/typeops.h" 29 30 30 31 namespace Tuples { … … 48 49 49 50 virtual Type * mutate( TupleType * tupleType ); 51 virtual Type * mutate( FunctionType * ftype ); 50 52 51 53 virtual CompoundStmt * mutate( CompoundStmt * stmt ) { … … 119 121 } 120 122 123 Type * TupleTypeReplacer::mutate( FunctionType * ftype ) { 124 // replace multiple-returning functions with functions which return a tuple 125 if ( ftype->get_returnVals().size() > 1 ) { 126 TupleType * tupleType = safe_dynamic_cast<TupleType *>( ResolvExpr::extractResultType( ftype ) ); 127 ObjectDecl * retVal = new ObjectDecl( "__tuple_ret", DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, tupleType, nullptr ); 128 // xxx - replace all uses of return vals with appropriate tuple index expr 129 deleteAll( ftype->get_returnVals() ); 130 ftype->get_returnVals().clear(); 131 ftype->get_returnVals().push_back( retVal ); 132 } 133 return Parent::mutate( ftype ); 134 } 135 121 136 Type * TupleTypeReplacer::mutate( TupleType * tupleType ) { 122 137 std::string mangleName = SymTab::Mangler::mangleType( tupleType );
Note: See TracChangeset
for help on using the changeset viewer.