Changeset d4f1521


Ignore:
Timestamp:
Nov 27, 2019, 5:04:19 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
0f9ceacb
Parents:
30763fd (diff), 397c101a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into relaxed_ready

Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/kernel.hfa

    r30763fd rd4f1521  
    2020#include "invoke.h"
    2121#include "time_t.hfa"
     22#include "coroutine.hfa"
    2223
    2324extern "C" {
  • libcfa/src/concurrency/monitor.hfa

    r30763fd rd4f1521  
    3838        dtor_node     = NULL;
    3939}
     40
     41static inline void ^?{}(monitor_desc & ) {}
    4042
    4143struct monitor_guard_t {
  • src/Concurrency/Keywords.cc

    r30763fd rd4f1521  
    5959
    6060                Declaration * postmutate( StructDecl * decl );
     61                DeclarationWithType * postmutate( FunctionDecl * decl );
    6162
    6263                void handle( StructDecl * );
     
    7778                KeywordCastExpr::Target cast_target;
    7879
    79                 StructDecl* type_decl = nullptr;
     80                StructDecl   * type_decl = nullptr;
     81                FunctionDecl * dtor_decl = nullptr;
    8082        };
    8183
     
    9799                        "__thrd",
    98100                        "get_thread",
    99                         "thread keyword requires threads to be in scope, add #include <thread.hfa>",
     101                        "thread keyword requires threads to be in scope, add #include <thread.hfa>\n",
    100102                        true,
    101103                        KeywordCastExpr::Thread
     
    129131                        "__cor",
    130132                        "get_coroutine",
    131                         "coroutine keyword requires coroutines to be in scope, add #include <coroutine.hfa>",
     133                        "coroutine keyword requires coroutines to be in scope, add #include <coroutine.hfa>\n",
    132134                        true,
    133135                        KeywordCastExpr::Coroutine
     
    161163                        "__mon",
    162164                        "get_monitor",
    163                         "monitor keyword requires monitors to be in scope, add #include <monitor.hfa>",
     165                        "monitor keyword requires monitors to be in scope, add #include <monitor.hfa>\n",
    164166                        false,
    165167                        KeywordCastExpr::Monitor
     
    284286        }
    285287
     288        DeclarationWithType * ConcurrentSueKeyword::postmutate( FunctionDecl * decl ) {
     289                if( !type_decl ) return decl;
     290                if( !CodeGen::isDestructor( decl->name ) ) return decl;
     291
     292                auto params = decl->type->parameters;
     293                if( params.size() != 1 ) return decl;
     294
     295                auto type = dynamic_cast<ReferenceType*>( params.front()->get_type() );
     296                if( !type ) return decl;
     297
     298                auto stype = dynamic_cast<StructInstType*>( type->base );
     299                if( !stype ) return decl;
     300                if( stype->baseStruct != type_decl ) return decl;
     301
     302                if( !dtor_decl ) dtor_decl = decl;
     303                return decl;
     304        }
     305
    286306        Expression * ConcurrentSueKeyword::postmutate( KeywordCastExpr * cast ) {
    287307                if ( cast_target == cast->target ) {
    288308                        // convert (thread &)t to (thread_desc &)*get_thread(t), etc.
    289309                        if( !type_decl ) SemanticError( cast, context_error );
     310                        if( !dtor_decl ) SemanticError( cast, context_error );
    290311                        Expression * arg = cast->arg;
    291312                        cast->arg = nullptr;
     
    308329
    309330                if( !type_decl ) SemanticError( decl, context_error );
     331                if( !dtor_decl ) SemanticError( decl, context_error );
    310332
    311333                FunctionDecl * func = forwardDeclare( decl );
  • src/ControlStruct/MLEMutator.cc

    r30763fd rd4f1521  
    231231
    232232        Statement *MLEMutator::mutateLoop( Statement *bodyLoop, Entry &e ) {
     233                // only generate these when needed
     234                if( !e.isContUsed() && !e.isBreakUsed() ) return bodyLoop;
     235
    233236                // ensure loop body is a block
    234                 CompoundStmt *newBody;
    235                 if ( ! (newBody = dynamic_cast<CompoundStmt *>( bodyLoop )) ) {
    236                         newBody = new CompoundStmt();
    237                         newBody->get_kids().push_back( bodyLoop );
    238                 } // if
    239 
    240                 // only generate these when needed
     237                CompoundStmt * newBody = new CompoundStmt();
     238                newBody->get_kids().push_back( bodyLoop );
    241239
    242240                if ( e.isContUsed() ) {
  • tests/raii/dtor-early-exit.cfa

    r30763fd rd4f1521  
    217217}
    218218
     219void i() {
     220        // potential loop
     221        for() {
     222                if(true) continue;
     223                int t = 0;
     224        }
     225}
     226
    219227// TODO: implement __label__ and uncomment these lines
    220228void computedGoto() {
Note: See TracChangeset for help on using the changeset viewer.