Changeset 90152a4 for src/InitTweak/InitTweak.cc
- Timestamp:
- Aug 27, 2018, 4:40:34 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b7c89aa
- Parents:
- f9feab8 (diff), 305581d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
rf9feab8 r90152a4 225 225 // xxx - this shouldn't be an error, but need a way to 226 226 // terminate without creating output, so should catch this error 227 throw SemanticError("unbalanced list initializers" );227 SemanticError( init->location, "unbalanced list initializers" ); 228 228 } 229 229 … … 296 296 ObjectDecl * objDecl = dynamic_cast< ObjectDecl * >( dwt ); 297 297 if ( ! objDecl ) return false; 298 return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) && 299 (objDecl->get_init() == nullptr || 298 return (objDecl->get_init() == nullptr || 300 299 ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() )) 301 300 && ! objDecl->get_storageClasses().is_extern … … 409 408 return allofCtorDtor( stmt, []( Expression * callExpr ){ 410 409 if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) { 411 FunctionType *funcType = GenPoly::getFunctionType( appExpr-> get_function()->get_result());410 FunctionType *funcType = GenPoly::getFunctionType( appExpr->function->result ); 412 411 assert( funcType ); 413 412 return funcType->get_parameters().size() == 1; … … 529 528 } 530 529 if ( dynamic_cast< ReferenceType * >( dst->result ) ) { 531 dst = new AddressExpr( dst ); 530 for (int depth = dst->result->referenceDepth(); depth > 0; depth--) { 531 dst = new AddressExpr( dst ); 532 } 532 533 } else { 533 534 dst = new CastExpr( dst, new ReferenceType( noQualifiers, dst->result->clone() ) ); 534 535 } 535 536 if ( dynamic_cast< ReferenceType * >( src->result ) ) { 536 src = new CastExpr( src, new ReferenceType( noQualifiers, src->result->stripReferences()->clone() ) ); 537 for (int depth = src->result->referenceDepth(); depth > 0; depth--) { 538 src = new AddressExpr( src ); 539 } 540 // src = new CastExpr( src, new ReferenceType( noQualifiers, src->result->stripReferences()->clone() ) ); 537 541 } 538 542 return new ApplicationExpr( VariableExpr::functionPointer( assign ), { dst, src } ); … … 564 568 void previsit( ConstantExpr * ) {} 565 569 570 void previsit( VariableExpr * varExpr ) { 571 visit_children = false; 572 573 if ( EnumInstType * inst = dynamic_cast< EnumInstType * >( varExpr->result ) ) { 574 long long int value; 575 if ( inst->baseEnum->valueOf( varExpr->var, value ) ) { 576 // enumerators are const expr 577 return; 578 } 579 } 580 isConstExpr = false; 581 } 582 566 583 bool isConstExpr = true; 567 584 };
Note: See TracChangeset
for help on using the changeset viewer.