Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Lvalue.cc

    rbaba5d8 rd3b7937  
    1717
    1818#include "Lvalue.h"
    19 
    20 #include "GenPoly.h"
    2119
    2220#include "SynTree/Declaration.h"
     
    6563
    6664        namespace {
    67                 Type* isLvalueRet( FunctionType *function ) {
    68                         if ( function->get_returnVals().empty() ) return 0;
    69                         Type *ty = function->get_returnVals().front()->get_type();
    70                         return ty->get_isLvalue() ? ty : 0;
     65                bool isLvalueRet( FunctionType *function ) {
     66                        if ( ! function->get_returnVals().empty() ) {
     67                                return function->get_returnVals().front()->get_type()->get_isLvalue();
     68                        } else {
     69                                return false;
     70                        } // if
    7171                }
    7272
     
    107107                        assert( function );
    108108
    109                         Type *funType = isLvalueRet( function );
    110                         if ( funType && ! isIntrinsicApp( appExpr ) ) {
    111                                 Expression *expr = appExpr;
    112                                 Type *appType = appExpr->get_results().front();
    113                                 if ( isPolyType( funType ) && ! isPolyType( appType ) ) {
    114                                         // make sure cast for polymorphic type is inside dereference
    115                                         expr = new CastExpr( appExpr, new PointerType( Type::Qualifiers(), appType->clone() ) );
    116                                 }
     109                        std::string typeName;
     110                        if ( isLvalueRet( function ) && ! isIntrinsicApp( appExpr ) ) {
    117111                                UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    118                                 deref->get_results().push_back( appType->clone() );
    119                                 appExpr->get_results().front() = new PointerType( Type::Qualifiers(), appType );
    120                                 deref->get_args().push_back( expr );
     112                                deref->get_results().push_back( appExpr->get_results().front() );
     113                                appExpr->get_results().front() = new PointerType( Type::Qualifiers(), deref->get_results().front()->clone() );
     114                                deref->get_args().push_back( appExpr );
    121115                                return deref;
    122116                        } else {
Note: See TracChangeset for help on using the changeset viewer.