Changeset 02ad3f5 for src/GenPoly
- Timestamp:
- Apr 13, 2016, 5:40:28 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- b11fac4
- Parents:
- aa19ccf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Lvalue.cc
raa19ccf r02ad3f5 17 17 18 18 #include "Lvalue.h" 19 20 #include "GenPoly.h" 19 21 20 22 #include "SynTree/Declaration.h" … … 63 65 64 66 namespace { 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 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; 71 71 } 72 72 … … 107 107 assert( function ); 108 108 109 std::string typeName; 110 if ( isLvalueRet( function ) && ! isIntrinsicApp( appExpr ) ) { 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 ) ) { 114 // make sure cast for polymorphic type is inside dereference 115 expr = new CastExpr( appExpr, new PointerType( Type::Qualifiers(), appType->clone() ) ); 116 } 111 117 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 112 deref->get_results().push_back( app Expr->get_results().front() );113 appExpr->get_results().front() = new PointerType( Type::Qualifiers(), deref->get_results().front()->clone());114 deref->get_args().push_back( appExpr );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 ); 115 121 return deref; 116 122 } else {
Note: See TracChangeset
for help on using the changeset viewer.