Changes in src/GenPoly/Lvalue.cc [baba5d8:906e24d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Lvalue.cc
rbaba5d8 r906e24d 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Lvalue.cc -- 7 // Lvalue.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 41 41 public: 42 42 Pass1(); 43 43 44 44 virtual Expression *mutate( ApplicationExpr *appExpr ); 45 45 virtual Statement *mutate( ReturnStmt *appExpr ); … … 99 99 appExpr->get_function()->acceptMutator( *this ); 100 100 mutateAll( appExpr->get_args(), *this ); 101 102 assert( ! appExpr->get_function()->get_results().empty() );103 101 104 PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() ); 105 assert( pointer ); 106 FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ); 107 assert( function ); 102 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() ); 103 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() ); 108 104 109 105 Type *funType = isLvalueRet( function ); 110 106 if ( funType && ! isIntrinsicApp( appExpr ) ) { 111 107 Expression *expr = appExpr; 112 Type *appType = appExpr->get_result s().front();108 Type *appType = appExpr->get_result(); 113 109 if ( isPolyType( funType ) && ! isPolyType( appType ) ) { 114 110 // make sure cast for polymorphic type is inside dereference … … 116 112 } 117 113 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 118 deref-> get_results().push_back( appType->clone() );119 appExpr-> get_results().front() = new PointerType( Type::Qualifiers(), appType);114 deref->set_result( appType->clone() ); 115 appExpr->set_result( new PointerType( Type::Qualifiers(), appType ) ); 120 116 deref->get_args().push_back( expr ); 121 117 return deref; … … 127 123 Statement * Pass1::mutate(ReturnStmt *retStmt) { 128 124 if ( retval && retStmt->get_expr() ) { 129 assert( ! retStmt->get_expr()->get_results().empty() ); 130 if ( retStmt->get_expr()->get_results().front()->get_isLvalue() ) { 125 if ( retStmt->get_expr()->get_result()->get_isLvalue() ) { 131 126 // ***** Code Removal ***** because casts may be stripped already 132 127 … … 155 150 retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) ); 156 151 } // if 157 152 158 153 Visitor::visit( funType ); 159 154 }
Note: See TracChangeset
for help on using the changeset viewer.