Changeset bcda04c for src/SymTab


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

Fixed autogen constructors for concurrent sues

Location:
src/SymTab
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified 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() ); } );
  • TabularUnified src/SymTab/Validate.cc

    r578b637 rbcda04c  
    4343#include "Common/utility.h"
    4444#include "Common/UniqueName.h"
     45#include "Concurrency/Keywords.h"
    4546#include "Validate.h"
    4647#include "SynTree/Visitor.h"
     
    225226                ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    226227                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
     228                Concurrency::applyKeywords( translationUnit );
    227229                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecayPass
     230                Concurrency::implementMutexFuncs( translationUnit );
     231                Concurrency::implementThreadStarter( translationUnit );
    228232                acceptAll( translationUnit, epc );
    229233                ReturnChecker::checkFunctionReturns( translationUnit );
Note: See TracChangeset for help on using the changeset viewer.