Ignore:
Timestamp:
Jul 13, 2017, 1:44:58 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:
2463d0e
Parents:
c6976ba
Message:

Remove several missing-reference related hacks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rc6976ba r0a81c3f  
    338338                        if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic && operatorLookup( varExpr->get_var()->get_name(), opInfo ) ) {
    339339                                std::list< Expression* >::iterator arg = applicationExpr->get_args().begin();
    340                                 switch ( opInfo.type ) {
    341                                   case OT_PREFIXASSIGN:
    342                                   case OT_POSTFIXASSIGN:
    343                                   case OT_INFIXASSIGN:
    344                                   case OT_CTOR:
    345                                   case OT_DTOR:
    346                                         {
    347                                                 assert( arg != applicationExpr->get_args().end() );
    348                                                 if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) {
    349                                                         // remove & from first assignment/ctor argument
    350                                                         *arg = addrExpr->get_arg();
    351                                                 } else {
    352                                                         // no address-of operator, so must be a pointer - add dereference
    353                                                         // NOTE: if the assertion starts to trigger, check that the application expr isn't being shared.
    354                                                         // Since its arguments are modified here, this assertion most commonly triggers when the application
    355                                                         // is visited multiple times.
    356                                                         UntypedExpr * newExpr = new UntypedExpr( new NameExpr( "*?" ) );
    357                                                         newExpr->get_args().push_back( *arg );
    358                                                         Type * type = InitTweak::getPointerBase( (*arg)->get_result() );
    359                                                         assertf( type, "First argument to a derefence must be a pointer. Ensure that expressions are not being shared." );
    360                                                         newExpr->set_result( type->clone() );
    361                                                         *arg = newExpr;
    362                                                 } // if
    363                                                 break;
    364                                         }
    365 
    366                                   default:
    367                                         // do nothing
    368                                         ;
    369                                 } // switch
    370 
    371340                                switch ( opInfo.type ) {
    372341                                  case OT_INDEX:
Note: See TracChangeset for help on using the changeset viewer.