Ignore:
Timestamp:
Mar 23, 2017, 11:37:27 AM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
bd4d011
Parents:
578b637
Message:

Fixed autogen constructors for concurrent sues

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Autogen.cc

    r578b637 rbcda04c  
    218218
    219219                /// generates a function (?{}, ?=?, ^?{}) based on the data argument and members. If function is generated, inserts the type into the map.
    220                 void gen( const FuncData & data ) {
     220                void gen( const FuncData & data, bool concurrent_type ) {
    221221                        if ( ! shouldGenerate( data.map, aggregateDecl ) ) return;
    222222                        FunctionType * ftype = data.genType( refType );
     223
     224                        if(concurrent_type && InitTweak::isDestructor( data.fname )) {
     225                                ftype->get_parameters().front()->get_type()->set_mutex( true );
     226                        }
     227
    223228                        cloneAll( typeParams, ftype->get_forall() );
    224229                        *out++ = genFunc( data.fname, ftype, functionNesting );
     
    403408                auto generator = makeFuncGenerator( aggregateDecl, refType, functionNesting, typeParams, back_inserter( newFuncs ) );
    404409                for ( const FuncData & d : data ) {
    405                         generator.gen( d );
    406                 }
     410                        generator.gen( d, aggregateDecl->is_thread() || aggregateDecl->is_monitor() );
     411                }
     412
    407413                // field ctors are only generated if default constructor and copy constructor are both generated
    408414                unsigned numCtors = std::count_if( newFuncs.begin(), newFuncs.end(), [](FunctionDecl * dcl) { return InitTweak::isConstructor( dcl->get_name() ); } );
Note: See TracChangeset for help on using the changeset viewer.