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