Changes in src/GenPoly/Lvalue.cc [baba5d8:d3b7937]
- File:
-
- 1 edited
-
src/GenPoly/Lvalue.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Lvalue.cc
rbaba5d8 rd3b7937 17 17 18 18 #include "Lvalue.h" 19 20 #include "GenPoly.h"21 19 22 20 #include "SynTree/Declaration.h" … … 65 63 66 64 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 71 71 } 72 72 … … 107 107 assert( function ); 108 108 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 ) ) { 117 111 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 118 deref->get_results().push_back( app Type->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 ); 121 115 return deref; 122 116 } else {
Note:
See TracChangeset
for help on using the changeset viewer.