Changeset 64071c2 for src/CodeGen
- Timestamp:
- Jun 6, 2016, 2:16:00 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:
- 7baed7d
- Parents:
- 321a2481
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/CodeGen/CodeGenerator.cc ¶
r321a2481 r64071c2 257 257 std::list< Expression* >::iterator arg = applicationExpr->get_args().begin(); 258 258 switch ( opInfo.type ) { 259 case OT_CTOR:260 case OT_DTOR:261 {262 // if the first argument's type is const then GCC complains. In this263 // case, output an explicit ctor/dtor call and exit, rather than following264 // the normal path265 assert( arg != applicationExpr->get_args().end() );266 assert( (*arg)->get_results().size() >= 1 );267 Type * baseType = InitTweak::getPointerBase( (*arg)->get_results().front() );268 if ( baseType->get_isConst() ) {269 // cast away the qualifiers, to eliminate warnings270 Type * newType = baseType->clone();271 newType->get_qualifiers() = Type::Qualifiers();272 *arg = new CastExpr( *arg, new PointerType( Type::Qualifiers(), newType ) );273 varExpr->accept( *this );274 output << "(";275 genCommaList( applicationExpr->get_args().begin(), applicationExpr->get_args().end() );276 output << ")";277 return;278 }279 }280 // intentional fallthrough - instrinsic ctor/dtor for non-const objects should281 // be handled the same way as assignment282 259 case OT_PREFIXASSIGN: 283 260 case OT_POSTFIXASSIGN: 284 261 case OT_INFIXASSIGN: 262 case OT_CTOR: 263 case OT_DTOR: 285 264 { 286 265 assert( arg != applicationExpr->get_args().end() ); … … 324 303 if ( applicationExpr->get_args().size() == 1 ) { 325 304 // the expression fed into a single parameter constructor or destructor 326 // may contain side effects - output as a voidexpression327 output << "( (void)(";305 // may contain side effects, so must still output this expression 306 output << "("; 328 307 (*arg++)->accept( *this ); 329 output << ") )/* " << opInfo.inputName << " */";308 output << ") /* " << opInfo.inputName << " */"; 330 309 } else if ( applicationExpr->get_args().size() == 2 ) { 331 310 // intrinsic two parameter constructors are essentially bitwise assignment … … 409 388 if ( untypedExpr->get_args().size() == 1 ) { 410 389 // the expression fed into a single parameter constructor or destructor 411 // may contain side effects - output as a voidexpression412 output << "( (void)(";390 // may contain side effects, so must still output this expression 391 output << "("; 413 392 (*arg++)->accept( *this ); 414 output << ") )/* " << opInfo.inputName << " */";393 output << ") /* " << opInfo.inputName << " */"; 415 394 } else if ( untypedExpr->get_args().size() == 2 ) { 416 395 // intrinsic two parameter constructors are essentially bitwise assignment
Note: See TracChangeset
for help on using the changeset viewer.