Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Lvalue.cc

    r906e24d rbaba5d8  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Lvalue.cc --
     7// Lvalue.cc -- 
    88//
    99// Author           : Richard C. Bilson
     
    4141                  public:
    4242                        Pass1();
    43 
     43 
    4444                        virtual Expression *mutate( ApplicationExpr *appExpr );
    4545                        virtual Statement *mutate( ReturnStmt *appExpr );
     
    9999                        appExpr->get_function()->acceptMutator( *this );
    100100                        mutateAll( appExpr->get_args(), *this );
     101 
     102                        assert( ! appExpr->get_function()->get_results().empty() );
    101103
    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 );
    104108
    105109                        Type *funType = isLvalueRet( function );
    106110                        if ( funType && ! isIntrinsicApp( appExpr ) ) {
    107111                                Expression *expr = appExpr;
    108                                 Type *appType = appExpr->get_result();
     112                                Type *appType = appExpr->get_results().front();
    109113                                if ( isPolyType( funType ) && ! isPolyType( appType ) ) {
    110114                                        // make sure cast for polymorphic type is inside dereference
     
    112116                                }
    113117                                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 );
    116120                                deref->get_args().push_back( expr );
    117121                                return deref;
     
    123127                Statement * Pass1::mutate(ReturnStmt *retStmt) {
    124128                        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() ) {
    126131                                        // ***** Code Removal ***** because casts may be stripped already
    127132
     
    150155                                retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
    151156                        } // if
    152 
     157 
    153158                        Visitor::visit( funType );
    154159                }
Note: See TracChangeset for help on using the changeset viewer.