Changeset c2ce2350 for src/CodeGen
- Timestamp:
- Apr 27, 2016, 5:11:26 PM (9 years ago)
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/CodeGenerator.cc
r1b31345 rc2ce2350 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Thu Apr 14 17:10:21201612 // Last Modified On : Wed Apr 27 11:59:36 2016 13 13 // Update Count : 255 14 14 // … … 239 239 case OT_INFIXASSIGN: 240 240 case OT_CTOR: 241 case OT_DTOR: 241 242 { 242 243 assert( arg != applicationExpr->get_args().end() ); … … 273 274 274 275 case OT_CTOR: 276 case OT_DTOR: 275 277 if ( applicationExpr->get_args().size() == 1 ) { 276 // the expression fed into a single parameter constructor may contain277 // side effects - output as a void expression278 // the expression fed into a single parameter constructor or destructor 279 // may contain side effects - output as a void expression 278 280 output << "((void)("; 279 281 (*arg++)->accept( *this ); 280 output << ")) /* ?{}*/";282 output << ")) /* " << opInfo.inputName << " */"; 281 283 } else if ( applicationExpr->get_args().size() == 2 ) { 282 // intrinsic constructors are essentially bitwise assignment284 // intrinsic two parameter constructors are essentially bitwise assignment 283 285 output << "("; 284 286 (*arg++)->accept( *this ); 285 287 output << opInfo.symbol; 286 288 (*arg)->accept( *this ); 287 output << ") /* ?{}*/";289 output << ") /* " << opInfo.inputName << " */"; 288 290 } else { 289 // no tconstructors with 0 or more than 2 parameters291 // no constructors with 0 or more than 2 parameters 290 292 assert( false ); 291 293 } 292 294 break; 293 294 case OT_DTOR:295 // intrinsic destructors do nothing - don't generate any code296 output << " /* " << dynamic_cast<VariableExpr*>(applicationExpr->get_function())->get_var()->get_name() << " */";297 break;298 295 299 296 case OT_PREFIX: … … 360 357 assert( false ); 361 358 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 } 366 379 break; 367 380
Note: See TracChangeset
for help on using the changeset viewer.