Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Concurrency/Keywords.cc

    r97e3296 rbe9288a  
    200200                std::list<DeclarationWithType*> findMutexArgs( FunctionDecl* );
    201201                void validate( DeclarationWithType * );
    202                 void addStatments( FunctionDecl* func, CompoundStmt *, const std::list<DeclarationWithType * > &);
     202                void addStatments( CompoundStmt *, const std::list<DeclarationWithType * > &);
    203203
    204204                static void implement( std::list< Declaration * > & translationUnit ) {
     
    210210                StructDecl* monitor_decl = nullptr;
    211211                StructDecl* guard_decl = nullptr;
    212 
    213                 static std::unique_ptr< Type > generic_func;
    214212        };
    215 
    216         std::unique_ptr< Type > MutexKeyword::generic_func = std::unique_ptr< Type >(
    217                 new FunctionType(
    218                         noQualifiers,
    219                         true
    220                 )
    221         );
    222213
    223214        //-----------------------------------------------------------------------------
     
    403394        // Mutex keyword implementation
    404395        //=============================================================================================
    405 
    406396        void MutexKeyword::visit(FunctionDecl* decl) {
    407397                Visitor::visit(decl);
     
    420410                if( !guard_decl ) throw SemanticError( "mutex keyword requires monitors to be in scope, add #include <monitor>", decl );
    421411
    422                 addStatments( decl, body, mutexArgs );
     412                addStatments( body, mutexArgs );
    423413        }
    424414
     
    466456        }
    467457
    468         void MutexKeyword::addStatments( FunctionDecl* func, CompoundStmt * body, const std::list<DeclarationWithType * > & args ) {
     458        void MutexKeyword::addStatments( CompoundStmt * body, const std::list<DeclarationWithType * > & args ) {
    469459                ObjectDecl * monitors = new ObjectDecl(
    470460                        "__monitors",
     
    497487                );
    498488
    499                 assert(generic_func);
    500 
    501489                //in reverse order :
    502                 // monitor_guard_t __guard = { __monitors, #, func };
     490                // monitor_guard_t __guard = { __monitors, # };
    503491                body->push_front(
    504492                        new DeclStmt( noLabels, new ObjectDecl(
     
    514502                                        {
    515503                                                new SingleInit( new VariableExpr( monitors ) ),
    516                                                 new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) ),
    517                                                 new SingleInit( new CastExpr( new VariableExpr( func ), generic_func->clone() ) )
     504                                                new SingleInit( new ConstantExpr( Constant::from_ulong( args.size() ) ) )
    518505                                        },
    519506                                        noDesignators,
Note: See TracChangeset for help on using the changeset viewer.