Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/Resolver.cc

    rbc61563 r14755e5  
    412412
    413413        void resolveWithExprs(std::vector<ast::ptr<ast::Expr>> & exprs, std::list<ast::ptr<ast::Stmt>> & stmtsToAdd);
    414         bool shouldGenCtorInit( const ast::ObjectDecl * ) const;
    415414
    416415        void beginScope() { managedTypes.beginScope(); }
     
    582581}
    583582
    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 
    595583const ast::ObjectDecl * Resolver::previsit( const ast::ObjectDecl * objectDecl ) {
    596584        // To handle initialization of routine pointers [e.g. int (*fp)(int) = foo()],
     
    627615                        // this object in visitor pass, thus disabling CtorInit codegen.
    628616                        // this happens on aggregate members and function parameters.
    629                         if ( shouldGenCtorInit( mutDecl ) ) {
     617                        if ( InitTweak::tryConstruct( mutDecl ) && ( managedTypes.isManaged( mutDecl ) || ((! isInFunction() || mutDecl->storage.is_static ) && ! InitTweak::isConstExpr( mutDecl->init ) ) ) ) {
    630618                                // constructed objects cannot be designated
    631619                                if ( InitTweak::isDesignated( mutDecl->init ) ) {
Note: See TracChangeset for help on using the changeset viewer.