Changeset 5ccb10d for src/InitTweak


Ignore:
Timestamp:
Aug 22, 2017, 6:41:28 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
0b5d871
Parents:
d104b02
Message:

Set reference size to base size, clean up debug code, remove more old-style NULLs from prelude

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    rd104b02 r5ccb10d  
    591591
    592592                                Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) );
    593                                 if ( callExpr->get_result()->get_lvalue() ) {
    594                                         // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any lvalue returning
    595                                         // non-intrinsic function. Add an AddressExpr to the call to negate the derefence and change the
    596                                         // type of the return temporary from T to T* to properly capture the return value. Then dereference
    597                                         // the result of the comma expression, since the lvalue returning call was originally wrapped with
    598                                         // an AddressExpr.  Effectively, this turns
    599                                         //   lvalue T f();
    600                                         //   &*f();
    601                                         // into
    602                                         //   T * f();
    603                                         //   T * tmp_cp_retN;
    604                                         //   &*(tmp_cp_retN = &*f(), tmp_cp_retN);              // the first * and second & are generated here
    605                                         // which work out in terms of types, but is pretty messy. It would be nice to find a better way.
    606                                         assign->get_args().back() = new AddressExpr( assign->get_args().back() );
    607 
    608                                         returnDecl->set_type( new PointerType( Type::Qualifiers(), returnDecl->get_type() ) );
    609                                         retExpr->set_result( new PointerType( Type::Qualifiers(), retExpr->get_result() ) );
    610                                         retExpr = UntypedExpr::createDeref( retExpr );
    611                                 } // if
    612593                                // move env from callExpr to retExpr
    613594                                retExpr->set_env( callExpr->get_env() );
Note: See TracChangeset for help on using the changeset viewer.