Changeset bc61563
- Timestamp:
- Feb 27, 2024, 10:19:19 AM (10 months ago)
- Branches:
- master
- Children:
- 4c0b674
- Parents:
- f1149ac
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/Resolver.cc
rf1149ac rbc61563 412 412 413 413 void resolveWithExprs(std::vector<ast::ptr<ast::Expr>> & exprs, std::list<ast::ptr<ast::Stmt>> & stmtsToAdd); 414 bool shouldGenCtorInit( const ast::ObjectDecl * ) const; 414 415 415 416 void beginScope() { managedTypes.beginScope(); } … … 581 582 } 582 583 584 bool Resolver::shouldGenCtorInit( ast::ObjectDecl const * decl ) const { 585 // If we shouldn't try to construct it, then don't. 586 if ( !InitTweak::tryConstruct( decl ) ) return false; 587 // Otherwise, if it is a managed type, we may construct it. 588 if ( managedTypes.isManaged( decl ) ) return true; 589 // Skip construction if it is trivial at compile-time. 590 if ( InitTweak::isConstExpr( decl->init ) ) return false; 591 // Skip construction for local declarations. 592 return ( !isInFunction() || decl->storage.is_static ); 593 } 594 583 595 const ast::ObjectDecl * Resolver::previsit( const ast::ObjectDecl * objectDecl ) { 584 596 // To handle initialization of routine pointers [e.g. int (*fp)(int) = foo()], … … 615 627 // this object in visitor pass, thus disabling CtorInit codegen. 616 628 // this happens on aggregate members and function parameters. 617 if ( InitTweak::tryConstruct( mutDecl ) && ( managedTypes.isManaged( mutDecl ) || ((! isInFunction() || mutDecl->storage.is_static ) && ! InitTweak::isConstExpr( mutDecl->init ) )) ) {629 if ( shouldGenCtorInit( mutDecl ) ) { 618 630 // constructed objects cannot be designated 619 631 if ( InitTweak::isDesignated( mutDecl->init ) ) {
Note: See TracChangeset
for help on using the changeset viewer.