Changeset c2ce2350


Ignore:
Timestamp:
Apr 27, 2016, 5:11:26 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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, with_gc
Children:
4ffdd63
Parents:
1b31345
git-author:
Rob Schluntz <rschlunt@…> (04/27/16 11:25:38)
git-committer:
Rob Schluntz <rschlunt@…> (04/27/16 17:11:26)
Message:

fix CodeGenerator? to output unresolved intrinsic constructor/destructor calls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r1b31345 rc2ce2350  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Thu Apr 14 17:10:21 2016
     12// Last Modified On : Wed Apr 27 11:59:36 2016
    1313// Update Count     : 255
    1414//
     
    239239                                  case OT_INFIXASSIGN:
    240240                                  case OT_CTOR:
     241                                  case OT_DTOR:
    241242                                        {
    242243                                                assert( arg != applicationExpr->get_args().end() );
     
    273274
    274275                                  case OT_CTOR:
     276                                  case OT_DTOR:
    275277                                        if ( applicationExpr->get_args().size() == 1 ) {
    276                                                 // the expression fed into a single parameter constructor may contain
    277                                                 // side effects - output as a void expression
     278                                                // the expression fed into a single parameter constructor or destructor
     279                                                // may contain side effects - output as a void expression
    278280                                                output << "((void)(";
    279281                                                (*arg++)->accept( *this );
    280                                                 output << ")) /* ?{} */";
     282                                                output << ")) /* " << opInfo.inputName << " */";
    281283                                        } else if ( applicationExpr->get_args().size() == 2 ) {
    282                                                 // intrinsic constructors are essentially bitwise assignment
     284                                                // intrinsic two parameter constructors are essentially bitwise assignment
    283285                                                output << "(";
    284286                                                (*arg++)->accept( *this );
    285287                                                output << opInfo.symbol;
    286288                                                (*arg)->accept( *this );
    287                                                 output << ") /* ?{} */";
     289                                                output << ") /* " << opInfo.inputName << " */";
    288290                                        } else {
    289                                                 // not constructors with 0 or more than 2 parameters
     291                                                // no constructors with 0 or more than 2 parameters
    290292                                                assert( false );
    291293                                        }
    292294                                        break;
    293 
    294                                   case OT_DTOR:
    295                                   // intrinsic destructors do nothing - don't generate any code
    296                                   output << " /* " << dynamic_cast<VariableExpr*>(applicationExpr->get_function())->get_var()->get_name() << " */";
    297                                   break;
    298295
    299296                                  case OT_PREFIX:
     
    360357                                        assert( false );
    361358
    362                                         case OT_CTOR:
    363                                         case OT_DTOR:
    364                                         // intrinsic constructors should never be called
    365                                         // intrinsic destructors do nothing
     359
     360                                  case OT_CTOR:
     361                                  case OT_DTOR:
     362                                        if ( untypedExpr->get_args().size() == 1 ) {
     363                                                // the expression fed into a single parameter constructor or destructor
     364                                                // may contain side effects - output as a void expression
     365                                                output << "((void)(";
     366                                                (*arg++)->accept( *this );
     367                                                output << ")) /* " << opInfo.inputName << " */";
     368                                        } else if ( untypedExpr->get_args().size() == 2 ) {
     369                                                // intrinsic two parameter constructors are essentially bitwise assignment
     370                                                output << "(";
     371                                                (*arg++)->accept( *this );
     372                                                output << opInfo.symbol;
     373                                                (*arg)->accept( *this );
     374                                                output << ") /* " << opInfo.inputName << " */";
     375                                        } else {
     376                                                // no constructors with 0 or more than 2 parameters
     377                                                assert( false );
     378                                        }
    366379                                        break;
    367380
Note: See TracChangeset for help on using the changeset viewer.