Ignore:
Timestamp:
Nov 9, 2016, 2:05:09 PM (8 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:
23bb1b9
Parents:
8780e30
Message:

refactor some code that generates dereference and assignment calls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r8780e30 rb3b2077  
    509509                                        // an AddressExpr.  Effectively, this turns
    510510                                        //   lvalue T f();
    511                                         //   &*f()
     511                                        //   &*f();
    512512                                        // into
     513                                        //   T * f();
    513514                                        //   T * tmp_cp_retN;
    514                                         //   tmp_cp_ret_N = &*(tmp_cp_ret_N = &*f(), tmp_cp_ret);
     515                                        //   &*(tmp_cp_retN = &*f(), tmp_cp_retN);              // the first * and second & are generated here
    515516                                        // which work out in terms of types, but is pretty messy. It would be nice to find a better way.
    516517                                        assign->get_args().back() = new AddressExpr( assign->get_args().back() );
    517518
    518                                         Type * resultType = returnDecl->get_type()->clone();
    519519                                        returnDecl->set_type( new PointerType( Type::Qualifiers(), returnDecl->get_type() ) );
    520                                         UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) );
    521                                         deref->get_args().push_back( retExpr );
    522                                         deref->set_result( resultType );
    523                                         retExpr = deref;
     520                                        retExpr->set_result( new PointerType( Type::Qualifiers(), retExpr->get_result() ) );
     521                                        retExpr = UntypedExpr::createDeref( retExpr );
    524522                                } // if
    525523                                retExpr->set_env( env->clone() );
Note: See TracChangeset for help on using the changeset viewer.