Changeset fc56cdbf for src/GenPoly
- Timestamp:
- Aug 22, 2017, 7:13:29 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 8135d4c
- Parents:
- 5fb6830
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Lvalue.cc
r5fb6830 rfc56cdbf 119 119 120 120 void convertLvalue( std::list< Declaration* >& translationUnit ) { 121 std::cerr << "convertLvalue" << std::endl;122 121 PassVisitor<ReferenceConversions> refCvt; 123 122 PassVisitor<ReferenceTypeElimination> elim; … … 300 299 int depth1 = refType->referenceDepth(); 301 300 int depth2 = otherRef->referenceDepth(); 301 int diff = depth1-depth2; 302 if ( diff == 0 ) { 303 assertf( depth1 == depth2, "non-intrinsic reference with cast of reference to reference not yet supported: %d %d %s", depth1, depth2, toString( castExpr ).c_str() ); 304 PRINT( std::cerr << castExpr << std::endl; ) 305 return castExpr; 306 } else if ( diff < 0 ) { 307 Expression * ret = castExpr->get_arg(); 308 for ( int i = 0; i < diff; ++i ) { 309 ret = mkDeref( ret ); 310 } 311 ret->set_env( castExpr->get_env() ); 312 delete ret->get_result(); 313 ret->set_result( castExpr->get_result() ); 314 castExpr->set_env( nullptr ); 315 castExpr->set_arg( nullptr ); 316 castExpr->set_result( nullptr ); 317 delete castExpr; 318 return ret; 319 } else if ( diff > 0 ) { 320 Expression * ret = castExpr->get_arg(); 321 for ( int i = 0; i < diff; ++i ) { 322 ret = new AddressExpr( ret ); 323 } 324 ret->set_env( castExpr->get_env() ); 325 delete ret->get_result(); 326 ret->set_result( castExpr->get_result() ); 327 castExpr->set_env( nullptr ); 328 castExpr->set_arg( nullptr ); 329 castExpr->set_result( nullptr ); 330 delete castExpr; 331 return ret; 332 } 333 302 334 assertf( depth1 == depth2, "non-intrinsic reference with cast of reference to reference not yet supported: %d %d %s", depth1, depth2, toString( castExpr ).c_str() ); 303 335 PRINT( std::cerr << castExpr << std::endl; )
Note: See TracChangeset
for help on using the changeset viewer.