Ignore:
Timestamp:
Jun 1, 2016, 11:54:23 AM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
be945ac
Parents:
70f89d00
Message:

can construct global const objects, except with intrinsic constructors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/GenInit.cc

    r70f89d00 rf1b1e4c  
    143143                if ( tryConstruct( objDecl ) ) {
    144144                        if ( inFunction ) {
    145                                 // remove qualifiers so that const objects can be initialized, and attach the
    146                                 // qualifiers to ConstructorInit so that they can be replaced after resolving
    147                                 Type * type = objDecl->get_type();
    148                                 Type::Qualifiers qualifiers = type->get_qualifiers();
    149                                 type->get_qualifiers() = Type::Qualifiers();
    150 
    151145                                if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) {
    152146                                        // call into makeArrayFunction from validate.cc to generate calls to ctor/dtor for each element of array
     
    170164                                                assert( ctor.size() == 1 );
    171165                                                assert( dtor.size() == 1 );
    172 
    173                                                 objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init(), objDecl, qualifiers ) );
     166                                                objDecl->set_init( new ConstructorInit( new ImplicitCtorDtorStmt( ctor.front() ), new ImplicitCtorDtorStmt( dtor.front() ), objDecl->get_init() ) );
    174167                                        } else {
    175168                                                // array came with an initializer list: initialize each element
     
    191184                                        ExprStmt * ctorStmt = new ExprStmt( noLabels, ctor );
    192185                                        ExprStmt * dtorStmt = new ExprStmt( noLabels, dtor );
    193                                         objDecl->set_init( new ConstructorInit( ctorStmt, dtorStmt, objDecl->get_init(), objDecl, qualifiers ) );
     186                                        objDecl->set_init( new ConstructorInit( new ImplicitCtorDtorStmt( ctorStmt ), new ImplicitCtorDtorStmt( dtorStmt ), objDecl->get_init() ) );
    194187                                }
    195188                        }
Note: See TracChangeset for help on using the changeset viewer.