Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Lvalue.cc

    rbaba5d8 r906e24d  
    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() );
    103101
    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() );
    108104
    109105                        Type *funType = isLvalueRet( function );
    110106                        if ( funType && ! isIntrinsicApp( appExpr ) ) {
    111107                                Expression *expr = appExpr;
    112                                 Type *appType = appExpr->get_results().front();
     108                                Type *appType = appExpr->get_result();
    113109                                if ( isPolyType( funType ) && ! isPolyType( appType ) ) {
    114110                                        // make sure cast for polymorphic type is inside dereference
     
    116112                                }
    117113                                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 ) );
    120116                                deref->get_args().push_back( expr );
    121117                                return deref;
     
    127123                Statement * Pass1::mutate(ReturnStmt *retStmt) {
    128124                        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() ) {
    131126                                        // ***** Code Removal ***** because casts may be stripped already
    132127
     
    155150                                retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
    156151                        } // if
    157  
     152
    158153                        Visitor::visit( funType );
    159154                }
Note: See TracChangeset for help on using the changeset viewer.