Changeset f6e8c67 for src/ResolvExpr
- Timestamp:
- Mar 6, 2024, 6:06:43 AM (10 months ago)
- Branches:
- master
- Children:
- 647d633
- Parents:
- bbf2cb1 (diff), af60383 (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/ResolvExpr/Resolver.cc
rbbf2cb1 rf6e8c67 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.