Changeset c935c3a


Ignore:
Timestamp:
Sep 13, 2017, 3:03:32 PM (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:
ed235b6
Parents:
b2e2e34 (diff), 982832e (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
src
Files:
3 added
48 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rb2e2e34 rc935c3a  
    258258
    259259        void CodeGenerator::visit( TraitDecl * traitDecl ) {
    260                 assertf( ! genC, "TraitDecl nodes should not reach code generation." );
     260                assertf( ! genC, "TraitDecls should not reach code generation." );
    261261                extension( traitDecl );
    262262                handleAggregate( traitDecl, "trait " );
     
    271271
    272272        void CodeGenerator::visit( TypeDecl * typeDecl ) {
    273                 if ( genC ) {
    274                         // really, we should mutate this into something that isn't a TypeDecl but that requires large-scale changes,
    275                         // still to be done
    276                         extension( typeDecl );
    277                         output << "extern unsigned long " << typeDecl->get_name();
    278                         if ( typeDecl->get_base() ) {
    279                                 output << " = sizeof( " << genType( typeDecl->get_base(), "", pretty, genC ) << " )";
    280                         } // if
    281                 } else {
    282                         output << typeDecl->genTypeString() << " " << typeDecl->get_name();
    283                         if ( typeDecl->get_kind() != TypeDecl::Any && typeDecl->get_sized() ) {
    284                                 output << " | sized(" << typeDecl->get_name() << ")";
    285                         }
    286                         if ( ! typeDecl->get_assertions().empty() ) {
    287                                 output << " | { ";
    288                                 genCommaList( typeDecl->get_assertions().begin(), typeDecl->get_assertions().end() );
    289                                 output << " }";
    290                         }
     273                assertf( ! genC, "TypeDecls should not reach code generation." );
     274                output << typeDecl->genTypeString() << " " << typeDecl->get_name();
     275                if ( typeDecl->get_kind() != TypeDecl::Any && typeDecl->get_sized() ) {
     276                        output << " | sized(" << typeDecl->get_name() << ")";
     277                }
     278                if ( ! typeDecl->get_assertions().empty() ) {
     279                        output << " | { ";
     280                        genCommaList( typeDecl->get_assertions().begin(), typeDecl->get_assertions().end() );
     281                        output << " }";
    291282                }
    292283        }
  • src/Common/PassVisitor.h

    rb2e2e34 rc935c3a  
    77#include "SynTree/Mutator.h"
    88#include "SynTree/Visitor.h"
     9
     10#include "SymTab/Indexer.h"
    911
    1012#include "SynTree/Initializer.h"
     
    145147        virtual Declaration* mutate( EnumDecl *aggregateDecl ) override final;
    146148        virtual Declaration* mutate( TraitDecl *aggregateDecl ) override final;
    147         virtual TypeDecl* mutate( TypeDecl *typeDecl ) override final;
     149        virtual Declaration* mutate( TypeDecl *typeDecl ) override final;
    148150        virtual Declaration* mutate( TypedefDecl *typeDecl ) override final;
    149151        virtual AsmDecl* mutate( AsmDecl *asmDecl ) override final;
     
    265267
    266268        void set_visit_children( bool& ref ) { bool_ref * ptr = visit_children_impl(pass, 0); if(ptr) ptr->set( ref ); }
     269
     270        void indexerScopeEnter  ()                             { indexer_impl_enterScope  ( pass, 0       ); }
     271        void indexerScopeLeave  ()                             { indexer_impl_leaveScope  ( pass, 0       ); }
     272        void indexerAddId       ( DeclarationWithType * node ) { indexer_impl_addId       ( pass, 0, node ); }
     273        void indexerAddType     ( NamedTypeDecl       * node ) { indexer_impl_addType     ( pass, 0, node ); }
     274        void indexerAddStruct   ( const std::string   & id   ) { indexer_impl_addStruct   ( pass, 0, id   ); }
     275        void indexerAddStruct   ( StructDecl          * node ) { indexer_impl_addStruct   ( pass, 0, node ); }
     276        void indexerAddStructFwd( StructDecl          * node ) { indexer_impl_addStructFwd( pass, 0, node ); }
     277        void indexerAddEnum     ( EnumDecl            * node ) { indexer_impl_addEnum     ( pass, 0, node ); }
     278        void indexerAddUnion    ( const std::string   & id   ) { indexer_impl_addUnion    ( pass, 0, id   ); }
     279        void indexerAddUnion    ( UnionDecl           * node ) { indexer_impl_addUnion    ( pass, 0, node ); }
     280        void indexerAddUnionFwd ( UnionDecl           * node ) { indexer_impl_addUnionFwd ( pass, 0, node ); }
     281        void indexerAddTrait    ( TraitDecl           * node ) { indexer_impl_addTrait    ( pass, 0, node ); }
     282
     283        template< typename TreeType, typename VisitorType >
     284        friend inline void indexerScopedAccept( TreeType * tree, VisitorType &visitor );
     285
     286        template< typename TreeType, typename VisitorType >
     287        friend inline void indexerScopedMutate( TreeType *& tree, VisitorType &visitor );
    267288};
    268289
     
    296317protected:
    297318        WithDeclsToAdd() = default;
    298         ~WithDeclsToAdd() = default;
     319        ~WithDeclsToAdd() {
     320                assert( declsToAddBefore.empty() );
     321        }
    299322
    300323public:
     
    351374};
    352375
     376class WithIndexer {
     377protected:
     378        WithIndexer() {}
     379        ~WithIndexer() {}
     380
     381public:
     382        SymTab::Indexer indexer;
     383};
     384
    353385#include "PassVisitor.impl.h"
  • src/Common/PassVisitor.impl.h

    rb2e2e34 rc935c3a  
    101101}
    102102
     103template< typename Container, typename VisitorType >
     104inline void maybeAccept( Container &container, VisitorType &visitor ) {
     105        SemanticError errors;
     106        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
     107                try {
     108                        if ( *i ) {
     109                                (*i)->accept( visitor );
     110                        }
     111                } catch( SemanticError &e ) {
     112                        e.set_location( (*i)->location );
     113                        errors.append( e );
     114                }
     115        }
     116        if ( ! errors.isEmpty() ) {
     117                throw errors;
     118        }
     119}
     120
     121template< typename Container, typename MutatorType >
     122inline void maybeMutateRef( Container &container, MutatorType &mutator ) {
     123        SemanticError errors;
     124        for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
     125                try {
     126                        if ( *i ) {
     127///                 *i = (*i)->acceptMutator( mutator );
     128                                *i = dynamic_cast< typename Container::value_type >( (*i)->acceptMutator( mutator ) );
     129                                assert( *i );
     130                        } // if
     131                } catch( SemanticError &e ) {
     132                        e.set_location( (*i)->location );
     133                        errors.append( e );
     134                } // try
     135        } // for
     136        if ( ! errors.isEmpty() ) {
     137                throw errors;
     138        } // if
     139}
     140
    103141template< typename pass_type >
    104142template< typename func_t >
     
    230268
    231269//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    232 
     270//========================================================================================================================================================================
     271//========================================================================================================================================================================
     272//========================================================================================================================================================================
     273//========================================================================================================================================================================
     274//========================================================================================================================================================================
     275//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     276
     277
     278//--------------------------------------------------------------------------
     279// ObjectDecl
    233280template< typename pass_type >
    234281void PassVisitor< pass_type >::visit( ObjectDecl * node ) {
    235         VISIT_BODY( node );
    236 }
    237 
     282        VISIT_START( node );
     283
     284        indexerScopedAccept( node->type         , *this );
     285        maybeAccept        ( node->init         , *this );
     286        maybeAccept        ( node->bitfieldWidth, *this );
     287
     288        if ( node->name != "" ) {
     289                indexerAddId( node );
     290        }
     291
     292        VISIT_END( node );
     293}
     294
     295template< typename pass_type >
     296DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) {
     297        MUTATE_START( node );
     298
     299        indexerScopedMutate( node->type         , *this );
     300        maybeMutateRef     ( node->init         , *this );
     301        maybeMutateRef     ( node->bitfieldWidth, *this );
     302
     303        if ( node->name != "" ) {
     304                indexerAddId( node );
     305        }
     306
     307        MUTATE_END( DeclarationWithType, node );
     308}
     309
     310//--------------------------------------------------------------------------
     311// FunctionDecl
    238312template< typename pass_type >
    239313void PassVisitor< pass_type >::visit( FunctionDecl * node ) {
    240         VISIT_BODY( node );
    241 }
    242 
     314        VISIT_START( node );
     315
     316        if ( node->name != "" ) {
     317                indexerAddId( node );
     318        }
     319
     320        {
     321                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     322                maybeAccept( node->type, *this );
     323                maybeAccept( node->statements, *this );
     324        }
     325
     326        VISIT_END( node );
     327}
     328
     329template< typename pass_type >
     330DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) {
     331        MUTATE_START( node );
     332
     333        if ( node->name != "" ) {
     334                indexerAddId( node );
     335        }
     336
     337        {
     338                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     339                maybeMutateRef( node->type, *this );
     340                maybeMutateRef( node->statements, *this );
     341        }
     342
     343        MUTATE_END( DeclarationWithType, node );
     344}
     345
     346//--------------------------------------------------------------------------
     347// StructDecl
    243348template< typename pass_type >
    244349void PassVisitor< pass_type >::visit( StructDecl * node ) {
    245         VISIT_BODY( node );
    246 }
    247 
     350        VISIT_START( node );
     351
     352        // make up a forward declaration and add it before processing the members
     353        // needs to be on the heap because addStruct saves the pointer
     354        indexerAddStructFwd( node );
     355
     356        {
     357                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     358                maybeAccept( node->parameters, *this );
     359                maybeAccept( node->members   , *this );
     360        }
     361
     362        // this addition replaces the forward declaration
     363        indexerAddStruct( node );
     364
     365        VISIT_END( node );
     366}
     367
     368template< typename pass_type >
     369Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
     370        MUTATE_START( node );
     371
     372        // make up a forward declaration and add it before processing the members
     373        // needs to be on the heap because addStruct saves the pointer
     374        indexerAddStructFwd( node );
     375
     376        {
     377                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     378                maybeMutateRef( node->parameters, *this );
     379                maybeMutateRef( node->members   , *this );
     380        }
     381
     382        // this addition replaces the forward declaration
     383        indexerAddStruct( node );
     384
     385        MUTATE_END( Declaration, node );
     386}
     387
     388//--------------------------------------------------------------------------
     389// UnionDecl
    248390template< typename pass_type >
    249391void PassVisitor< pass_type >::visit( UnionDecl * node ) {
    250         VISIT_BODY( node );
    251 }
    252 
     392        VISIT_START( node );
     393
     394        // make up a forward declaration and add it before processing the members
     395        indexerAddUnionFwd( node );
     396
     397        {
     398                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     399                maybeAccept( node->parameters, *this );
     400                maybeAccept( node->members   , *this );
     401        }
     402
     403        indexerAddUnion( node );
     404
     405        VISIT_END( node );
     406}
     407
     408template< typename pass_type >
     409Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) {
     410        MUTATE_START( node );
     411
     412        // make up a forward declaration and add it before processing the members
     413        indexerAddUnionFwd( node );
     414
     415        {
     416                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     417                maybeMutateRef( node->parameters, *this );
     418                maybeMutateRef( node->members   , *this );
     419        }
     420
     421        indexerAddUnion( node );
     422
     423        MUTATE_END( Declaration, node );
     424}
     425
     426//--------------------------------------------------------------------------
     427// EnumDecl
    253428template< typename pass_type >
    254429void PassVisitor< pass_type >::visit( EnumDecl * node ) {
    255         VISIT_BODY( node );
    256 }
    257 
     430        VISIT_START( node );
     431
     432        indexerAddEnum( node );
     433
     434        // unlike structs, contexts, and unions, enums inject their members into the global scope
     435        maybeAccept( node->parameters, *this );
     436        maybeAccept( node->members   , *this );
     437
     438        VISIT_END( node );
     439}
     440
     441template< typename pass_type >
     442Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
     443        MUTATE_START( node );
     444
     445        indexerAddEnum( node );
     446
     447        // unlike structs, contexts, and unions, enums inject their members into the global scope
     448        maybeMutateRef( node->parameters, *this );
     449        maybeMutateRef( node->members   , *this );
     450
     451        MUTATE_END( Declaration, node );
     452}
     453
     454//--------------------------------------------------------------------------
     455// TraitDecl
    258456template< typename pass_type >
    259457void PassVisitor< pass_type >::visit( TraitDecl * node ) {
    260         VISIT_BODY( node );
    261 }
    262 
     458        VISIT_START( node );
     459
     460        {
     461                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     462                maybeAccept( node->parameters, *this );
     463                maybeAccept( node->members   , *this );
     464        }
     465
     466        indexerAddTrait( node );
     467
     468        VISIT_END( node );
     469}
     470
     471template< typename pass_type >
     472Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) {
     473        MUTATE_START( node );
     474
     475        {
     476                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     477                maybeMutateRef( node->parameters, *this );
     478                maybeMutateRef( node->members   , *this );
     479        }
     480
     481        indexerAddTrait( node );
     482
     483        MUTATE_END( Declaration, node );
     484}
     485
     486//--------------------------------------------------------------------------
     487// TypeDecl
    263488template< typename pass_type >
    264489void PassVisitor< pass_type >::visit( TypeDecl * node ) {
    265         VISIT_BODY( node );
    266 }
    267 
     490        VISIT_START( node );
     491
     492        {
     493                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     494                maybeAccept( node->parameters, *this );
     495                maybeAccept( node->base      , *this );
     496        }
     497
     498        indexerAddType( node );
     499
     500        maybeAccept( node->assertions, *this );
     501
     502        indexerScopedAccept( node->init, *this );
     503
     504        VISIT_END( node );
     505}
     506
     507template< typename pass_type >
     508Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
     509        MUTATE_START( node );
     510
     511        {
     512                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     513                maybeMutateRef( node->parameters, *this );
     514                maybeMutateRef( node->base      , *this );
     515        }
     516
     517        indexerAddType( node );
     518
     519        maybeMutateRef( node->assertions, *this );
     520
     521        indexerScopedMutate( node->init, *this );
     522
     523        MUTATE_END( Declaration, node );
     524}
     525
     526//--------------------------------------------------------------------------
     527// TypedefDecl
    268528template< typename pass_type >
    269529void PassVisitor< pass_type >::visit( TypedefDecl * node ) {
    270         VISIT_BODY( node );
    271 }
    272 
     530        VISIT_START( node );
     531
     532        {
     533                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     534                maybeAccept( node->parameters, *this );
     535                maybeAccept( node->base      , *this );
     536        }
     537
     538        indexerAddType( node );
     539
     540        maybeAccept( node->assertions, *this );
     541
     542        VISIT_END( node );
     543}
     544
     545template< typename pass_type >
     546Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
     547        MUTATE_START( node );
     548
     549        {
     550                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     551                maybeMutateRef     ( node->parameters, *this );
     552                maybeMutateRef( node->base      , *this );
     553        }
     554
     555        indexerAddType( node );
     556
     557        maybeMutateRef( node->assertions, *this );
     558
     559        MUTATE_END( Declaration, node );
     560}
     561
     562//--------------------------------------------------------------------------
     563// AsmDecl
    273564template< typename pass_type >
    274565void PassVisitor< pass_type >::visit( AsmDecl * node ) {
    275         VISIT_BODY( node );
     566        VISIT_START( node );
     567
     568        maybeAccept( node->stmt, *this );
     569
     570        VISIT_END( node );
     571}
     572
     573template< typename pass_type >
     574AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
     575        MUTATE_START( node );
     576
     577        maybeMutateRef( node->stmt, *this );
     578
     579        MUTATE_END( AsmDecl, node );
    276580}
    277581
     
    281585void PassVisitor< pass_type >::visit( CompoundStmt * node ) {
    282586        VISIT_START( node );
    283         call_beginScope();
    284 
    285         visitStatementList( node->get_kids() );
    286 
    287         call_endScope();
     587        {
     588                auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     589                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
     590                visitStatementList( node->kids );
     591        }
    288592        VISIT_END( node );
    289593}
     
    292596CompoundStmt * PassVisitor< pass_type >::mutate( CompoundStmt * node ) {
    293597        MUTATE_START( node );
    294         call_beginScope();
    295 
    296         mutateStatementList( node->get_kids() );
    297 
    298         call_endScope();
     598        {
     599                auto guard1 = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     600                auto guard2 = makeFuncGuard( [this]() { call_beginScope();   }, [this]() { call_endScope();     } );
     601                mutateStatementList( node->kids );
     602        }
    299603        MUTATE_END( CompoundStmt, node );
    300604}
     
    306610        VISIT_START( node );
    307611
    308         visitExpression( node->get_expr() );
     612        visitExpression( node->expr );
    309613
    310614        VISIT_END( node );
     
    315619        MUTATE_START( node );
    316620
    317         node->set_expr( mutateExpression( node->get_expr() ) );
     621        node->expr = mutateExpression( node->expr );
    318622
    319623        MUTATE_END( Statement, node );
     
    338642        VISIT_START( node );
    339643
    340         visitExpression( node->get_condition() );
    341         node->set_thenPart ( visitStatement( node->get_thenPart() ) );
    342         node->set_elsePart ( visitStatement( node->get_elsePart() ) );
     644        visitExpression( node->condition );
     645        node->thenPart = visitStatement( node->thenPart );
     646        node->elsePart = visitStatement( node->elsePart );
    343647
    344648        VISIT_END( node );
     
    348652Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) {
    349653        MUTATE_START( node );
    350 
    351         node->set_condition( mutateExpression( node->get_condition() ) );
    352         node->set_thenPart ( mutateStatement ( node->get_thenPart()  ) );
    353         node->set_elsePart ( mutateStatement ( node->get_elsePart()  ) );
    354 
     654        {
     655                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     656                node->condition = mutateExpression( node->condition );
     657                node->thenPart  = mutateStatement ( node->thenPart  );
     658                node->elsePart  = mutateStatement ( node->elsePart  );
     659        }
    355660        MUTATE_END( Statement, node );
    356661}
     
    362667        VISIT_START( node );
    363668
    364         visitExpression( node->get_condition() );
    365         node->set_body( visitStatement( node->get_body() ) );
     669        visitExpression( node->condition );
     670        node->body = visitStatement( node->body );
    366671
    367672        VISIT_END( node );
     
    372677        MUTATE_START( node );
    373678
    374         node->set_condition( mutateExpression( node->get_condition() ) );
    375         node->set_body( mutateStatement( node->get_body() ) );
     679        node->condition = mutateExpression( node->condition );
     680        node->body      = mutateStatement ( node->body      );
    376681
    377682        MUTATE_END( Statement, node );
     
    383688void PassVisitor< pass_type >::visit( ForStmt * node ) {
    384689        VISIT_START( node );
    385 
    386         acceptAll( node->get_initialization(), *this );
    387         visitExpression( node->get_condition() );
    388         visitExpression( node->get_increment() );
    389         node->set_body( visitStatement( node->get_body() ) );
    390 
     690        {
     691                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     692                maybeAccept( node->initialization, *this );
     693                visitExpression( node->condition );
     694                visitExpression( node->increment );
     695                node->body = visitStatement( node->body );
     696        }
    391697        VISIT_END( node );
    392698}
     
    395701Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) {
    396702        MUTATE_START( node );
    397 
    398         mutateAll( node->get_initialization(), *this );
    399         node->set_condition( mutateExpression( node->get_condition() ) );
    400         node->set_increment( mutateExpression( node->get_increment() ) );
    401         node->set_body( mutateStatement( node->get_body() ) );
    402 
     703        {
     704                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     705                maybeMutateRef( node->initialization, *this );
     706                node->condition = mutateExpression( node->condition );
     707                node->increment = mutateExpression( node->increment );
     708                node->body      = mutateStatement ( node->body      );
     709        }
    403710        MUTATE_END( Statement, node );
    404711}
     
    410717        VISIT_START( node );
    411718
    412         visitExpression( node->get_condition() );
    413         visitStatementList( node->get_statements() );
     719        visitExpression   ( node->condition );
     720        visitStatementList( node->statements );
    414721
    415722        VISIT_END( node );
     
    420727        MUTATE_START( node );
    421728
    422         node->set_condition( mutateExpression( node->get_condition() ) );
    423         mutateStatementList( node->get_statements() );
     729        node->condition = mutateExpression( node->condition );
     730        mutateStatementList( node->statements );
    424731
    425732        MUTATE_END( Statement, node );
     
    432739        VISIT_START( node );
    433740
    434         visitExpression( node->get_condition() );
    435         visitStatementList( node->get_statements() );
     741        visitExpression   ( node->condition );
     742        visitStatementList( node->stmts    );
    436743
    437744        VISIT_END( node );
     
    442749        MUTATE_START( node );
    443750
    444         node->set_condition(  mutateExpression( node->get_condition() ) );
    445         mutateStatementList( node->get_statements() );
     751        node->condition = mutateExpression( node->condition );
     752        mutateStatementList( node->stmts );
    446753
    447754        MUTATE_END( Statement, node );
     
    466773        VISIT_START( node );
    467774
    468         visitExpression( node->get_expr() );
     775        visitExpression( node->expr );
    469776
    470777        VISIT_END( node );
     
    475782        MUTATE_START( node );
    476783
    477         node->set_expr( mutateExpression( node->get_expr() ) );
     784        node->expr = mutateExpression( node->expr );
    478785
    479786        MUTATE_END( Statement, node );
     
    499806        VISIT_START( node );
    500807
    501         maybeAccept( node->get_block(), *this );
    502         acceptAll( node->get_catchers(), *this );
    503         maybeAccept( node->get_finally(), *this );
     808        maybeAccept( node->block       , *this );
     809        maybeAccept( node->handlers    , *this );
     810        maybeAccept( node->finallyBlock, *this );
    504811
    505812        VISIT_END( node );
     
    510817        MUTATE_START( node );
    511818
    512         node->set_block(  maybeMutate( node->get_block(), *this ) );
    513         mutateAll( node->get_catchers(), *this );
    514         node->set_finally( maybeMutate( node->get_finally(), *this ) );
     819        maybeMutateRef( node->block       , *this );
     820        maybeMutateRef( node->handlers    , *this );
     821        maybeMutateRef( node->finallyBlock, *this );
    515822
    516823        MUTATE_END( Statement, node );
     
    522829void PassVisitor< pass_type >::visit( CatchStmt * node ) {
    523830        VISIT_START( node );
    524 
    525         maybeAccept( node->get_decl(), *this );
    526         node->set_cond( visitExpression( node->get_cond() ) );
    527         node->set_body( visitStatement( node->get_body() ) );
    528 
     831        {
     832                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     833                maybeAccept( node->decl, *this );
     834                node->cond = visitExpression( node->cond );
     835                node->body = visitStatement ( node->body );
     836        }
    529837        VISIT_END( node );
    530838}
     
    533841Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) {
    534842        MUTATE_START( node );
    535 
    536         node->set_decl( maybeMutate( node->get_decl(), *this ) );
    537         node->set_cond( mutateExpression( node->get_cond() ) );
    538         node->set_body( mutateStatement( node->get_body() ) );
    539 
     843        {
     844                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     845                maybeMutateRef( node->decl, *this );
     846                node->cond = mutateExpression( node->cond );
     847                node->body = mutateStatement ( node->body );
     848        }
    540849        MUTATE_END( Statement, node );
    541850}
     
    605914template< typename pass_type >
    606915void PassVisitor< pass_type >::visit( ApplicationExpr * node ) {
    607         VISIT_BODY( node );
     916        VISIT_START( node );
     917
     918        indexerScopedAccept( node->result  , *this );
     919        maybeAccept        ( node->function, *this );
     920        maybeAccept        ( node->args    , *this );
     921
     922        VISIT_END( node );
    608923}
    609924
    610925template< typename pass_type >
    611926Expression * PassVisitor< pass_type >::mutate( ApplicationExpr * node ) {
    612         MUTATE_BODY( Expression, node );
     927        MUTATE_START( node );
     928
     929        indexerScopedMutate( node->env     , *this );
     930        indexerScopedMutate( node->result  , *this );
     931        maybeMutateRef     ( node->function, *this );
     932        maybeMutateRef     ( node->args    , *this );
     933
     934        MUTATE_END( Expression, node );
    613935}
    614936
     
    620942
    621943        // maybeAccept( node->get_env(), *this );
    622         maybeAccept( node->get_result(), *this );
    623 
    624         for ( auto expr : node->get_args() ) {
     944        indexerScopedAccept( node->result, *this );
     945
     946        for ( auto expr : node->args ) {
    625947                visitExpression( expr );
    626948        }
     
    633955        MUTATE_START( node );
    634956
    635         node->set_env( maybeMutate( node->get_env(), *this ) );
    636         node->set_result( maybeMutate( node->get_result(), *this ) );
    637 
    638         for ( auto& expr : node->get_args() ) {
     957        indexerScopedMutate( node->env   , *this );
     958        indexerScopedMutate( node->result, *this );
     959
     960        for ( auto& expr : node->args ) {
    639961                expr = mutateExpression( expr );
    640962        }
     
    643965}
    644966
     967//--------------------------------------------------------------------------
     968// NameExpr
    645969template< typename pass_type >
    646970void PassVisitor< pass_type >::visit( NameExpr * node ) {
    647         VISIT_BODY( node );
    648 }
    649 
     971        VISIT_START( node );
     972
     973        indexerScopedAccept( node->result, *this );
     974
     975        VISIT_END( node );
     976}
     977
     978template< typename pass_type >
     979Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
     980        MUTATE_START( node );
     981
     982        indexerScopedMutate( node->env   , *this );
     983        indexerScopedMutate( node->result, *this );
     984
     985        MUTATE_END( Expression, node );
     986}
     987
     988//--------------------------------------------------------------------------
     989// CastExpr
    650990template< typename pass_type >
    651991void PassVisitor< pass_type >::visit( CastExpr * node ) {
    652         VISIT_BODY( node );
    653 }
    654 
     992        VISIT_START( node );
     993
     994        indexerScopedAccept( node->result, *this );
     995        maybeAccept        ( node->arg   , *this );
     996
     997        VISIT_END( node );
     998}
     999
     1000template< typename pass_type >
     1001Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) {
     1002        MUTATE_START( node );
     1003
     1004        indexerScopedMutate( node->env   , *this );
     1005        indexerScopedMutate( node->result, *this );
     1006        maybeMutateRef     ( node->arg   , *this );
     1007
     1008        MUTATE_END( Expression, node );
     1009}
     1010
     1011//--------------------------------------------------------------------------
     1012// VirtualCastExpr
    6551013template< typename pass_type >
    6561014void PassVisitor< pass_type >::visit( VirtualCastExpr * node ) {
    657         VISIT_BODY( node );
    658 }
    659 
     1015        VISIT_START( node );
     1016
     1017        indexerScopedAccept( node->result, *this );
     1018        maybeAccept( node->arg, *this );
     1019
     1020        VISIT_END( node );
     1021}
     1022
     1023template< typename pass_type >
     1024Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) {
     1025        MUTATE_START( node );
     1026
     1027        indexerScopedMutate( node->env   , *this );
     1028        indexerScopedMutate( node->result, *this );
     1029        maybeMutateRef     ( node->arg   , *this );
     1030
     1031        MUTATE_END( Expression, node );
     1032}
     1033
     1034//--------------------------------------------------------------------------
     1035// AddressExpr
    6601036template< typename pass_type >
    6611037void PassVisitor< pass_type >::visit( AddressExpr * node ) {
    662         VISIT_BODY( node );
    663 }
    664 
     1038        VISIT_START( node );
     1039
     1040        indexerScopedAccept( node->result, *this );
     1041        maybeAccept        ( node->arg   , *this );
     1042
     1043        VISIT_END( node );
     1044}
     1045
     1046template< typename pass_type >
     1047Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
     1048        MUTATE_START( node );
     1049
     1050        indexerScopedMutate( node->env   , *this );
     1051        indexerScopedMutate( node->result, *this );
     1052        maybeMutateRef     ( node->arg   , *this );
     1053
     1054        MUTATE_END( Expression, node );
     1055}
     1056
     1057//--------------------------------------------------------------------------
     1058// LabelAddressExpr
    6651059template< typename pass_type >
    6661060void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) {
    667         VISIT_BODY( node );
    668 }
    669 
     1061        VISIT_START( node );
     1062
     1063        indexerScopedAccept( node->result, *this );
     1064
     1065        VISIT_END( node );
     1066}
     1067
     1068template< typename pass_type >
     1069Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) {
     1070        MUTATE_START( node );
     1071
     1072        indexerScopedMutate( node->env   , *this );
     1073        indexerScopedMutate( node->result, *this );
     1074
     1075        MUTATE_END( Expression, node );
     1076}
     1077
     1078//--------------------------------------------------------------------------
     1079// UntypedMemberExpr
    6701080template< typename pass_type >
    6711081void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) {
    672         VISIT_BODY( node );
    673 }
    674 
     1082        VISIT_START( node );
     1083
     1084        indexerScopedAccept( node->result   , *this );
     1085        maybeAccept        ( node->aggregate, *this );
     1086        maybeAccept        ( node->member   , *this );
     1087
     1088        VISIT_END( node );
     1089}
     1090
     1091template< typename pass_type >
     1092Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) {
     1093        MUTATE_START( node );
     1094
     1095        indexerScopedMutate( node->env      , *this );
     1096        indexerScopedMutate( node->result   , *this );
     1097        maybeMutateRef     ( node->aggregate, *this );
     1098        maybeMutateRef     ( node->member   , *this );
     1099
     1100        MUTATE_END( Expression, node );
     1101}
     1102
     1103//--------------------------------------------------------------------------
     1104// MemberExpr
    6751105template< typename pass_type >
    6761106void PassVisitor< pass_type >::visit( MemberExpr * node ) {
    677         VISIT_BODY( node );
    678 }
    679 
     1107        VISIT_START( node );
     1108
     1109        indexerScopedAccept( node->result   , *this );
     1110        maybeAccept        ( node->aggregate, *this );
     1111
     1112        VISIT_END( node );
     1113}
     1114
     1115template< typename pass_type >
     1116Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
     1117        MUTATE_START( node );
     1118
     1119        indexerScopedMutate( node->env      , *this );
     1120        indexerScopedMutate( node->result   , *this );
     1121        maybeMutateRef     ( node->aggregate, *this );
     1122
     1123        MUTATE_END( Expression, node );
     1124}
     1125
     1126//--------------------------------------------------------------------------
     1127// VariableExpr
    6801128template< typename pass_type >
    6811129void PassVisitor< pass_type >::visit( VariableExpr * node ) {
    682         VISIT_BODY( node );
    683 }
    684 
     1130        VISIT_START( node );
     1131
     1132        indexerScopedAccept( node->result, *this );
     1133
     1134        VISIT_END( node );
     1135}
     1136
     1137template< typename pass_type >
     1138Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
     1139        MUTATE_START( node );
     1140
     1141        indexerScopedMutate( node->env   , *this );
     1142        indexerScopedMutate( node->result, *this );
     1143
     1144        MUTATE_END( Expression, node );
     1145}
     1146
     1147//--------------------------------------------------------------------------
     1148// ConstantExpr
    6851149template< typename pass_type >
    6861150void PassVisitor< pass_type >::visit( ConstantExpr * node ) {
    687         VISIT_BODY( node );
    688 }
    689 
     1151        VISIT_START( node );
     1152
     1153        indexerScopedAccept( node->result   , *this );
     1154        maybeAccept        ( &node->constant, *this );
     1155
     1156        VISIT_END( node );
     1157}
     1158
     1159template< typename pass_type >
     1160Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) {
     1161        MUTATE_START( node );
     1162
     1163        indexerScopedMutate( node->env   , *this );
     1164        indexerScopedMutate( node->result, *this );
     1165        node->constant = *maybeMutate( &node->constant, *this );
     1166
     1167        MUTATE_END( Expression, node );
     1168}
     1169
     1170//--------------------------------------------------------------------------
     1171// SizeofExpr
    6901172template< typename pass_type >
    6911173void PassVisitor< pass_type >::visit( SizeofExpr * node ) {
    692         VISIT_BODY( node );
    693 }
    694 
     1174        VISIT_START( node );
     1175
     1176        indexerScopedAccept( node->result, *this );
     1177        if ( node->get_isType() ) {
     1178                maybeAccept( node->type, *this );
     1179        } else {
     1180                maybeAccept( node->expr, *this );
     1181        }
     1182
     1183        VISIT_END( node );
     1184}
     1185
     1186template< typename pass_type >
     1187Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) {
     1188        MUTATE_START( node );
     1189
     1190        indexerScopedMutate( node->env   , *this );
     1191        indexerScopedMutate( node->result, *this );
     1192        if ( node->get_isType() ) {
     1193                maybeMutateRef( node->type, *this );
     1194        } else {
     1195                maybeMutateRef( node->expr, *this );
     1196        }
     1197
     1198        MUTATE_END( Expression, node );
     1199}
     1200
     1201//--------------------------------------------------------------------------
     1202// AlignofExpr
    6951203template< typename pass_type >
    6961204void PassVisitor< pass_type >::visit( AlignofExpr * node ) {
    697         VISIT_BODY( node );
    698 }
    699 
     1205        VISIT_START( node );
     1206
     1207        indexerScopedAccept( node->result, *this );
     1208        if ( node->get_isType() ) {
     1209                maybeAccept( node->type, *this );
     1210        } else {
     1211                maybeAccept( node->expr, *this );
     1212        }
     1213
     1214        VISIT_END( node );
     1215}
     1216
     1217template< typename pass_type >
     1218Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
     1219        MUTATE_START( node );
     1220
     1221        indexerScopedMutate( node->env   , *this );
     1222        indexerScopedMutate( node->result, *this );
     1223        if ( node->get_isType() ) {
     1224                maybeMutateRef( node->type, *this );
     1225        } else {
     1226                maybeMutateRef( node->expr, *this );
     1227        }
     1228
     1229        MUTATE_END( Expression, node );
     1230}
     1231
     1232//--------------------------------------------------------------------------
     1233// UntypedOffsetofExpr
    7001234template< typename pass_type >
    7011235void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) {
    702         VISIT_BODY( node );
    703 }
    704 
     1236        VISIT_START( node );
     1237
     1238        indexerScopedAccept( node->result, *this );
     1239        maybeAccept        ( node->type  , *this );
     1240
     1241        VISIT_END( node );
     1242}
     1243
     1244template< typename pass_type >
     1245Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
     1246        MUTATE_START( node );
     1247
     1248        indexerScopedMutate( node->env   , *this );
     1249        indexerScopedMutate( node->result, *this );
     1250        maybeMutateRef     ( node->type  , *this );
     1251
     1252        MUTATE_END( Expression, node );
     1253}
     1254
     1255//--------------------------------------------------------------------------
     1256// OffsetofExpr
    7051257template< typename pass_type >
    7061258void PassVisitor< pass_type >::visit( OffsetofExpr * node ) {
    707         VISIT_BODY( node );
    708 }
    709 
     1259        VISIT_START( node );
     1260
     1261        indexerScopedAccept( node->result, *this );
     1262        maybeAccept        ( node->type  , *this );
     1263        maybeAccept        ( node->member, *this );
     1264
     1265        VISIT_END( node );
     1266}
     1267
     1268template< typename pass_type >
     1269Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
     1270        MUTATE_START( node );
     1271
     1272        indexerScopedMutate( node->env   , *this );
     1273        indexerScopedMutate( node->result, *this );
     1274        maybeMutateRef     ( node->type  , *this );
     1275        maybeMutateRef     ( node->member, *this );
     1276
     1277        MUTATE_END( Expression, node );
     1278}
     1279
     1280//--------------------------------------------------------------------------
     1281// OffsetPackExpr
    7101282template< typename pass_type >
    7111283void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) {
    712         VISIT_BODY( node );
    713 }
    714 
     1284        VISIT_START( node );
     1285
     1286        indexerScopedAccept( node->result, *this );
     1287        maybeAccept        ( node->type  , *this );
     1288
     1289        VISIT_END( node );
     1290}
     1291
     1292template< typename pass_type >
     1293Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) {
     1294        MUTATE_START( node );
     1295
     1296        indexerScopedMutate( node->env   , *this );
     1297        indexerScopedMutate( node->result, *this );
     1298        maybeMutateRef     ( node->type  , *this );
     1299
     1300        MUTATE_END( Expression, node );
     1301}
     1302
     1303//--------------------------------------------------------------------------
     1304// AttrExpr
    7151305template< typename pass_type >
    7161306void PassVisitor< pass_type >::visit( AttrExpr * node ) {
    717         VISIT_BODY( node );
    718 }
    719 
     1307        VISIT_START( node );
     1308
     1309        indexerScopedAccept( node->result, *this );
     1310        if ( node->get_isType() ) {
     1311                maybeAccept( node->type, *this );
     1312        } else {
     1313                maybeAccept( node->expr, *this );
     1314        }
     1315
     1316        VISIT_END( node );
     1317}
     1318
     1319template< typename pass_type >
     1320Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) {
     1321        MUTATE_START( node );
     1322
     1323        indexerScopedMutate( node->env   , *this );
     1324        indexerScopedMutate( node->result, *this );
     1325        if ( node->get_isType() ) {
     1326                maybeMutateRef( node->type, *this );
     1327        } else {
     1328                maybeMutateRef( node->expr, *this );
     1329        }
     1330
     1331        MUTATE_END( Expression, node );
     1332}
     1333
     1334//--------------------------------------------------------------------------
     1335// LogicalExpr
    7201336template< typename pass_type >
    7211337void PassVisitor< pass_type >::visit( LogicalExpr * node ) {
    722         VISIT_BODY( node );
    723 }
    724 
     1338        VISIT_START( node );
     1339
     1340        indexerScopedAccept( node->result, *this );
     1341        maybeAccept        ( node->arg1  , *this );
     1342        maybeAccept        ( node->arg2  , *this );
     1343
     1344        VISIT_END( node );
     1345}
     1346
     1347template< typename pass_type >
     1348Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) {
     1349        MUTATE_START( node );
     1350
     1351        indexerScopedMutate( node->env   , *this );
     1352        indexerScopedMutate( node->result, *this );
     1353        maybeMutateRef     ( node->arg1  , *this );
     1354        maybeMutateRef     ( node->arg2  , *this );
     1355
     1356        MUTATE_END( Expression, node );
     1357}
     1358
     1359//--------------------------------------------------------------------------
     1360// ConditionalExpr
    7251361template< typename pass_type >
    7261362void PassVisitor< pass_type >::visit( ConditionalExpr * node ) {
    727         VISIT_BODY( node );
    728 }
    729 
     1363        VISIT_START( node );
     1364
     1365        indexerScopedAccept( node->result, *this );
     1366        maybeAccept        ( node->arg1  , *this );
     1367        maybeAccept        ( node->arg2  , *this );
     1368        maybeAccept        ( node->arg3  , *this );
     1369
     1370        VISIT_END( node );
     1371}
     1372
     1373template< typename pass_type >
     1374Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) {
     1375        MUTATE_START( node );
     1376
     1377        indexerScopedMutate( node->env   , *this );
     1378        indexerScopedMutate( node->result, *this );
     1379        maybeMutateRef     ( node->arg1  , *this );
     1380        maybeMutateRef     ( node->arg2  , *this );
     1381        maybeMutateRef     ( node->arg3  , *this );
     1382
     1383        MUTATE_END( Expression, node );
     1384}
     1385
     1386//--------------------------------------------------------------------------
     1387// CommaExpr
    7301388template< typename pass_type >
    7311389void PassVisitor< pass_type >::visit( CommaExpr * node ) {
    732         VISIT_BODY( node );
    733 }
    734 
     1390        VISIT_START( node );
     1391
     1392        indexerScopedAccept( node->result, *this );
     1393        maybeAccept        ( node->arg1  , *this );
     1394        maybeAccept        ( node->arg2  , *this );
     1395
     1396        VISIT_END( node );
     1397}
     1398
     1399template< typename pass_type >
     1400Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
     1401        MUTATE_START( node );
     1402
     1403        indexerScopedMutate( node->env   , *this );
     1404        indexerScopedMutate( node->result, *this );
     1405        maybeMutateRef     ( node->arg1  , *this );
     1406        maybeMutateRef     ( node->arg2  , *this );
     1407
     1408        MUTATE_END( Expression, node );
     1409}
     1410
     1411//--------------------------------------------------------------------------
     1412// TypeExpr
    7351413template< typename pass_type >
    7361414void PassVisitor< pass_type >::visit( TypeExpr * node ) {
    737         VISIT_BODY( node );
    738 }
    739 
     1415        VISIT_START( node );
     1416
     1417        indexerScopedAccept( node->result, *this );
     1418        maybeAccept        ( node->type, *this );
     1419
     1420        VISIT_END( node );
     1421}
     1422
     1423template< typename pass_type >
     1424Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) {
     1425        MUTATE_START( node );
     1426
     1427        indexerScopedMutate( node->env   , *this );
     1428        indexerScopedMutate( node->result, *this );
     1429        maybeMutateRef     ( node->type  , *this );
     1430
     1431        MUTATE_END( Expression, node );
     1432}
     1433
     1434//--------------------------------------------------------------------------
     1435// AsmExpr
    7401436template< typename pass_type >
    7411437void PassVisitor< pass_type >::visit( AsmExpr * node ) {
    742         VISIT_BODY( node );
    743 }
    744 
     1438        VISIT_START( node );
     1439
     1440        indexerScopedAccept( node->result    , *this );
     1441        maybeAccept        ( node->inout     , *this );
     1442        maybeAccept        ( node->constraint, *this );
     1443        maybeAccept        ( node->operand   , *this );
     1444
     1445        VISIT_END( node );
     1446}
     1447
     1448template< typename pass_type >
     1449Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) {
     1450        MUTATE_START( node );
     1451
     1452        indexerScopedMutate( node->env       , *this );
     1453        indexerScopedMutate( node->result    , *this );
     1454        maybeMutateRef     ( node->inout     , *this );
     1455        maybeMutateRef     ( node->constraint, *this );
     1456        maybeMutateRef     ( node->operand   , *this );
     1457
     1458        MUTATE_END( Expression, node );
     1459}
     1460
     1461//--------------------------------------------------------------------------
     1462// ImplicitCopyCtorExpr
    7451463template< typename pass_type >
    7461464void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) {
    747         VISIT_BODY( node );
    748 }
    749 
     1465        VISIT_START( node );
     1466
     1467        indexerScopedAccept( node->result     , *this );
     1468        maybeAccept        ( node->callExpr   , *this );
     1469        maybeAccept        ( node->tempDecls  , *this );
     1470        maybeAccept        ( node->returnDecls, *this );
     1471        maybeAccept        ( node->dtors      , *this );
     1472
     1473        VISIT_END( node );
     1474}
     1475
     1476template< typename pass_type >
     1477Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) {
     1478        MUTATE_START( node );
     1479
     1480        indexerScopedMutate( node->env        , *this );
     1481        indexerScopedMutate( node->result     , *this );
     1482        maybeMutateRef     ( node->callExpr   , *this );
     1483        maybeMutateRef     ( node->tempDecls  , *this );
     1484        maybeMutateRef     ( node->returnDecls, *this );
     1485        maybeMutateRef     ( node->dtors      , *this );
     1486
     1487        MUTATE_END( Expression, node );
     1488}
     1489
     1490//--------------------------------------------------------------------------
     1491// ConstructorExpr
    7501492template< typename pass_type >
    7511493void PassVisitor< pass_type >::visit( ConstructorExpr * node ) {
    752         VISIT_BODY( node );
    753 }
    754 
     1494        VISIT_START( node );
     1495
     1496        indexerScopedAccept( node->result  , *this );
     1497        maybeAccept        ( node->callExpr, *this );
     1498
     1499        VISIT_END( node );
     1500}
     1501
     1502template< typename pass_type >
     1503Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) {
     1504        MUTATE_START( node );
     1505
     1506        indexerScopedMutate( node->env     , *this );
     1507        indexerScopedMutate( node->result  , *this );
     1508        maybeMutateRef     ( node->callExpr, *this );
     1509
     1510        MUTATE_END( Expression, node );
     1511}
     1512
     1513//--------------------------------------------------------------------------
     1514// CompoundLiteralExpr
    7551515template< typename pass_type >
    7561516void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) {
    757         VISIT_BODY( node );
    758 }
    759 
     1517        VISIT_START( node );
     1518
     1519        indexerScopedAccept( node->result     , *this );
     1520        maybeAccept        ( node->initializer, *this );
     1521
     1522        VISIT_END( node );
     1523}
     1524
     1525template< typename pass_type >
     1526Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
     1527        MUTATE_START( node );
     1528
     1529        indexerScopedMutate( node->env        , *this );
     1530        indexerScopedMutate( node->result     , *this );
     1531        maybeMutateRef     ( node->initializer, *this );
     1532
     1533        MUTATE_END( Expression, node );
     1534}
     1535
     1536//--------------------------------------------------------------------------
     1537// RangeExpr
    7601538template< typename pass_type >
    7611539void PassVisitor< pass_type >::visit( RangeExpr * node ) {
    762         VISIT_BODY( node );
    763 }
    764 
     1540        VISIT_START( node );
     1541
     1542        indexerScopedAccept( node->result, *this );
     1543        maybeAccept        ( node->low   , *this );
     1544        maybeAccept        ( node->high  , *this );
     1545
     1546        VISIT_END( node );
     1547}
     1548
     1549template< typename pass_type >
     1550Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
     1551        MUTATE_START( node );
     1552
     1553        indexerScopedMutate( node->env   , *this );
     1554        indexerScopedMutate( node->result, *this );
     1555        maybeMutateRef     ( node->low   , *this );
     1556        maybeMutateRef     ( node->high  , *this );
     1557
     1558        MUTATE_END( Expression, node );
     1559}
     1560
     1561//--------------------------------------------------------------------------
     1562// UntypedTupleExpr
    7651563template< typename pass_type >
    7661564void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) {
    767         VISIT_BODY( node );
    768 }
    769 
     1565        VISIT_START( node );
     1566
     1567        indexerScopedAccept( node->result, *this );
     1568        maybeAccept        ( node->exprs , *this );
     1569
     1570        VISIT_END( node );
     1571}
     1572
     1573template< typename pass_type >
     1574Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
     1575        MUTATE_START( node );
     1576
     1577        indexerScopedMutate( node->env   , *this );
     1578        indexerScopedMutate( node->result, *this );
     1579        maybeMutateRef     ( node->exprs , *this );
     1580
     1581        MUTATE_END( Expression, node );
     1582}
     1583
     1584//--------------------------------------------------------------------------
     1585// TupleExpr
    7701586template< typename pass_type >
    7711587void PassVisitor< pass_type >::visit( TupleExpr * node ) {
    772         VISIT_BODY( node );
    773 }
    774 
     1588        VISIT_START( node );
     1589
     1590        indexerScopedAccept( node->result, *this );
     1591        maybeAccept          ( node->exprs , *this );
     1592
     1593        VISIT_END( node );
     1594}
     1595
     1596template< typename pass_type >
     1597Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
     1598        MUTATE_START( node );
     1599
     1600        indexerScopedMutate( node->env   , *this );
     1601        indexerScopedMutate( node->result, *this );
     1602        maybeMutateRef     ( node->exprs , *this );
     1603
     1604        MUTATE_END( Expression, node );
     1605}
     1606
     1607//--------------------------------------------------------------------------
     1608// TupleIndexExpr
    7751609template< typename pass_type >
    7761610void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) {
    777         VISIT_BODY( node );
    778 }
    779 
     1611        VISIT_START( node );
     1612
     1613        indexerScopedAccept( node->result, *this );
     1614        maybeAccept        ( node->tuple , *this );
     1615
     1616        VISIT_END( node );
     1617}
     1618
     1619template< typename pass_type >
     1620Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
     1621        MUTATE_START( node );
     1622
     1623        indexerScopedMutate( node->env   , *this );
     1624        indexerScopedMutate( node->result, *this );
     1625        maybeMutateRef     ( node->tuple , *this );
     1626
     1627        MUTATE_END( Expression, node );
     1628}
     1629
     1630//--------------------------------------------------------------------------
     1631// TupleAssignExpr
    7801632template< typename pass_type >
    7811633void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) {
    782         VISIT_BODY( node );
    783 }
    784 
    785 //--------------------------------------------------------------------------
    786 // UntypedExpr
     1634        VISIT_START( node );
     1635
     1636        indexerScopedAccept( node->result  , *this );
     1637        maybeAccept        ( node->stmtExpr, *this );
     1638
     1639        VISIT_END( node );
     1640}
     1641
     1642template< typename pass_type >
     1643Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) {
     1644        MUTATE_START( node );
     1645
     1646        indexerScopedMutate( node->env     , *this );
     1647        indexerScopedMutate( node->result  , *this );
     1648        maybeMutateRef     ( node->stmtExpr, *this );
     1649
     1650        MUTATE_END( Expression, node );
     1651}
     1652
     1653//--------------------------------------------------------------------------
     1654// StmtExpr
    7871655template< typename pass_type >
    7881656void PassVisitor< pass_type >::visit( StmtExpr * node ) {
     
    7941662        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
    7951663
    796         Visitor::visit( node );
     1664        indexerScopedAccept( node->result     , *this );
     1665        maybeAccept        ( node->statements , *this );
     1666        maybeAccept        ( node->returnDecls, *this );
     1667        maybeAccept        ( node->dtors      , *this );
    7971668
    7981669        VISIT_END( node );
     
    8081679        ValueGuardPtr< std::list< Statement* > > oldAfterStmts ( get_afterStmts () );
    8091680
    810         Mutator::mutate( node );
    811 
    812         MUTATE_END( Expression, node );
    813 }
    814 
     1681        indexerScopedMutate( node->result     , *this );
     1682        maybeMutateRef     ( node->statements , *this );
     1683        maybeMutateRef     ( node->returnDecls, *this );
     1684        maybeMutateRef     ( node->dtors      , *this );
     1685
     1686        MUTATE_END( Expression, node );
     1687}
     1688
     1689//--------------------------------------------------------------------------
     1690// UniqueExpr
    8151691template< typename pass_type >
    8161692void PassVisitor< pass_type >::visit( UniqueExpr * node ) {
    817         VISIT_BODY( node );
     1693        VISIT_START( node );
     1694
     1695        indexerScopedAccept( node->result, *this );
     1696        maybeAccept        ( node->expr  , *this );
     1697
     1698        VISIT_END( node );
     1699}
     1700
     1701template< typename pass_type >
     1702Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
     1703        MUTATE_START( node );
     1704
     1705        indexerScopedMutate( node->env   , *this );
     1706        indexerScopedMutate( node->result, *this );
     1707        maybeMutateRef     ( node->expr  , *this );
     1708
     1709        MUTATE_END( Expression, node );
    8181710}
    8191711
     
    8481740}
    8491741
     1742//--------------------------------------------------------------------------
     1743// StructInstType
    8501744template< typename pass_type >
    8511745void PassVisitor< pass_type >::visit( StructInstType * node ) {
    852         VISIT_BODY( node );
    853 }
    854 
     1746        VISIT_START( node );
     1747
     1748        indexerAddStruct( node->name );
     1749
     1750        {
     1751                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1752                maybeAccept( node->forall    , *this );
     1753                maybeAccept( node->parameters, *this );
     1754        }
     1755
     1756        VISIT_END( node );
     1757}
     1758
     1759template< typename pass_type >
     1760Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
     1761        MUTATE_START( node );
     1762
     1763        indexerAddStruct( node->name );
     1764
     1765        {
     1766                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1767                maybeMutateRef( node->forall    , *this );
     1768                maybeMutateRef( node->parameters, *this );
     1769        }
     1770
     1771        MUTATE_END( Type, node );
     1772}
     1773
     1774//--------------------------------------------------------------------------
     1775// UnionInstType
    8551776template< typename pass_type >
    8561777void PassVisitor< pass_type >::visit( UnionInstType * node ) {
    857         VISIT_BODY( node );
    858 }
    859 
     1778        VISIT_START( node );
     1779
     1780        indexerAddStruct( node->name );
     1781
     1782        {
     1783                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1784                maybeAccept( node->forall    , *this );
     1785                maybeAccept( node->parameters, *this );
     1786        }
     1787
     1788        VISIT_END( node );
     1789}
     1790
     1791template< typename pass_type >
     1792Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
     1793        MUTATE_START( node );
     1794
     1795        indexerAddStruct( node->name );
     1796
     1797        {
     1798                auto guard = makeFuncGuard( [this]() { indexerScopeEnter(); }, [this]() { indexerScopeLeave(); } );
     1799                maybeMutateRef( node->forall    , *this );
     1800                maybeMutateRef( node->parameters, *this );
     1801        }
     1802
     1803        MUTATE_END( Type, node );
     1804}
     1805
     1806//--------------------------------------------------------------------------
     1807// EnumInstType
    8601808template< typename pass_type >
    8611809void PassVisitor< pass_type >::visit( EnumInstType * node ) {
     
    8641812
    8651813template< typename pass_type >
     1814Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
     1815        MUTATE_BODY( Type, node );
     1816}
     1817
     1818//--------------------------------------------------------------------------
     1819// TraitInstType
     1820template< typename pass_type >
    8661821void PassVisitor< pass_type >::visit( TraitInstType * node ) {
    867         VISIT_BODY( node );
    868 }
    869 
     1822        VISIT_START( node );
     1823
     1824        maybeAccept( node->forall    , *this );
     1825        maybeAccept( node->parameters, *this );
     1826
     1827        VISIT_END( node );
     1828}
     1829
     1830template< typename pass_type >
     1831Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
     1832        MUTATE_START( node );
     1833
     1834        maybeMutateRef( node->forall    , *this );
     1835        maybeMutateRef( node->parameters, *this );
     1836
     1837        MUTATE_END( Type, node );
     1838}
     1839
     1840//--------------------------------------------------------------------------
     1841// TypeInstType
    8701842template< typename pass_type >
    8711843void PassVisitor< pass_type >::visit( TypeInstType * node ) {
     
    9041876
    9051877//--------------------------------------------------------------------------
    906 // UntypedExpr
     1878// SingleInit
    9071879template< typename pass_type >
    9081880void PassVisitor< pass_type >::visit( SingleInit * node ) {
     
    9441916
    9451917//---------------------------------------------------------------------------------------------------------------
    946 
    947 template< typename pass_type >
    948 DeclarationWithType * PassVisitor< pass_type >::mutate( ObjectDecl * node ) {
    949         MUTATE_BODY( DeclarationWithType, node );
    950 }
    951 
    952 template< typename pass_type >
    953 DeclarationWithType * PassVisitor< pass_type >::mutate( FunctionDecl * node ) {
    954         MUTATE_BODY( DeclarationWithType, node );
    955 }
    956 
    957 template< typename pass_type >
    958 Declaration * PassVisitor< pass_type >::mutate( StructDecl * node ) {
    959         MUTATE_BODY( Declaration, node );
    960 }
    961 
    962 template< typename pass_type >
    963 Declaration * PassVisitor< pass_type >::mutate( UnionDecl * node ) {
    964         MUTATE_BODY( Declaration, node );
    965 }
    966 
    967 template< typename pass_type >
    968 Declaration * PassVisitor< pass_type >::mutate( EnumDecl * node ) {
    969         MUTATE_BODY( Declaration, node );
    970 }
    971 
    972 template< typename pass_type >
    973 Declaration * PassVisitor< pass_type >::mutate( TraitDecl * node ) {
    974         MUTATE_BODY( Declaration, node );
    975 }
    976 
    977 template< typename pass_type >
    978 TypeDecl * PassVisitor< pass_type >::mutate( TypeDecl * node ) {
    979         MUTATE_BODY( TypeDecl, node );
    980 }
    981 
    982 template< typename pass_type >
    983 Declaration * PassVisitor< pass_type >::mutate( TypedefDecl * node ) {
    984         MUTATE_BODY( Declaration, node );
    985 }
    986 
    987 template< typename pass_type >
    988 AsmDecl * PassVisitor< pass_type >::mutate( AsmDecl * node ) {
    989         MUTATE_BODY( AsmDecl, node );
    990 }
    991 
    992 template< typename pass_type >
    993 Expression * PassVisitor< pass_type >::mutate( NameExpr * node ) {
    994         MUTATE_BODY( Expression, node );
    995 }
    996 
    997 template< typename pass_type >
    998 Expression * PassVisitor< pass_type >::mutate( AddressExpr * node ) {
    999         MUTATE_BODY( Expression, node );
    1000 }
    1001 
    1002 template< typename pass_type >
    1003 Expression * PassVisitor< pass_type >::mutate( LabelAddressExpr * node ) {
    1004         MUTATE_BODY( Expression, node );
    1005 }
    1006 
    1007 template< typename pass_type >
    1008 Expression * PassVisitor< pass_type >::mutate( CastExpr * node ) {
    1009         MUTATE_BODY( Expression, node );
    1010 }
    1011 
    1012 template< typename pass_type >
    1013 Expression * PassVisitor< pass_type >::mutate( VirtualCastExpr * node ) {
    1014         MUTATE_BODY( Expression, node );
    1015 }
    1016 
    1017 template< typename pass_type >
    1018 Expression * PassVisitor< pass_type >::mutate( UntypedMemberExpr * node ) {
    1019         MUTATE_BODY( Expression, node );
    1020 }
    1021 
    1022 template< typename pass_type >
    1023 Expression * PassVisitor< pass_type >::mutate( MemberExpr * node ) {
    1024         MUTATE_BODY( Expression, node );
    1025 }
    1026 
    1027 template< typename pass_type >
    1028 Expression * PassVisitor< pass_type >::mutate( VariableExpr * node ) {
    1029         MUTATE_BODY( Expression, node );
    1030 }
    1031 
    1032 template< typename pass_type >
    1033 Expression * PassVisitor< pass_type >::mutate( ConstantExpr * node ) {
    1034         MUTATE_BODY( Expression, node );
    1035 }
    1036 
    1037 template< typename pass_type >
    1038 Expression * PassVisitor< pass_type >::mutate( SizeofExpr * node ) {
    1039         MUTATE_BODY( Expression, node );
    1040 }
    1041 
    1042 template< typename pass_type >
    1043 Expression * PassVisitor< pass_type >::mutate( AlignofExpr * node ) {
    1044         MUTATE_BODY( Expression, node );
    1045 }
    1046 
    1047 template< typename pass_type >
    1048 Expression * PassVisitor< pass_type >::mutate( UntypedOffsetofExpr * node ) {
    1049         MUTATE_BODY( Expression, node );
    1050 }
    1051 
    1052 template< typename pass_type >
    1053 Expression * PassVisitor< pass_type >::mutate( OffsetofExpr * node ) {
    1054         MUTATE_BODY( Expression, node );
    1055 }
    1056 
    1057 template< typename pass_type >
    1058 Expression * PassVisitor< pass_type >::mutate( OffsetPackExpr * node ) {
    1059         MUTATE_BODY( Expression, node );
    1060 }
    1061 
    1062 template< typename pass_type >
    1063 Expression * PassVisitor< pass_type >::mutate( AttrExpr * node ) {
    1064         MUTATE_BODY( Expression, node );
    1065 }
    1066 
    1067 template< typename pass_type >
    1068 Expression * PassVisitor< pass_type >::mutate( LogicalExpr * node ) {
    1069         MUTATE_BODY( Expression, node );
    1070 }
    1071 
    1072 template< typename pass_type >
    1073 Expression * PassVisitor< pass_type >::mutate( ConditionalExpr * node ) {
    1074         MUTATE_BODY( Expression, node );
    1075 }
    1076 
    1077 template< typename pass_type >
    1078 Expression * PassVisitor< pass_type >::mutate( CommaExpr * node ) {
    1079         MUTATE_BODY( Expression, node );
    1080 }
    1081 
    1082 template< typename pass_type >
    1083 Expression * PassVisitor< pass_type >::mutate( TypeExpr * node ) {
    1084         MUTATE_BODY( Expression, node );
    1085 }
    1086 
    1087 template< typename pass_type >
    1088 Expression * PassVisitor< pass_type >::mutate( AsmExpr * node ) {
    1089         MUTATE_BODY( Expression, node );
    1090 }
    1091 
    1092 template< typename pass_type >
    1093 Expression * PassVisitor< pass_type >::mutate( ImplicitCopyCtorExpr * node ) {
    1094         MUTATE_BODY( Expression, node );
    1095 }
    1096 
    1097 template< typename pass_type >
    1098 Expression * PassVisitor< pass_type >::mutate( ConstructorExpr * node ) {
    1099         MUTATE_BODY( Expression, node );
    1100 }
    1101 
    1102 template< typename pass_type >
    1103 Expression * PassVisitor< pass_type >::mutate( CompoundLiteralExpr * node ) {
    1104         MUTATE_BODY( Expression, node );
    1105 }
    1106 
    1107 template< typename pass_type >
    1108 Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) {
    1109         MUTATE_BODY( Expression, node );
    1110 }
    1111 
    1112 template< typename pass_type >
    1113 Expression * PassVisitor< pass_type >::mutate( UntypedTupleExpr * node ) {
    1114         MUTATE_BODY( Expression, node );
    1115 }
    1116 
    1117 template< typename pass_type >
    1118 Expression * PassVisitor< pass_type >::mutate( TupleExpr * node ) {
    1119         MUTATE_BODY( Expression, node );
    1120 }
    1121 
    1122 template< typename pass_type >
    1123 Expression * PassVisitor< pass_type >::mutate( TupleIndexExpr * node ) {
    1124         MUTATE_BODY( Expression, node );
    1125 }
    1126 
    1127 template< typename pass_type >
    1128 Expression * PassVisitor< pass_type >::mutate( TupleAssignExpr * node ) {
    1129         MUTATE_BODY( Expression, node );
    1130 }
    1131 
    1132 template< typename pass_type >
    1133 Expression * PassVisitor< pass_type >::mutate( UniqueExpr * node ) {
    1134         MUTATE_BODY( Expression, node );
    1135 }
    1136 
    11371918template< typename pass_type >
    11381919Type * PassVisitor< pass_type >::mutate( VoidType * node ) {
     
    11661947
    11671948template< typename pass_type >
    1168 Type * PassVisitor< pass_type >::mutate( StructInstType * node ) {
    1169         MUTATE_BODY( Type, node );
    1170 }
    1171 
    1172 template< typename pass_type >
    1173 Type * PassVisitor< pass_type >::mutate( UnionInstType * node ) {
    1174         MUTATE_BODY( Type, node );
    1175 }
    1176 
    1177 template< typename pass_type >
    1178 Type * PassVisitor< pass_type >::mutate( EnumInstType * node ) {
    1179         MUTATE_BODY( Type, node );
    1180 }
    1181 
    1182 template< typename pass_type >
    1183 Type * PassVisitor< pass_type >::mutate( TraitInstType * node ) {
    1184         MUTATE_BODY( Type, node );
    1185 }
    1186 
    1187 template< typename pass_type >
    11881949Type * PassVisitor< pass_type >::mutate( TypeInstType * node ) {
    11891950        MUTATE_BODY( Type, node );
  • src/Common/PassVisitor.proto.h

    rb2e2e34 rc935c3a  
    4141};
    4242
    43 
    4443class bool_ref {
    4544public:
     
    5958        bool * m_ref;
    6059};
     60
     61template< typename TreeType, typename VisitorType >
     62inline void indexerScopedAccept( TreeType * tree, VisitorType & visitor ) {
     63        auto guard = makeFuncGuard(
     64                [&visitor]() { visitor.indexerScopeEnter(); },
     65                [&visitor]() { visitor.indexerScopeLeave(); }
     66        );
     67        maybeAccept( tree, visitor );
     68}
     69
     70template< typename TreeType, typename MutatorType >
     71inline void indexerScopedMutate( TreeType *& tree, MutatorType & mutator ) {
     72        auto guard = makeFuncGuard(
     73                [&mutator]() { mutator.indexerScopeEnter(); },
     74                [&mutator]() { mutator.indexerScopeLeave(); }
     75        );
     76        tree = maybeMutate( tree, mutator );
     77}
     78
     79template< typename TreeType, typename MutatorType >
     80inline void maybeMutateRef( TreeType *& tree, MutatorType & mutator ) {
     81        tree = maybeMutate( tree, mutator );
     82}
    6183
    6284//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------
     
    93115static inline void postvisit_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) node_type * node, __attribute__((unused)) long unused ) {}
    94116
     117//---------------------------------------------------------
    95118// Mutate
    96119template<typename pass_type, typename node_type>
     
    111134static inline return_type postmutate_impl( __attribute__((unused)) pass_type& pass, node_type * node, __attribute__((unused)) long unused ) { return node; }
    112135
     136//---------------------------------------------------------
    113137// Begin/End scope
    114138template<typename pass_type>
     
    129153static inline void end_scope_impl( __attribute__((unused)) pass_type& pass, __attribute__((unused)) long unused ) {}
    130154
     155//---------------------------------------------------------
    131156// Fields
    132157#define FIELD_PTR( type, name )                                                                                                        \
     
    145170FIELD_PTR( at_cleanup_t, at_cleanup )
    146171FIELD_PTR( PassVisitor<pass_type> * const, visitor )
     172
     173//---------------------------------------------------------
     174// Indexer
     175template<typename pass_type>
     176static inline auto indexer_impl_enterScope( pass_type & pass, int ) -> decltype( pass.indexer.enterScope(), void() ) {
     177        pass.indexer.enterScope();
     178}
     179
     180template<typename pass_type>
     181static inline auto indexer_impl_enterScope( pass_type &, int ) {}
     182
     183template<typename pass_type>
     184static inline auto indexer_impl_leaveScope( pass_type & pass, int ) -> decltype( pass.indexer.leaveScope(), void() ) {
     185        pass.indexer.leaveScope();
     186}
     187
     188template<typename pass_type>
     189static inline auto indexer_impl_leaveScope( pass_type &, int ) {}
     190
     191
     192#define INDEXER_FUNC( func, type )                                                                                             \
     193template<typename pass_type>                                                                                                   \
     194static inline auto indexer_impl_##func ( pass_type & pass, int, type arg ) -> decltype( pass.indexer.func( arg ), void() ) {   \
     195        pass.indexer.func( arg );                                                                                                \
     196}                                                                                                                              \
     197                                                                                                                               \
     198template<typename pass_type>                                                                                                   \
     199static inline void indexer_impl_##func ( pass_type &, long, type ) {}                                                          \
     200
     201INDEXER_FUNC( addId     , DeclarationWithType * );
     202INDEXER_FUNC( addType   , NamedTypeDecl *       );
     203INDEXER_FUNC( addStruct , StructDecl *          );
     204INDEXER_FUNC( addEnum   , EnumDecl *            );
     205INDEXER_FUNC( addUnion  , UnionDecl *           );
     206INDEXER_FUNC( addTrait  , TraitDecl *           );
     207
     208
     209template<typename pass_type>
     210static inline auto indexer_impl_addStructFwd( pass_type & pass, int, StructDecl * decl ) -> decltype( pass.indexer.addStruct( decl ), void() ) {
     211        StructDecl * fwd = new StructDecl( decl->name );
     212        cloneAll( decl->parameters, fwd->parameters );
     213        pass.indexer.addStruct( fwd );
     214}
     215
     216template<typename pass_type>
     217static inline auto indexer_impl_addStructFwd( pass_type &, int, StructDecl * ) {}
     218
     219template<typename pass_type>
     220static inline auto indexer_impl_addUnionFwd( pass_type & pass, int, UnionDecl * decl ) -> decltype( pass.indexer.addUnion( decl ), void() ) {
     221        UnionDecl * fwd = new UnionDecl( decl->name );
     222        cloneAll( decl->parameters, fwd->parameters );
     223        pass.indexer.addUnion( fwd );
     224}
     225
     226template<typename pass_type>
     227static inline auto indexer_impl_addUnionFwd( pass_type &, int, UnionDecl * ) {}
     228
     229template<typename pass_type>
     230static inline auto indexer_impl_addStruct( pass_type & pass, int, const std::string & str ) -> decltype( pass.indexer.addStruct( str ), void() ) {
     231        if ( ! pass.indexer.lookupStruct( str ) ) {
     232                pass.indexer.addStruct( str );
     233        }
     234}
     235
     236template<typename pass_type>
     237static inline auto indexer_impl_addStruct( pass_type &, int, const std::string & ) {}
     238
     239template<typename pass_type>
     240static inline auto indexer_impl_addUnion( pass_type & pass, int, const std::string & str ) -> decltype( pass.indexer.addUnion( str ), void() ) {
     241        if ( ! pass.indexer.lookupUnion( str ) ) {
     242                pass.indexer.addUnion( str );
     243        }
     244}
     245
     246template<typename pass_type>
     247static inline auto indexer_impl_addUnion( pass_type &, int, const std::string & ) {}
  • src/Common/utility.h

    rb2e2e34 rc935c3a  
    277277        ~ValueGuardPtr() { if( ref ) *ref = old; }
    278278};
     279
     280template< typename aT >
     281struct FuncGuard {
     282        aT m_after;
     283
     284        template< typename bT >
     285        FuncGuard( bT before, aT after ) : m_after( after ) {
     286                before();
     287        }
     288
     289        ~FuncGuard() {
     290                m_after();
     291        }
     292};
     293
     294template< typename bT, typename aT >
     295FuncGuard<aT> makeFuncGuard( bT && before, aT && after ) {
     296        return FuncGuard<aT>( std::forward<bT>(before), std::forward<aT>(after) );
     297}
    279298
    280299template< typename T >
     
    370389}
    371390
     391// -----------------------------------------------------------------------------
     392// Helper struct and function to support
     393// for ( val : lazy_map( container1, f ) ) {}
     394// syntax to have a for each that iterates a container, mapping each element by applying f
     395template< typename T, typename Func >
     396struct lambda_iterate_t {
     397        const T & ref;
     398        std::function<Func> f;
     399
     400        struct iterator {
     401                typedef decltype(begin(ref)) Iter;
     402                Iter it;
     403                std::function<Func> f;
     404                iterator( Iter it, std::function<Func> f ) : it(it), f(f) {}
     405                iterator & operator++() {
     406                        ++it; return *this;
     407                }
     408                bool operator!=( const iterator &other ) const { return it != other.it; }
     409                auto operator*() const -> decltype(f(*it)) { return f(*it); }
     410        };
     411
     412        lambda_iterate_t( const T & ref, std::function<Func> f ) : ref(ref), f(f) {}
     413
     414        auto begin() const -> decltype(iterator(std::begin(ref), f)) { return iterator(std::begin(ref), f); }
     415        auto end() const   -> decltype(iterator(std::end(ref), f)) { return iterator(std::end(ref), f); }
     416};
     417
     418template< typename... Args >
     419lambda_iterate_t<Args...> lazy_map( const Args &... args ) {
     420        return lambda_iterate_t<Args...>( args...);
     421}
     422
     423
     424
    372425// Local Variables: //
    373426// tab-width: 4 //
  • src/Concurrency/Keywords.cc

    rb2e2e34 rc935c3a  
    259259        //=============================================================================================
    260260        void ConcurrentSueKeyword::postvisit(StructDecl * decl) {
    261                 if( decl->get_name() == type_name && decl->has_body() ) {
     261                if( decl->name == type_name && decl->body ) {
    262262                        assert( !type_decl );
    263263                        type_decl = decl;
     
    270270
    271271        void ConcurrentSueKeyword::handle( StructDecl * decl ) {
    272                 if( ! decl->has_body() ) return;
     272                if( ! decl->body ) return;
    273273
    274274                if( !type_decl ) throw SemanticError( context_error, decl );
     
    418418        void MutexKeyword::postvisit(StructDecl* decl) {
    419419
    420                 if( decl->get_name() == "monitor_desc" ) {
     420                if( decl->name == "monitor_desc" ) {
    421421                        assert( !monitor_decl );
    422422                        monitor_decl = decl;
    423423                }
    424                 else if( decl->get_name() == "monitor_guard_t" ) {
     424                else if( decl->name == "monitor_guard_t" ) {
    425425                        assert( !guard_decl );
    426426                        guard_decl = decl;
     
    524524        //=============================================================================================
    525525        void ThreadStarter::postvisit(FunctionDecl * decl) {
    526                 if( ! CodeGen::isConstructor(decl->get_name()) ) return;
     526                if( ! CodeGen::isConstructor(decl->name) ) return;
    527527
    528528                DeclarationWithType * param = decl->get_functionType()->get_parameters().front();
  • src/Concurrency/module.mk

    rb2e2e34 rc935c3a  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk -- 
     8## module.mk --
    99##
    1010## Author           : Thierry Delisle
    1111## Created On       : Mon Mar 13 12:48:40 2017
    12 ## Last Modified By : 
    13 ## Last Modified On : 
     12## Last Modified By :
     13## Last Modified On :
    1414## Update Count     : 0
    1515###############################################################################
    1616
    17 SRC += Concurrency/Keywords.cc
     17SRC += Concurrency/Keywords.cc \
     18       Concurrency/Waitfor.cc
    1819
  • src/GenPoly/Box.cc

    rb2e2e34 rc935c3a  
    1515
    1616#include <algorithm>                     // for mismatch
    17 #include <cassert>                       // for assert, safe_dynamic_cast
     17#include <cassert>                       // for assert, strict_dynamic_cast
    1818#include <iostream>                      // for operator<<, stringstream
    1919#include <list>                          // for list, list<>::iterator, _Lis...
     
    2727
    2828#include "CodeGen/OperatorTable.h"
     29#include "Common/PassVisitor.h"          // for PassVisitor
    2930#include "Common/ScopedMap.h"            // for ScopedMap, ScopedMap<>::iter...
    3031#include "Common/SemanticError.h"        // for SemanticError
     
    157158                /// * Calculates polymorphic offsetof expressions from offset array
    158159                /// * Inserts dynamic calculation of polymorphic type layouts where needed
    159                 class PolyGenericCalculator final : public PolyMutator {
     160                class PolyGenericCalculator final : public WithGuards, public WithVisitorRef<PolyGenericCalculator>, public WithStmtsToAdd, public WithDeclsToAdd, public WithTypeSubstitution {
    160161                public:
    161                         typedef PolyMutator Parent;
    162                         using Parent::mutate;
    163 
    164162                        PolyGenericCalculator();
    165163
    166                         template< typename DeclClass >
    167                         DeclClass *handleDecl( DeclClass *decl, Type *type );
    168                         virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override;
    169                         virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override;
    170                         virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) override;
    171                         virtual TypeDecl *mutate( TypeDecl *objectDecl ) override;
    172                         virtual Statement *mutate( DeclStmt *declStmt ) override;
    173                         virtual Type *mutate( PointerType *pointerType ) override;
    174                         virtual Type *mutate( FunctionType *funcType ) override;
    175                         virtual Expression *mutate( MemberExpr *memberExpr ) override;
    176                         virtual Expression *mutate( SizeofExpr *sizeofExpr ) override;
    177                         virtual Expression *mutate( AlignofExpr *alignofExpr ) override;
    178                         virtual Expression *mutate( OffsetofExpr *offsetofExpr ) override;
    179                         virtual Expression *mutate( OffsetPackExpr *offsetPackExpr ) override;
    180 
    181                         virtual void doBeginScope() override;
    182                         virtual void doEndScope() override;
     164                        void premutate( ObjectDecl *objectDecl );
     165                        void premutate( FunctionDecl *functionDecl );
     166                        void premutate( TypedefDecl *objectDecl );
     167                        void premutate( TypeDecl *objectDecl );
     168                        Declaration * postmutate( TypeDecl *TraitDecl );
     169                        void premutate( PointerType *pointerType );
     170                        void premutate( FunctionType *funcType );
     171                        void premutate( DeclStmt *declStmt );
     172                        Expression *postmutate( MemberExpr *memberExpr );
     173                        Expression *postmutate( SizeofExpr *sizeofExpr );
     174                        Expression *postmutate( AlignofExpr *alignofExpr );
     175                        Expression *postmutate( OffsetofExpr *offsetofExpr );
     176                        Expression *postmutate( OffsetPackExpr *offsetPackExpr );
     177
     178                        void beginScope();
     179                        void endScope();
    183180
    184181                private:
     
    194191                        /// Exits the type-variable scope
    195192                        void endTypeScope();
     193                        /// Enters a new scope for knowLayouts and knownOffsets and queues exit calls
     194                        void beginGenericScope();
    196195
    197196                        ScopedSet< std::string > knownLayouts;          ///< Set of generic type layouts known in the current scope, indexed by sizeofName
    198197                        ScopedSet< std::string > knownOffsets;          ///< Set of non-generic types for which the offset array exists in the current scope, indexed by offsetofName
    199198                        UniqueName bufNamer;                           ///< Namer for VLA buffers
     199                        TyVarMap scopeTyVars;
    200200                };
    201201
     
    250250                Pass1 pass1;
    251251                Pass2 pass2;
    252                 PolyGenericCalculator polyCalculator;
     252                PassVisitor<PolyGenericCalculator> polyCalculator;
    253253                Pass3 pass3;
    254254
     
    256256                mutateTranslationUnit/*All*/( translationUnit, pass1 );
    257257                mutateTranslationUnit/*All*/( translationUnit, pass2 );
    258                 mutateTranslationUnit/*All*/( translationUnit, polyCalculator );
     258                mutateAll( translationUnit, polyCalculator );
    259259                mutateTranslationUnit/*All*/( translationUnit, pass3 );
    260260        }
     
    555555                TypeDecl *Pass1::mutate( TypeDecl *typeDecl ) {
    556556                        addToTyVarMap( typeDecl, scopeTyVars );
    557                         return Mutator::mutate( typeDecl );
     557                        return dynamic_cast<TypeDecl*>( Mutator::mutate( typeDecl ) );
    558558                }
    559559
     
    762762                                } else if ( arg->get_result()->get_lvalue() ) {
    763763                                        // argument expression may be CFA lvalue, but not C lvalue -- apply generalizedLvalue transformations.
     764                                        // if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( arg ) ) {
     765                                        //      if ( dynamic_cast<ArrayType *>( varExpr->var->get_type() ) ){
     766                                        //              // temporary hack - don't box arrays, because &arr is not the same as &arr[0]
     767                                        //              return;
     768                                        //      }
     769                                        // }
    764770                                        arg =  generalizedLvalue( new AddressExpr( arg ) );
    765771                                        if ( ! ResolvExpr::typesCompatible( param, arg->get_result(), SymTab::Indexer() ) ) {
     
    12991305
    13001306                DeclarationWithType * Pass2::mutate( FunctionDecl *functionDecl ) {
    1301                         functionDecl = safe_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) );
     1307                        functionDecl = strict_dynamic_cast< FunctionDecl * > ( handleDecl( functionDecl ) );
    13021308                        FunctionType * ftype = functionDecl->get_functionType();
    13031309                        if ( ! ftype->get_returnVals().empty() && functionDecl->get_statements() ) {
     
    13531359                                return handleDecl( typeDecl );
    13541360                        } else {
    1355                                 return Parent::mutate( typeDecl );
     1361                                return dynamic_cast<TypeDecl*>( Parent::mutate( typeDecl ) );
    13561362                        }
    13571363                }
     
    13781384                        // move polymorphic return type to parameter list
    13791385                        if ( isDynRet( funcType ) ) {
    1380                                 ObjectDecl *ret = safe_dynamic_cast< ObjectDecl* >( funcType->get_returnVals().front() );
     1386                                ObjectDecl *ret = strict_dynamic_cast< ObjectDecl* >( funcType->get_returnVals().front() );
    13811387                                ret->set_type( new PointerType( Type::Qualifiers(), ret->get_type() ) );
    13821388                                funcType->get_parameters().push_front( ret );
     
    14661472
    14671473                PolyGenericCalculator::PolyGenericCalculator()
    1468                         : Parent(), knownLayouts(), knownOffsets(), bufNamer( "_buf" ) {}
     1474                        : knownLayouts(), knownOffsets(), bufNamer( "_buf" ), scopeTyVars( TypeDecl::Data{} ) {}
    14691475
    14701476                void PolyGenericCalculator::beginTypeScope( Type *ty ) {
    1471                         scopeTyVars.beginScope();
     1477                        GuardScope( scopeTyVars );
    14721478                        makeTyVarMap( ty, scopeTyVars );
    14731479                }
    14741480
    1475                 void PolyGenericCalculator::endTypeScope() {
    1476                         scopeTyVars.endScope();
    1477                 }
    1478 
    1479                 template< typename DeclClass >
    1480                 DeclClass * PolyGenericCalculator::handleDecl( DeclClass *decl, Type *type ) {
    1481                         beginTypeScope( type );
    1482                         // knownLayouts.beginScope();
    1483                         // knownOffsets.beginScope();
    1484 
    1485                         DeclClass *ret = static_cast< DeclClass *>( Parent::mutate( decl ) );
    1486 
    1487                         // knownOffsets.endScope();
    1488                         // knownLayouts.endScope();
    1489                         endTypeScope();
    1490                         return ret;
    1491                 }
    1492 
    1493                 ObjectDecl * PolyGenericCalculator::mutate( ObjectDecl *objectDecl ) {
    1494                         return handleDecl( objectDecl, objectDecl->get_type() );
    1495                 }
    1496 
    1497                 DeclarationWithType * PolyGenericCalculator::mutate( FunctionDecl *functionDecl ) {
    1498                         knownLayouts.beginScope();
    1499                         knownOffsets.beginScope();
    1500 
    1501                         DeclarationWithType * decl = handleDecl( functionDecl, functionDecl->get_functionType() );
    1502                         knownOffsets.endScope();
    1503                         knownLayouts.endScope();
    1504                         return decl;
    1505                 }
    1506 
    1507                 TypedefDecl * PolyGenericCalculator::mutate( TypedefDecl *typedefDecl ) {
    1508                         return handleDecl( typedefDecl, typedefDecl->get_base() );
    1509                 }
    1510 
    1511                 TypeDecl * PolyGenericCalculator::mutate( TypeDecl *typeDecl ) {
     1481                void PolyGenericCalculator::beginGenericScope() {
     1482                        GuardScope( *this );
     1483                }
     1484
     1485                void PolyGenericCalculator::premutate( ObjectDecl *objectDecl ) {
     1486                        beginTypeScope( objectDecl->get_type() );
     1487                }
     1488
     1489                void PolyGenericCalculator::premutate( FunctionDecl *functionDecl ) {
     1490                        beginGenericScope();
     1491
     1492                        beginTypeScope( functionDecl->get_functionType() );
     1493                }
     1494
     1495                void PolyGenericCalculator::premutate( TypedefDecl *typedefDecl ) {
     1496                        beginTypeScope( typedefDecl->get_base() );
     1497                }
     1498
     1499                void PolyGenericCalculator::premutate( TypeDecl * typeDecl ) {
    15121500                        addToTyVarMap( typeDecl, scopeTyVars );
    1513                         return Parent::mutate( typeDecl );
    1514                 }
    1515 
    1516                 Type * PolyGenericCalculator::mutate( PointerType *pointerType ) {
     1501                }
     1502
     1503                Declaration * PolyGenericCalculator::postmutate( TypeDecl *typeDecl ) {
     1504                        if ( Type * base = typeDecl->base ) {
     1505                                // add size/align variables for opaque type declarations
     1506                                TypeInstType inst( Type::Qualifiers(), typeDecl->name, typeDecl );
     1507                                std::string typeName = mangleType( &inst );
     1508                                Type *layoutType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
     1509
     1510                                ObjectDecl * sizeDecl = ObjectDecl::newObject( sizeofName( typeName ), layoutType, new SingleInit( new SizeofExpr( base->clone() ) ) );
     1511                                ObjectDecl * alignDecl = ObjectDecl::newObject( alignofName( typeName ), layoutType->clone(), new SingleInit( new AlignofExpr( base->clone() ) ) );
     1512
     1513                                // ensure that the initializing sizeof/alignof exprs are properly mutated
     1514                                sizeDecl->acceptMutator( *visitor );
     1515                                alignDecl->acceptMutator( *visitor );
     1516
     1517                                // can't use makeVar, because it inserts into stmtsToAdd and TypeDecls can occur at global scope
     1518                                declsToAddAfter.push_back( alignDecl );
     1519                                // replace with sizeDecl
     1520                                return sizeDecl;
     1521                        }
     1522                        return typeDecl;
     1523                }
     1524
     1525                void PolyGenericCalculator::premutate( PointerType *pointerType ) {
    15171526                        beginTypeScope( pointerType );
    1518 
    1519                         Type *ret = Parent::mutate( pointerType );
    1520 
    1521                         endTypeScope();
    1522                         return ret;
    1523                 }
    1524 
    1525                 Type * PolyGenericCalculator::mutate( FunctionType *funcType ) {
     1527                }
     1528
     1529                void PolyGenericCalculator::premutate( FunctionType *funcType ) {
    15261530                        beginTypeScope( funcType );
    15271531
     
    15341538                                }
    15351539                        }
    1536 
    1537                         Type *ret = Parent::mutate( funcType );
    1538 
    1539                         endTypeScope();
    1540                         return ret;
    1541                 }
    1542 
    1543                 Statement *PolyGenericCalculator::mutate( DeclStmt *declStmt ) {
     1540                }
     1541
     1542                void PolyGenericCalculator::premutate( DeclStmt *declStmt ) {
    15441543                        if ( ObjectDecl *objectDecl = dynamic_cast< ObjectDecl *>( declStmt->get_decl() ) ) {
    15451544                                if ( findGeneric( objectDecl->get_type() ) ) {
     
    15501549                                                new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Kind::Char), new NameExpr( sizeofName( mangleType(declType) ) ),
    15511550                                                true, false, std::list<Attribute*>{ new Attribute( "aligned", std::list<Expression*>{ new ConstantExpr( Constant::from_int(8) ) } ) } ), 0 );
    1552                                         stmtsToAdd.push_back( new DeclStmt( noLabels, newBuf ) );
     1551                                        stmtsToAddBefore.push_back( new DeclStmt( noLabels, newBuf ) );
    15531552
    15541553                                        delete objectDecl->get_init();
     
    15561555                                }
    15571556                        }
    1558                         return Parent::mutate( declStmt );
    15591557                }
    15601558
     
    15831581                }
    15841582
    1585                 Expression *PolyGenericCalculator::mutate( MemberExpr *memberExpr ) {
    1586                         // mutate, exiting early if no longer MemberExpr
    1587                         Expression *expr = Parent::mutate( memberExpr );
    1588                         memberExpr = dynamic_cast< MemberExpr* >( expr );
    1589                         if ( ! memberExpr ) return expr;
    1590 
     1583                Expression *PolyGenericCalculator::postmutate( MemberExpr *memberExpr ) {
    15911584                        // only mutate member expressions for polymorphic types
    15921585                        int tyDepth;
     
    16351628                ObjectDecl *PolyGenericCalculator::makeVar( const std::string &name, Type *type, Initializer *init ) {
    16361629                        ObjectDecl *newObj = new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, 0, type, init );
    1637                         stmtsToAdd.push_back( new DeclStmt( noLabels, newObj ) );
     1630                        stmtsToAddBefore.push_back( new DeclStmt( noLabels, newObj ) );
    16381631                        return newObj;
    16391632                }
     
    17141707                                        addOtypeParamsToLayoutCall( layoutCall, otypeParams );
    17151708
    1716                                         stmtsToAdd.push_back( new ExprStmt( noLabels, layoutCall ) );
     1709                                        stmtsToAddBefore.push_back( new ExprStmt( noLabels, layoutCall ) );
    17171710                                }
    17181711
     
    17401733                                addOtypeParamsToLayoutCall( layoutCall, otypeParams );
    17411734
    1742                                 stmtsToAdd.push_back( new ExprStmt( noLabels, layoutCall ) );
     1735                                stmtsToAddBefore.push_back( new ExprStmt( noLabels, layoutCall ) );
    17431736
    17441737                                return true;
     
    17481741                }
    17491742
    1750                 Expression *PolyGenericCalculator::mutate( SizeofExpr *sizeofExpr ) {
     1743                Expression *PolyGenericCalculator::postmutate( SizeofExpr *sizeofExpr ) {
    17511744                        Type *ty = sizeofExpr->get_isType() ? sizeofExpr->get_type() : sizeofExpr->get_expr()->get_result();
    17521745                        if ( findGeneric( ty ) ) {
     
    17581751                }
    17591752
    1760                 Expression *PolyGenericCalculator::mutate( AlignofExpr *alignofExpr ) {
     1753                Expression *PolyGenericCalculator::postmutate( AlignofExpr *alignofExpr ) {
    17611754                        Type *ty = alignofExpr->get_isType() ? alignofExpr->get_type() : alignofExpr->get_expr()->get_result();
    17621755                        if ( findGeneric( ty ) ) {
     
    17681761                }
    17691762
    1770                 Expression *PolyGenericCalculator::mutate( OffsetofExpr *offsetofExpr ) {
    1771                         // mutate, exiting early if no longer OffsetofExpr
    1772                         Expression *expr = Parent::mutate( offsetofExpr );
    1773                         offsetofExpr = dynamic_cast< OffsetofExpr* >( expr );
    1774                         if ( ! offsetofExpr ) return expr;
    1775 
     1763                Expression *PolyGenericCalculator::postmutate( OffsetofExpr *offsetofExpr ) {
    17761764                        // only mutate expressions for polymorphic structs/unions
    17771765                        Type *ty = offsetofExpr->get_type();
     
    17931781                }
    17941782
    1795                 Expression *PolyGenericCalculator::mutate( OffsetPackExpr *offsetPackExpr ) {
     1783                Expression *PolyGenericCalculator::postmutate( OffsetPackExpr *offsetPackExpr ) {
    17961784                        StructInstType *ty = offsetPackExpr->get_type();
    17971785
     
    18321820                }
    18331821
    1834                 void PolyGenericCalculator::doBeginScope() {
     1822                void PolyGenericCalculator::beginScope() {
    18351823                        knownLayouts.beginScope();
    18361824                        knownOffsets.beginScope();
    18371825                }
    18381826
    1839                 void PolyGenericCalculator::doEndScope() {
     1827                void PolyGenericCalculator::endScope() {
    18401828                        knownLayouts.endScope();
    18411829                        knownOffsets.endScope();
     
    18941882
    18951883                        addToTyVarMap( typeDecl, scopeTyVars );
    1896                         return Mutator::mutate( typeDecl );
     1884                        return dynamic_cast<TypeDecl*>( Mutator::mutate( typeDecl ) );
    18971885                }
    18981886
  • src/GenPoly/InstantiateGeneric.cc

    rb2e2e34 rc935c3a  
    459459                        Declaration * member = *std::next( aggr->members.begin(), memberIndex );
    460460                        assertf( member->name == memberExpr->member->name, "Instantiation has different member order than the generic type. %s / %s", toString( member ).c_str(), toString( memberExpr->member ).c_str() );
    461                         DeclarationWithType * field = safe_dynamic_cast< DeclarationWithType * >( member );
     461                        DeclarationWithType * field = strict_dynamic_cast< DeclarationWithType * >( member );
    462462                        MemberExpr * ret = new MemberExpr( field, memberExpr->aggregate->clone() );
    463463                        std::swap( ret->env, memberExpr->env );
  • src/GenPoly/Lvalue.cc

    rb2e2e34 rc935c3a  
    1414//
    1515
    16 #include <cassert>                       // for safe_dynamic_cast
     16#include <cassert>                       // for strict_dynamic_cast
    1717#include <string>                        // for string
    1818
  • src/InitTweak/FixInit.cc

    rb2e2e34 rc935c3a  
    1717#include <stddef.h>                    // for NULL
    1818#include <algorithm>                   // for set_difference, copy_if
    19 #include <cassert>                     // for assert, safe_dynamic_cast
     19#include <cassert>                     // for assert, strict_dynamic_cast
    2020#include <iostream>                    // for operator<<, ostream, basic_ost...
    2121#include <iterator>                    // for insert_iterator, back_inserter
     
    424424                        // arrays are not copy constructed, so this should always be an ExprStmt
    425425                        ImplicitCtorDtorStmt * stmt = genCtorDtor( fname, var, cpArg );
    426                         ExprStmt * exprStmt = safe_dynamic_cast< ExprStmt * >( stmt->get_callStmt() );
     426                        ExprStmt * exprStmt = strict_dynamic_cast< ExprStmt * >( stmt->get_callStmt() );
    427427                        Expression * untyped = exprStmt->get_expr();
    428428
     
    532532                                assert( ! body->get_kids().empty() );
    533533                                // must be an ExprStmt, otherwise it wouldn't have a result
    534                                 ExprStmt * last = safe_dynamic_cast< ExprStmt * >( body->get_kids().back() );
     534                                ExprStmt * last = strict_dynamic_cast< ExprStmt * >( body->get_kids().back() );
    535535                                last->set_expr( makeCtorDtor( "?{}", ret, last->get_expr() ) );
    536536
     
    566566                        CP_CTOR_PRINT( std::cerr << "FixCopyCtors: " << impCpCtorExpr << std::endl; )
    567567
    568                         impCpCtorExpr = safe_dynamic_cast< ImplicitCopyCtorExpr * >( Parent::mutate( impCpCtorExpr ) );
     568                        impCpCtorExpr = strict_dynamic_cast< ImplicitCopyCtorExpr * >( Parent::mutate( impCpCtorExpr ) );
    569569                        std::list< ObjectDecl * > & tempDecls = impCpCtorExpr->get_tempDecls();
    570570                        std::list< ObjectDecl * > & returnDecls = impCpCtorExpr->get_returnDecls();
     
    627627                                stmt = stmt->acceptMutator( *this );
    628628                        } // for
    629                         // stmtExpr = safe_dynamic_cast< StmtExpr * >( Parent::mutate( stmtExpr ) );
     629                        // stmtExpr = strict_dynamic_cast< StmtExpr * >( Parent::mutate( stmtExpr ) );
    630630                        assert( stmtExpr->get_result() );
    631631                        Type * result = stmtExpr->get_result();
     
    791791                                                }
    792792                                        } else {
    793                                                 ImplicitCtorDtorStmt * implicit = safe_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor );
     793                                                ImplicitCtorDtorStmt * implicit = strict_dynamic_cast< ImplicitCtorDtorStmt * > ( ctor );
    794794                                                ExprStmt * ctorStmt = dynamic_cast< ExprStmt * >( implicit->get_callStmt() );
    795795                                                ApplicationExpr * ctorCall = nullptr;
     
    996996                                FunctionType * type = function->get_functionType();
    997997                                assert( ! type->get_parameters().empty() );
    998                                 thisParam = safe_dynamic_cast< ObjectDecl * >( type->get_parameters().front() );
     998                                thisParam = strict_dynamic_cast< ObjectDecl * >( type->get_parameters().front() );
    999999                                Type * thisType = getPointerBase( thisParam->get_type() );
    10001000                                StructInstType * structType = dynamic_cast< StructInstType * >( thisType );
     
    11661166
    11671167                Expression* MutatingResolver::mutate( UntypedExpr *untypedExpr ) {
    1168                         return safe_dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untypedExpr, indexer ) );
     1168                        return strict_dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untypedExpr, indexer ) );
    11691169                }
    11701170
     
    11791179
    11801180                        // xxx - this can be TupleAssignExpr now. Need to properly handle this case.
    1181                         ApplicationExpr * callExpr = safe_dynamic_cast< ApplicationExpr * > ( ctorExpr->get_callExpr() );
     1181                        ApplicationExpr * callExpr = strict_dynamic_cast< ApplicationExpr * > ( ctorExpr->get_callExpr() );
    11821182                        TypeSubstitution * env = ctorExpr->get_env();
    11831183                        ctorExpr->set_callExpr( nullptr );
  • src/InitTweak/GenInit.cc

    rb2e2e34 rc935c3a  
    1717#include <stddef.h>                // for NULL
    1818#include <algorithm>               // for any_of
    19 #include <cassert>                 // for assert, safe_dynamic_cast, assertf
     19#include <cassert>                 // for assert, strict_dynamic_cast, assertf
    2020#include <iterator>                // for back_inserter, inserter, back_inse...
    2121#include <list>                    // for _List_iterator, list
     
    255255                SymTab::genImplicitCall( srcParam, new VariableExpr( objDecl ), fname, back_inserter( stmts ), objDecl );
    256256                assert( stmts.size() <= 1 );
    257                 return stmts.size() == 1 ? safe_dynamic_cast< ImplicitCtorDtorStmt * >( stmts.front() ) : nullptr;
     257                return stmts.size() == 1 ? strict_dynamic_cast< ImplicitCtorDtorStmt * >( stmts.front() ) : nullptr;
    258258        }
    259259
  • src/InitTweak/InitTweak.cc

    rb2e2e34 rc935c3a  
    11#include <stddef.h>                // for NULL
    22#include <algorithm>               // for find, all_of
    3 #include <cassert>                 // for assertf, assert, safe_dynamic_cast
     3#include <cassert>                 // for assertf, assert, strict_dynamic_cast
    44#include <iostream>                // for ostream, cerr, endl
    55#include <iterator>                // for back_insert_iterator, back_inserter
     
    414414                        std::list< Statement * > & stmts = tupleExpr->get_stmtExpr()->get_statements()->get_kids();
    415415                        assertf( ! stmts.empty(), "TupleAssignExpr somehow has no statements." );
    416                         ExprStmt * stmt = safe_dynamic_cast< ExprStmt * >( stmts.back() );
    417                         TupleExpr * tuple = safe_dynamic_cast< TupleExpr * >( stmt->get_expr() );
     416                        ExprStmt * stmt = strict_dynamic_cast< ExprStmt * >( stmts.back() );
     417                        TupleExpr * tuple = strict_dynamic_cast< TupleExpr * >( stmt->get_expr() );
    418418                        assertf( ! tuple->get_exprs().empty(), "TupleAssignExpr somehow has empty tuple expr." );
    419419                        return getCallArg( tuple->get_exprs().front(), pos );
  • src/Makefile.in

    rb2e2e34 rc935c3a  
    159159        CodeTools/driver_cfa_cpp-TrackLoc.$(OBJEXT) \
    160160        Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT) \
     161        Concurrency/driver_cfa_cpp-Waitfor.$(OBJEXT) \
    161162        Common/driver_cfa_cpp-SemanticError.$(OBJEXT) \
    162163        Common/driver_cfa_cpp-UniqueName.$(OBJEXT) \
     
    490491        CodeGen/OperatorTable.cc CodeTools/DeclStats.cc \
    491492        CodeTools/TrackLoc.cc Concurrency/Keywords.cc \
    492         Common/SemanticError.cc Common/UniqueName.cc \
    493         Common/DebugMalloc.cc Common/Assert.cc \
     493        Concurrency/Waitfor.cc Common/SemanticError.cc \
     494        Common/UniqueName.cc Common/DebugMalloc.cc Common/Assert.cc \
    494495        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    495496        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
     
    663664        @: > Concurrency/$(DEPDIR)/$(am__dirstamp)
    664665Concurrency/driver_cfa_cpp-Keywords.$(OBJEXT):  \
     666        Concurrency/$(am__dirstamp) \
     667        Concurrency/$(DEPDIR)/$(am__dirstamp)
     668Concurrency/driver_cfa_cpp-Waitfor.$(OBJEXT):  \
    665669        Concurrency/$(am__dirstamp) \
    666670        Concurrency/$(DEPDIR)/$(am__dirstamp)
     
    995999@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
    9961000@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Keywords.Po@am__quote@
     1001@AMDEP_TRUE@@am__include@ @am__quote@Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Po@am__quote@
    9971002@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ExceptTranslate.Po@am__quote@
    9981003@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@
     
    12631268@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Keywords.obj `if test -f 'Concurrency/Keywords.cc'; then $(CYGPATH_W) 'Concurrency/Keywords.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Keywords.cc'; fi`
    12641269
     1270Concurrency/driver_cfa_cpp-Waitfor.o: Concurrency/Waitfor.cc
     1271@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Concurrency/driver_cfa_cpp-Waitfor.o -MD -MP -MF Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo -c -o Concurrency/driver_cfa_cpp-Waitfor.o `test -f 'Concurrency/Waitfor.cc' || echo '$(srcdir)/'`Concurrency/Waitfor.cc
     1272@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Po
     1273@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Concurrency/Waitfor.cc' object='Concurrency/driver_cfa_cpp-Waitfor.o' libtool=no @AMDEPBACKSLASH@
     1274@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1275@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Waitfor.o `test -f 'Concurrency/Waitfor.cc' || echo '$(srcdir)/'`Concurrency/Waitfor.cc
     1276
     1277Concurrency/driver_cfa_cpp-Waitfor.obj: Concurrency/Waitfor.cc
     1278@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Concurrency/driver_cfa_cpp-Waitfor.obj -MD -MP -MF Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo -c -o Concurrency/driver_cfa_cpp-Waitfor.obj `if test -f 'Concurrency/Waitfor.cc'; then $(CYGPATH_W) 'Concurrency/Waitfor.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Waitfor.cc'; fi`
     1279@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Tpo Concurrency/$(DEPDIR)/driver_cfa_cpp-Waitfor.Po
     1280@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Concurrency/Waitfor.cc' object='Concurrency/driver_cfa_cpp-Waitfor.obj' libtool=no @AMDEPBACKSLASH@
     1281@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     1282@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Concurrency/driver_cfa_cpp-Waitfor.obj `if test -f 'Concurrency/Waitfor.cc'; then $(CYGPATH_W) 'Concurrency/Waitfor.cc'; else $(CYGPATH_W) '$(srcdir)/Concurrency/Waitfor.cc'; fi`
     1283
    12651284Common/driver_cfa_cpp-SemanticError.o: Common/SemanticError.cc
    12661285@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Common/driver_cfa_cpp-SemanticError.o -MD -MP -MF Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Tpo -c -o Common/driver_cfa_cpp-SemanticError.o `test -f 'Common/SemanticError.cc' || echo '$(srcdir)/'`Common/SemanticError.cc
  • src/Parser/DeclarationNode.cc

    rb2e2e34 rc935c3a  
    1414//
    1515
    16 #include <cassert>                 // for assert, assertf, safe_dynamic_cast
     16#include <cassert>                 // for assert, assertf, strict_dynamic_cast
    1717#include <iterator>                // for back_insert_iterator
    1818#include <list>                    // for list
     
    333333DeclarationNode * DeclarationNode::newTypeDecl( string * name, DeclarationNode * typeParams ) {
    334334        DeclarationNode * newnode = new DeclarationNode;
     335        newnode->name = name;
    335336        newnode->type = new TypeData( TypeData::Symbolic );
    336337        newnode->type->symbolic.isTypedef = false;
    337338        newnode->type->symbolic.params = typeParams;
    338         newnode->type->symbolic.name = name;
    339339        return newnode;
    340340} // DeclarationNode::newTypeDecl
     
    10271027
    10281028        if ( asmStmt ) {
    1029                 return new AsmDecl( safe_dynamic_cast<AsmStmt *>( asmStmt->build() ) );
     1029                return new AsmDecl( strict_dynamic_cast<AsmStmt *>( asmStmt->build() ) );
    10301030        } // if
    10311031
  • src/Parser/StatementNode.cc

    rb2e2e34 rc935c3a  
    1414//
    1515
    16 #include <cassert>                 // for assert, safe_dynamic_cast, assertf
     16#include <cassert>                 // for assert, strict_dynamic_cast, assertf
    1717#include <list>                    // for list
    1818#include <memory>                  // for unique_ptr
     
    5757        // find end of list and maintain previous pointer
    5858        for ( StatementNode * curr = prev; curr != nullptr; curr = (StatementNode *)curr->get_next() ) {
    59                 StatementNode *node = safe_dynamic_cast< StatementNode * >(curr);
     59                StatementNode *node = strict_dynamic_cast< StatementNode * >(curr);
    6060                assert( dynamic_cast< CaseStmt * >(node->stmt.get()) );
    6161                prev = curr;
     
    106106                for ( Statement * stmt : init ) {
    107107                        // build the && of all of the declared variables compared against 0
    108                         DeclStmt * declStmt = safe_dynamic_cast< DeclStmt * >( stmt );
    109                         DeclarationWithType * dwt = safe_dynamic_cast< DeclarationWithType * >( declStmt->decl );
     108                        DeclStmt * declStmt = strict_dynamic_cast< DeclStmt * >( stmt );
     109                        DeclarationWithType * dwt = strict_dynamic_cast< DeclarationWithType * >( declStmt->decl );
    110110                        Expression * nze = notZeroExpr( new VariableExpr( dwt ) );
    111111                        cond = cond ? new LogicalExpr( cond, nze, true ) : nze;
     
    202202        std::list< CatchStmt * > branches;
    203203        buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches );
    204         CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
     204        CompoundStmt *tryBlock = strict_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt));
    205205        FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) );
    206206        return new TryStmt( noLabels, tryBlock, branches, finallyBlock );
  • src/ResolvExpr/AlternativeFinder.cc

    rb2e2e34 rc935c3a  
    1515
    1616#include <algorithm>               // for copy
    17 #include <cassert>                 // for safe_dynamic_cast, assert, assertf
     17#include <cassert>                 // for strict_dynamic_cast, assert, assertf
    1818#include <iostream>                // for operator<<, cerr, ostream, endl
    1919#include <iterator>                // for back_insert_iterator, back_inserter
     
    336336
    337337        Cost computeApplicationConversionCost( Alternative &alt, const SymTab::Indexer &indexer ) {
    338                 ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( alt.expr );
    339                 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    340                 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     338                ApplicationExpr *appExpr = strict_dynamic_cast< ApplicationExpr* >( alt.expr );
     339                PointerType *pointer = strict_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
     340                FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() );
    341341
    342342                Cost convCost = Cost::zero;
     
    494494                        Cost cost = Cost::zero;
    495495                        std::list< Expression * > newExprs;
    496                         ObjectDecl * obj = safe_dynamic_cast< ObjectDecl * >( formal );
     496                        ObjectDecl * obj = strict_dynamic_cast< ObjectDecl * >( formal );
    497497                        if ( ! instantiateArgument( obj->get_type(), obj->get_init(), actualExpr, actualEnd, openVars, resultEnv, resultNeed, resultHave, indexer, cost, back_inserter( newExprs ) ) ) {
    498498                                deleteAll( newExprs );
     
    787787
    788788                        PRINT(
    789                                 ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( withFunc->expr );
    790                                 PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
    791                                 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     789                                ApplicationExpr *appExpr = strict_dynamic_cast< ApplicationExpr* >( withFunc->expr );
     790                                PointerType *pointer = strict_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
     791                                FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() );
    792792                                std::cerr << "Case +++++++++++++ " << appExpr->get_function() << std::endl;
    793793                                std::cerr << "formals are:" << std::endl;
  • src/ResolvExpr/CastCost.cc

    rb2e2e34 rc935c3a  
    4545                                }
    4646                        } else if ( ( namedType = indexer.lookupType( destAsTypeInst->get_name() ) ) ) {
    47                                 TypeDecl *type = dynamic_cast< TypeDecl* >( namedType );
    4847                                // all typedefs should be gone by this point
    49                                 assert( type );
     48                                TypeDecl *type = strict_dynamic_cast< TypeDecl* >( namedType );
    5049                                if ( type->get_base() ) {
    5150                                        return castCost( src, type->get_base(), indexer, env ) + Cost::safe;
  • src/ResolvExpr/CommonType.cc

    rb2e2e34 rc935c3a  
    1414//
    1515
    16 #include <cassert>                       // for safe_dynamic_cast
     16#include <cassert>                       // for strict_dynamic_cast
    1717#include <map>                           // for _Rb_tree_const_iterator
    1818#include <utility>                       // for pair
     
    100100                        // special case where one type has a reference depth of 1 larger than the other
    101101                        if ( diff > 0 ) {
    102                                 return handleReference( safe_dynamic_cast<ReferenceType *>( type1 ), type2, widenFirst, widenSecond, indexer, env, openVars );
     102                                return handleReference( strict_dynamic_cast<ReferenceType *>( type1 ), type2, widenFirst, widenSecond, indexer, env, openVars );
    103103                        } else if ( diff < 0 ) {
    104                                 return handleReference( safe_dynamic_cast<ReferenceType *>( type2 ), type1, widenSecond, widenFirst, indexer, env, openVars );
     104                                return handleReference( strict_dynamic_cast<ReferenceType *>( type2 ), type1, widenSecond, widenFirst, indexer, env, openVars );
    105105                        }
    106106                        // otherwise, both are reference types of the same depth and this is handled by the CommonType visitor.
     
    114114                                if ( TypeInstType *inst = dynamic_cast< TypeInstType* >( type2 ) ) {
    115115                                        if ( NamedTypeDecl *nt = indexer.lookupType( inst->get_name() ) ) {
    116                                                 TypeDecl *type = safe_dynamic_cast< TypeDecl* >( nt );
     116                                                TypeDecl *type = strict_dynamic_cast< TypeDecl* >( nt );
    117117                                                if ( type->get_base() ) {
    118118                                                        Type::Qualifiers tq1 = type1->get_qualifiers(), tq2 = type2->get_qualifiers();
     
    301301                        NamedTypeDecl *nt = indexer.lookupType( inst->get_name() );
    302302                        if ( nt ) {
    303                                 TypeDecl *type = safe_dynamic_cast< TypeDecl* >( nt );
     303                                TypeDecl *type = strict_dynamic_cast< TypeDecl* >( nt );
    304304                                if ( type->get_base() ) {
    305305                                        Type::Qualifiers tq1 = inst->get_qualifiers(), tq2 = type2->get_qualifiers();
  • src/ResolvExpr/ConversionCost.cc

    rb2e2e34 rc935c3a  
    9292
    9393        Cost convertToReferenceCost( Type * src, Type * dest, int diff, const SymTab::Indexer & indexer, const TypeEnvironment & env, PtrsFunction func ) {
    94                 PRINT( std::cerr << "convert to reference cost..." << std::endl; )
     94                PRINT( std::cerr << "convert to reference cost... diff " << diff << std::endl; )
    9595                if ( diff > 0 ) {
    9696                        // TODO: document this
    97                         Cost cost = convertToReferenceCost( safe_dynamic_cast< ReferenceType * >( src )->get_base(), dest, diff-1, indexer, env, func );
     97                        Cost cost = convertToReferenceCost( strict_dynamic_cast< ReferenceType * >( src )->get_base(), dest, diff-1, indexer, env, func );
    9898                        cost.incReference();
    9999                        return cost;
    100100                } else if ( diff < -1 ) {
    101101                        // TODO: document this
    102                         Cost cost = convertToReferenceCost( src, safe_dynamic_cast< ReferenceType * >( dest )->get_base(), diff+1, indexer, env, func );
     102                        Cost cost = convertToReferenceCost( src, strict_dynamic_cast< ReferenceType * >( dest )->get_base(), diff+1, indexer, env, func );
    103103                        cost.incReference();
    104104                        return cost;
     
    128128                        ReferenceType * destAsRef = dynamic_cast< ReferenceType * >( dest );
    129129                        assert( diff == -1 && destAsRef );
     130                        PRINT( std::cerr << "dest is: " << dest << " / src is: " << src << std::endl; )
    130131                        if ( typesCompatibleIgnoreQualifiers( src, destAsRef->get_base(), indexer, env ) ) {
    131132                                PRINT( std::cerr << "converting compatible base type" << std::endl; )
  • src/ResolvExpr/CurrentObject.cc

    rb2e2e34 rc935c3a  
    286286                                for ( InitAlternative & alt : ret ) {
    287287                                        PRINT( std::cerr << "iterating and adding designators" << std::endl; )
    288                                         alt.designation->get_designators().push_front( new VariableExpr( safe_dynamic_cast< ObjectDecl * >( *curMember ) ) );
     288                                        alt.designation->get_designators().push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) );
    289289                                        // need to substitute for generic types, so that casts are to concrete types
    290290                                        PRINT( std::cerr << "  type is: " << alt.type; )
     
    346346                                for ( InitAlternative & alt : ret ) {
    347347                                        PRINT( std::cerr << "iterating and adding designators" << std::endl; )
    348                                         alt.designation->get_designators().push_front( new VariableExpr( safe_dynamic_cast< ObjectDecl * >( *curMember ) ) );
     348                                        alt.designation->get_designators().push_front( new VariableExpr( strict_dynamic_cast< ObjectDecl * >( *curMember ) ) );
    349349                                }
    350350                        }
  • src/ResolvExpr/Resolver.cc

    rb2e2e34 rc935c3a  
    1515
    1616#include <stddef.h>                      // for NULL
    17 #include <cassert>                       // for safe_dynamic_cast, assert
     17#include <cassert>                       // for strict_dynamic_cast, assert
    1818#include <memory>                        // for allocator, allocator_traits<...
    1919#include <tuple>                         // for get
     
    342342                        CastExpr * castExpr = new CastExpr( caseStmt->get_condition(), initAlts.front().type->clone() );
    343343                        Expression * newExpr = findSingleExpression( castExpr, *this );
    344                         castExpr = safe_dynamic_cast< CastExpr * >( newExpr );
     344                        castExpr = strict_dynamic_cast< CastExpr * >( newExpr );
    345345                        caseStmt->set_condition( castExpr->get_arg() );
    346346                        castExpr->set_arg( nullptr );
     
    398398                Parent::enterScope();
    399399                Visitor::visit( catchStmt );
    400                
     400
    401401                if ( catchStmt->get_cond() ) {
    402402                        Expression * wrapped = new CastExpr(
     
    423423                UntypedInitExpr * untyped = new UntypedInitExpr( singleInit->get_value(), currentObject.getOptions() );
    424424                Expression * newExpr = findSingleExpression( untyped, *this );
    425                 InitExpr * initExpr = safe_dynamic_cast< InitExpr * >( newExpr );
     425                InitExpr * initExpr = strict_dynamic_cast< InitExpr * >( newExpr );
    426426
    427427                // move cursor to the object that is actually initialized
     
    445445                                        if ( isCharType( pt->get_base() ) ) {
    446446                                                // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
    447                                                 CastExpr *ce = safe_dynamic_cast< CastExpr * >( newExpr );
     447                                                CastExpr *ce = strict_dynamic_cast< CastExpr * >( newExpr );
    448448                                                newExpr = ce->get_arg();
    449449                                                ce->set_arg( nullptr );
  • src/SymTab/Autogen.cc

    rb2e2e34 rc935c3a  
    1818#include <cstddef>                 // for NULL
    1919#include <algorithm>               // for count_if
    20 #include <cassert>                 // for safe_dynamic_cast, assert, assertf
     20#include <cassert>                 // for strict_dynamic_cast, assert, assertf
    2121#include <iterator>                // for back_insert_iterator, back_inserter
    2222#include <list>                    // for list, _List_iterator, list<>::iter...
     
    163163                // Routines at global scope marked "static" to prevent multiple definitions in separate translation units
    164164                // because each unit generates copies of the default routines for each aggregate.
    165 //              DeclarationNode::StorageClass sc = functionNesting > 0 ? DeclarationNode::NoStorageClass : DeclarationNode::Static;
    166165                Type::StorageClasses scs = functionNesting > 0 ? Type::StorageClasses() : Type::StorageClasses( Type::Static );
    167166                LinkageSpec::Spec spec = isIntrinsic ? LinkageSpec::Intrinsic : LinkageSpec::AutoGen;
     
    186185        /// using map and t, determines if is constructable, etc.
    187186        bool lookup( const TypeMap & map, Type * t ) {
     187                assertf( t, "Autogenerate lookup was given non-type: %s", toString( t ).c_str() );
    188188                if ( dynamic_cast< PointerType * >( t ) ) {
    189189                        // will need more complicated checking if we want this to work with pointer types, since currently
     
    200200
    201201        /// using map and aggr, examines each member to determine if constructor, etc. should be generated
    202         template<typename AggrDecl>
    203         bool shouldGenerate( const TypeMap & map, AggrDecl * aggr ) {
    204                 for ( Declaration * dcl : aggr->get_members() ) {
    205                         if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( dcl ) ) {
    206                                 if ( ! lookup( map, dwt->get_type() ) ) return false;
    207                         }
     202        template<typename Container>
     203        bool shouldGenerate( const TypeMap & map, const Container & container ) {
     204                for ( Type * t : container ) {
     205                        if ( ! lookup( map, t ) ) return false;
    208206                }
    209207                return true;
     
    211209
    212210        /// data structure for abstracting the generation of special functions
    213         template< typename OutputIterator >
     211        template< typename OutputIterator, typename Container >
    214212        struct FuncGenerator {
    215                 StructDecl *aggregateDecl;
    216                 StructInstType *refType;
     213                const Container & container;
     214                Type *refType;
    217215                unsigned int functionNesting;
    218216                const std::list< TypeDecl* > & typeParams;
    219217                OutputIterator out;
    220                 FuncGenerator( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, const std::list< TypeDecl* > & typeParams, OutputIterator out ) : aggregateDecl( aggregateDecl ), refType( refType ), functionNesting( functionNesting ), typeParams( typeParams ), out( out ) {}
     218                FuncGenerator( const Container & container, Type *refType, unsigned int functionNesting, const std::list< TypeDecl* > & typeParams, OutputIterator out ) : container( container ), refType( refType ), functionNesting( functionNesting ), typeParams( typeParams ), out( out ) {}
    221219
    222220                /// generates a function (?{}, ?=?, ^?{}) based on the data argument and members. If function is generated, inserts the type into the map.
    223221                void gen( const FuncData & data, bool concurrent_type ) {
    224                         if ( ! shouldGenerate( data.map, aggregateDecl ) ) return;
     222                        if ( ! shouldGenerate( data.map, container ) ) return;
    225223                        FunctionType * ftype = data.genType( refType );
    226224
    227225                        if(concurrent_type && CodeGen::isDestructor( data.fname )) {
    228                                 ftype->get_parameters().front()->get_type()->set_mutex( true );
    229                         }
    230 
    231                         cloneAll( typeParams, ftype->get_forall() );
     226                                ftype->parameters.front()->get_type()->set_mutex( true );
     227                        }
     228
     229                        cloneAll( typeParams, ftype->forall );
    232230                        *out++ = genFunc( data.fname, ftype, functionNesting );
    233231                        data.map.insert( Mangler::mangleType( refType ), true );
     
    235233        };
    236234
    237         template< typename OutputIterator >
    238         FuncGenerator<OutputIterator> makeFuncGenerator( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, const std::list< TypeDecl* > & typeParams, OutputIterator out ) {
    239                 return FuncGenerator<OutputIterator>( aggregateDecl, refType, functionNesting, typeParams, out );
     235        template< typename OutputIterator, typename Container >
     236        FuncGenerator<OutputIterator, Container> makeFuncGenerator( const Container & container, Type *refType, unsigned int functionNesting, const std::list< TypeDecl* > & typeParams, OutputIterator out ) {
     237                return FuncGenerator<OutputIterator, Container>( container, refType, functionNesting, typeParams, out );
    240238        }
    241239
     
    250248                // parameters) are using in the variable exprs
    251249                assert( ftype->get_parameters().size() == 2 );
    252                 ObjectDecl * dstParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
    253                 ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
     250                ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
     251                ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
    254252
    255253                VariableExpr * assignVarExpr = new VariableExpr( assignDecl );
     
    307305
    308306                // assign to destination
    309                 Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), safe_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );
     307                Expression *dstselect = new MemberExpr( field, new CastExpr( new VariableExpr( dstParam ), strict_dynamic_cast< ReferenceType* >( dstParam->get_type() )->get_base()->clone() ) );
    310308                genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward );
    311309        }
     
    393391        }
    394392
     393        Type * declToType( Declaration * decl ) {
     394                if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * >( decl ) ) {
     395                        return dwt->get_type();
     396                }
     397                return nullptr;
     398        }
     399
    395400        /// generates struct constructors, destructor, and assignment functions
    396401        void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) {
     
    406411                // generate each of the functions based on the supplied FuncData objects
    407412                std::list< FunctionDecl * > newFuncs;
    408                 auto generator = makeFuncGenerator( aggregateDecl, refType, functionNesting, typeParams, back_inserter( newFuncs ) );
     413                // structure that iterates aggregate decl members, returning their types
     414                auto generator = makeFuncGenerator( lazy_map( aggregateDecl->members, declToType ), refType, functionNesting, typeParams, back_inserter( newFuncs ) );
    409415                for ( const FuncData & d : data ) {
    410416                        generator.gen( d, aggregateDecl->is_thread() || aggregateDecl->is_monitor() );
     
    436442                                FunctionType * assignType = dcl->get_functionType();
    437443                                assert( assignType->get_parameters().size() == 2 );
    438                                 ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() );
     444                                ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( assignType->get_parameters().back() );
    439445                                dcl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
    440446                        }
     
    487493                FunctionType * ftype = funcDecl->get_functionType();
    488494                assert( ftype->get_parameters().size() == 2 );
    489                 ObjectDecl * dstParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
    490                 ObjectDecl * srcParam = safe_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
     495                ObjectDecl * dstParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().front() );
     496                ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( ftype->get_parameters().back() );
    491497
    492498                makeUnionFieldsAssignment( srcParam, dstParam, back_inserter( funcDecl->get_statements()->get_kids() ) );
     
    605611        }
    606612
     613        Type * declToTypeDeclBase( Declaration * decl ) {
     614                if ( TypeDecl * td = dynamic_cast< TypeDecl * >( decl ) ) {
     615                        return td->base;
     616                }
     617                return nullptr;
     618        }
     619
     620        // generate ctor/dtors/assign for typedecls, e.g., otype T = int *;
    607621        void AutogenerateRoutines::visit( TypeDecl *typeDecl ) {
    608                 TypeInstType *typeInst = new TypeInstType( Type::Qualifiers(), typeDecl->get_name(), false );
    609                 typeInst->set_baseType( typeDecl );
    610                 ObjectDecl *src = new ObjectDecl( "_src", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, typeInst->clone(), nullptr );
    611                 ObjectDecl *dst = new ObjectDecl( "_dst", Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), typeInst->clone() ), nullptr );
    612 
    613                 std::list< Statement * > stmts;
    614                 if ( typeDecl->get_base() ) {
    615                         // xxx - generate ctor/dtors for typedecls, e.g.
    616                         // otype T = int *;
    617                         UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) );
    618                         assign->get_args().push_back( new CastExpr( new VariableExpr( dst ), new PointerType( Type::Qualifiers(), typeDecl->get_base()->clone() ) ) );
    619                         assign->get_args().push_back( new CastExpr( new VariableExpr( src ), typeDecl->get_base()->clone() ) );
    620                         stmts.push_back( new ReturnStmt( std::list< Label >(), assign ) );
    621                 } // if
    622                 FunctionType *type = new FunctionType( Type::Qualifiers(), false );
    623                 type->get_returnVals().push_back( new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, typeInst, 0 ) );
    624                 type->get_parameters().push_back( dst );
    625                 type->get_parameters().push_back( src );
    626                 FunctionDecl *func = genFunc( "?=?", type, functionNesting );
    627                 func->get_statements()->get_kids() = stmts;
    628                 declsToAddAfter.push_back( func );
     622                if ( ! typeDecl->base ) return;
     623
     624                // generate each of the functions based on the supplied FuncData objects
     625                std::list< FunctionDecl * > newFuncs;
     626                std::list< Declaration * > tds { typeDecl };
     627                std::list< TypeDecl * > typeParams;
     628                TypeInstType refType( Type::Qualifiers(), typeDecl->name, typeDecl );
     629                auto generator = makeFuncGenerator( lazy_map( tds, declToTypeDeclBase ), &refType, functionNesting, typeParams, back_inserter( newFuncs ) );
     630                for ( const FuncData & d : data ) {
     631                        generator.gen( d, false );
     632                }
     633
     634                if ( functionNesting == 0 ) {
     635                        // forward declare if top-level struct, so that
     636                        // type is complete as soon as its body ends
     637                        // Note: this is necessary if we want structs which contain
     638                        // generic (otype) structs as members.
     639                        for ( FunctionDecl * dcl : newFuncs ) {
     640                                addForwardDecl( dcl, declsToAddAfter );
     641                        }
     642                }
     643
     644                for ( FunctionDecl * dcl : newFuncs ) {
     645                        FunctionType * ftype = dcl->type;
     646                        assertf( ftype->parameters.size() == 1 || ftype->parameters.size() == 2, "Incorrect number of parameters in autogenerated typedecl function: %zd", ftype->parameters.size() );
     647                        DeclarationWithType * dst = ftype->parameters.front();
     648                        DeclarationWithType * src = ftype->parameters.size() == 2 ? ftype->parameters.back() : nullptr;
     649                        // generate appropriate calls to member ctor, assignment
     650                        // destructor needs to do everything in reverse, so pass "forward" based on whether the function is a destructor
     651                        UntypedExpr * expr = new UntypedExpr( new NameExpr( dcl->name ) );
     652                        expr->args.push_back( new CastExpr( new VariableExpr( dst ), new ReferenceType( Type::Qualifiers(), typeDecl->base->clone() ) ) );
     653                        if ( src ) expr->args.push_back( new CastExpr( new VariableExpr( src ), typeDecl->base->clone() ) );
     654                        dcl->statements->kids.push_back( new ExprStmt( noLabels, expr ) );
     655                        if ( CodeGen::isAssignment( dcl->get_name() ) ) {
     656                                // assignment needs to return a value
     657                                FunctionType * assignType = dcl->type;
     658                                assert( assignType->parameters.size() == 2 );
     659                                ObjectDecl * srcParam = strict_dynamic_cast< ObjectDecl * >( assignType->parameters.back() );
     660                                dcl->statements->kids.push_back( new ReturnStmt( noLabels, new VariableExpr( srcParam ) ) );
     661                        }
     662                        declsToAddAfter.push_back( dcl );
     663                }
    629664        }
    630665
     
    700735
    701736        Type * AutogenTupleRoutines::mutate( TupleType * tupleType ) {
    702                 tupleType = safe_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) );
     737                tupleType = strict_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) );
    703738                std::string mangleName = SymTab::Mangler::mangleType( tupleType );
    704739                if ( seenTuples.find( mangleName ) != seenTuples.end() ) return tupleType;
     
    768803        CompoundStmt * AutogenTupleRoutines::mutate( CompoundStmt *compoundStmt ) {
    769804                seenTuples.beginScope();
    770                 compoundStmt = safe_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) );
     805                compoundStmt = strict_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) );
    771806                seenTuples.endScope();
    772807                return compoundStmt;
  • src/SymTab/Indexer.cc

    rb2e2e34 rc935c3a  
    1616#include "Indexer.h"
    1717
    18 #include <cassert>                 // for assert, safe_dynamic_cast
     18#include <cassert>                 // for assert, strict_dynamic_cast
    1919#include <iostream>                // for operator<<, basic_ostream, ostream
    2020#include <string>                  // for string, operator<<, operator!=
  • src/SymTab/Validate.cc

    rb2e2e34 rc935c3a  
    176176        };
    177177
    178         class EliminateTypedef : public Mutator {
    179           public:
     178        struct EliminateTypedef final : public WithVisitorRef<EliminateTypedef>, public WithGuards {
    180179                EliminateTypedef() : scopeLevel( 0 ) {}
    181180                /// Replaces typedefs by forward declarations
    182181                static void eliminateTypedef( std::list< Declaration * > &translationUnit );
     182
     183                Type * postmutate( TypeInstType * aggregateUseType );
     184                Declaration * postmutate( TypedefDecl * typeDecl );
     185                void premutate( TypeDecl * typeDecl );
     186                void premutate( FunctionDecl * funcDecl );
     187                void premutate( ObjectDecl * objDecl );
     188                DeclarationWithType * postmutate( ObjectDecl * objDecl );
     189
     190                void premutate( CastExpr * castExpr );
     191
     192                void premutate( CompoundStmt * compoundStmt );
     193                CompoundStmt * postmutate( CompoundStmt * compoundStmt );
     194
     195                void premutate( StructDecl * structDecl );
     196                Declaration * postmutate( StructDecl * structDecl );
     197                void premutate( UnionDecl * unionDecl );
     198                Declaration * postmutate( UnionDecl * unionDecl );
     199                void premutate( EnumDecl * enumDecl );
     200                Declaration * postmutate( EnumDecl * enumDecl );
     201                Declaration * postmutate( TraitDecl * contextDecl );
     202
    183203          private:
    184                 virtual Declaration *mutate( TypedefDecl *typeDecl );
    185                 virtual TypeDecl *mutate( TypeDecl *typeDecl );
    186                 virtual DeclarationWithType *mutate( FunctionDecl *funcDecl );
    187                 virtual DeclarationWithType *mutate( ObjectDecl *objDecl );
    188                 virtual CompoundStmt *mutate( CompoundStmt *compoundStmt );
    189                 virtual Type *mutate( TypeInstType *aggregateUseType );
    190                 virtual Expression *mutate( CastExpr *castExpr );
    191 
    192                 virtual Declaration *mutate( StructDecl * structDecl );
    193                 virtual Declaration *mutate( UnionDecl * unionDecl );
    194                 virtual Declaration *mutate( EnumDecl * enumDecl );
    195                 virtual Declaration *mutate( TraitDecl * contextDecl );
    196 
    197204                template<typename AggDecl>
    198205                AggDecl *handleAggregate( AggDecl * aggDecl );
     
    486493                std::list< DeclarationWithType * > asserts;
    487494                for ( Declaration * decl : inst->baseTrait->members ) {
    488                         asserts.push_back( safe_dynamic_cast<DeclarationWithType *>( decl->clone() ) );
     495                        asserts.push_back( strict_dynamic_cast<DeclarationWithType *>( decl->clone() ) );
    489496                }
    490497                // substitute trait decl parameters for instance parameters
     
    530537                // need to carry over the 'sized' status of each decl in the instance
    531538                for ( auto p : group_iterate( traitDecl->get_parameters(), traitInst->get_parameters() ) ) {
    532                         TypeExpr * expr = safe_dynamic_cast< TypeExpr * >( std::get<1>(p) );
     539                        TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( std::get<1>(p) );
    533540                        if ( TypeInstType * inst = dynamic_cast< TypeInstType * >( expr->get_type() ) ) {
    534541                                TypeDecl * formalDecl = std::get<0>(p);
     
    667674
    668675        void EliminateTypedef::eliminateTypedef( std::list< Declaration * > &translationUnit ) {
    669                 EliminateTypedef eliminator;
     676                PassVisitor<EliminateTypedef> eliminator;
    670677                mutateAll( translationUnit, eliminator );
    671                 if ( eliminator.typedefNames.count( "size_t" ) ) {
     678                if ( eliminator.pass.typedefNames.count( "size_t" ) ) {
    672679                        // grab and remember declaration of size_t
    673                         SizeType = eliminator.typedefNames["size_t"].first->get_base()->clone();
     680                        SizeType = eliminator.pass.typedefNames["size_t"].first->get_base()->clone();
    674681                } else {
    675682                        // xxx - missing global typedef for size_t - default to long unsigned int, even though that may be wrong
     
    681688        }
    682689
    683         Type *EliminateTypedef::mutate( TypeInstType * typeInst ) {
     690        Type * EliminateTypedef::postmutate( TypeInstType * typeInst ) {
    684691                // instances of typedef types will come here. If it is an instance
    685692                // of a typdef type, link the instance to its actual type.
     
    696703                                rtt->get_parameters().clear();
    697704                                cloneAll( typeInst->get_parameters(), rtt->get_parameters() );
    698                                 mutateAll( rtt->get_parameters(), *this );  // recursively fix typedefs on parameters
     705                                mutateAll( rtt->get_parameters(), *visitor );  // recursively fix typedefs on parameters
    699706                        } // if
    700707                        delete typeInst;
     
    708715        }
    709716
    710         Declaration *EliminateTypedef::mutate( TypedefDecl * tyDecl ) {
    711                 Declaration *ret = Mutator::mutate( tyDecl );
    712 
     717        Declaration *EliminateTypedef::postmutate( TypedefDecl * tyDecl ) {
    713718                if ( typedefNames.count( tyDecl->get_name() ) == 1 && typedefNames[ tyDecl->get_name() ].second == scopeLevel ) {
    714719                        // typedef to the same name from the same scope
     
    741746                        return new EnumDecl( enumDecl->get_name(), noAttributes, tyDecl->get_linkage() );
    742747                } else {
    743                         return ret->clone();
    744                 } // if
    745         }
    746 
    747         TypeDecl *EliminateTypedef::mutate( TypeDecl * typeDecl ) {
     748                        return tyDecl->clone();
     749                } // if
     750        }
     751
     752        void EliminateTypedef::premutate( TypeDecl * typeDecl ) {
    748753                TypedefMap::iterator i = typedefNames.find( typeDecl->get_name() );
    749754                if ( i != typedefNames.end() ) {
     
    752757
    753758                typedeclNames[ typeDecl->get_name() ] = typeDecl;
    754                 return Mutator::mutate( typeDecl );
    755         }
    756 
    757         DeclarationWithType *EliminateTypedef::mutate( FunctionDecl * funcDecl ) {
    758                 typedefNames.beginScope();
    759                 DeclarationWithType *ret = Mutator::mutate( funcDecl );
    760                 typedefNames.endScope();
    761                 return ret;
    762         }
    763 
    764         DeclarationWithType *EliminateTypedef::mutate( ObjectDecl * objDecl ) {
    765                 typedefNames.beginScope();
    766                 DeclarationWithType *ret = Mutator::mutate( objDecl );
    767                 typedefNames.endScope();
    768 
    769                 if ( FunctionType *funtype = dynamic_cast<FunctionType *>( ret->get_type() ) ) { // function type?
     759        }
     760
     761        void EliminateTypedef::premutate( FunctionDecl * ) {
     762                GuardScope( typedefNames );
     763        }
     764
     765        void EliminateTypedef::premutate( ObjectDecl * ) {
     766                GuardScope( typedefNames );
     767        }
     768
     769        DeclarationWithType *EliminateTypedef::postmutate( ObjectDecl * objDecl ) {
     770                if ( FunctionType *funtype = dynamic_cast<FunctionType *>( objDecl->get_type() ) ) { // function type?
    770771                        // replace the current object declaration with a function declaration
    771                         FunctionDecl * newDecl = new FunctionDecl( ret->get_name(), ret->get_storageClasses(), ret->get_linkage(), funtype, 0, objDecl->get_attributes(), ret->get_funcSpec() );
     772                        FunctionDecl * newDecl = new FunctionDecl( objDecl->get_name(), objDecl->get_storageClasses(), objDecl->get_linkage(), funtype, 0, objDecl->get_attributes(), objDecl->get_funcSpec() );
    772773                        objDecl->get_attributes().clear();
    773774                        objDecl->set_type( nullptr );
     
    775776                        return newDecl;
    776777                } // if
    777                 return ret;
    778         }
    779 
    780         Expression *EliminateTypedef::mutate( CastExpr * castExpr ) {
    781                 typedefNames.beginScope();
    782                 Expression *ret = Mutator::mutate( castExpr );
    783                 typedefNames.endScope();
    784                 return ret;
    785         }
    786 
    787         CompoundStmt *EliminateTypedef::mutate( CompoundStmt * compoundStmt ) {
    788                 typedefNames.beginScope();
     778                return objDecl;
     779        }
     780
     781        void EliminateTypedef::premutate( CastExpr * ) {
     782                GuardScope( typedefNames );
     783        }
     784
     785        void EliminateTypedef::premutate( CompoundStmt * ) {
     786                GuardScope( typedefNames );
    789787                scopeLevel += 1;
    790                 CompoundStmt *ret = Mutator::mutate( compoundStmt );
    791                 scopeLevel -= 1;
     788                GuardAction( [this](){ scopeLevel -= 1; } );
     789        }
     790
     791        CompoundStmt *EliminateTypedef::postmutate( CompoundStmt * compoundStmt ) {
    792792                // remove and delete decl stmts
    793793                filter( compoundStmt->kids, [](Statement * stmt) {
     
    799799                        return false;
    800800                }, true);
    801                 typedefNames.endScope();
    802                 return ret;
     801                return compoundStmt;
    803802        }
    804803
     
    827826        }
    828827
    829         Declaration *EliminateTypedef::mutate( StructDecl * structDecl ) {
     828        void EliminateTypedef::premutate( StructDecl * structDecl ) {
    830829                addImplicitTypedef( structDecl );
    831                 Mutator::mutate( structDecl );
     830        }
     831
     832
     833        Declaration *EliminateTypedef::postmutate( StructDecl * structDecl ) {
    832834                return handleAggregate( structDecl );
    833835        }
    834836
    835         Declaration *EliminateTypedef::mutate( UnionDecl * unionDecl ) {
     837        void EliminateTypedef::premutate( UnionDecl * unionDecl ) {
    836838                addImplicitTypedef( unionDecl );
    837                 Mutator::mutate( unionDecl );
     839        }
     840
     841        Declaration *EliminateTypedef::postmutate( UnionDecl * unionDecl ) {
    838842                return handleAggregate( unionDecl );
    839843        }
    840844
    841         Declaration *EliminateTypedef::mutate( EnumDecl * enumDecl ) {
     845        void EliminateTypedef::premutate( EnumDecl * enumDecl ) {
    842846                addImplicitTypedef( enumDecl );
    843                 Mutator::mutate( enumDecl );
     847        }
     848
     849        Declaration *EliminateTypedef::postmutate( EnumDecl * enumDecl ) {
    844850                return handleAggregate( enumDecl );
    845851        }
    846852
    847         Declaration *EliminateTypedef::mutate( TraitDecl * contextDecl ) {
    848                 Mutator::mutate( contextDecl );
    849                 return handleAggregate( contextDecl );
     853        Declaration *EliminateTypedef::postmutate( TraitDecl * traitDecl ) {
     854                return handleAggregate( traitDecl );
    850855        }
    851856
     
    892897                        for ( size_t i = 0; paramIter != params->end(); ++paramIter, ++i ) {
    893898                                if ( i < args.size() ) {
    894                                         TypeExpr * expr = safe_dynamic_cast< TypeExpr * >( *std::next( args.begin(), i ) );
     899                                        TypeExpr * expr = strict_dynamic_cast< TypeExpr * >( *std::next( args.begin(), i ) );
    895900                                        sub.add( (*paramIter)->get_name(), expr->get_type()->clone() );
    896901                                } else if ( i == args.size() ) {
     
    962967                if ( retVals.size() > 1 ) {
    963968                        // generate a single return parameter which is the tuple of all of the return values
    964                         TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
     969                        TupleType * tupleType = strict_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
    965970                        // ensure return value is not destructed by explicitly creating an empty ListInit node wherein maybeConstruct is false.
    966971                        ObjectDecl * newRet = new ObjectDecl( "", Type::StorageClasses(), LinkageSpec::Cforall, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
  • src/SynTree/AddressExpr.cc

    rb2e2e34 rc935c3a  
    4747                } else {
    4848                        // taking address of non-lvalue -- must be a reference, loses one layer of reference
    49                         ReferenceType * refType = safe_dynamic_cast< ReferenceType * >( arg->get_result() );
     49                        ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->get_result() );
    5050                        set_result( addrType( refType->get_base() ) );
    5151                }
  • src/SynTree/ApplicationExpr.cc

    rb2e2e34 rc935c3a  
    1414//
    1515
    16 #include <cassert>               // for safe_dynamic_cast, assert
     16#include <cassert>               // for strict_dynamic_cast, assert
    1717#include <list>                  // for list
    1818#include <map>                   // for _Rb_tree_const_iterator, map, map<>:...
     
    5050
    5151ApplicationExpr::ApplicationExpr( Expression *funcExpr, const std::list<Expression *> & args ) : function( funcExpr ), args( args ) {
    52         PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() );
    53         FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
     52        PointerType *pointer = strict_dynamic_cast< PointerType* >( funcExpr->get_result() );
     53        FunctionType *function = strict_dynamic_cast< FunctionType* >( pointer->get_base() );
    5454
    5555        set_result( ResolvExpr::extractResultType( function ) );
  • src/SynTree/CompoundStmt.cc

    rb2e2e34 rc935c3a  
    1414//
    1515
    16 #include <cassert>                    // for assert, safe_dynamic_cast
     16#include <cassert>                    // for assert, strict_dynamic_cast
    1717#include <list>                       // for list, _List_const_iterator, lis...
    1818#include <ostream>                    // for operator<<, ostream, basic_ostream
     
    5252                Statement * origStmt = *origit++;
    5353                if ( DeclStmt * declStmt = dynamic_cast< DeclStmt * >( s ) ) {
    54                         DeclStmt * origDeclStmt = safe_dynamic_cast< DeclStmt * >( origStmt );
     54                        DeclStmt * origDeclStmt = strict_dynamic_cast< DeclStmt * >( origStmt );
    5555                        if ( DeclarationWithType * dwt = dynamic_cast< DeclarationWithType * > ( declStmt->get_decl() ) ) {
    56                                 DeclarationWithType * origdwt = safe_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );
     56                                DeclarationWithType * origdwt = strict_dynamic_cast< DeclarationWithType * > ( origDeclStmt->get_decl() );
    5757                                assert( dwt->get_name() == origdwt->get_name() );
    5858                                declMap[ origdwt ] = dwt;
  • src/SynTree/Constant.cc

    rb2e2e34 rc935c3a  
    1414//
    1515
    16 #include <cassert>   // for safe_dynamic_cast, assertf
     16#include <cassert>   // for strict_dynamic_cast, assertf
    1717#include <iostream>  // for operator<<, ostream, basic_ostream
    1818#include <string>    // for to_string, string, char_traits, operator<<
     
    5858
    5959unsigned long long Constant::get_ival() const {
    60         assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
     60        assertf( strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." );
    6161        return val.ival;
    6262}
    6363
    6464double Constant::get_dval() const {
    65         assertf( ! safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
     65        assertf( ! strict_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve dval from integer constant." );
    6666        return val.dval;
    6767}
  • src/SynTree/Declaration.h

    rb2e2e34 rc935c3a  
    137137        void set_bitfieldWidth( Expression *newValue ) { bitfieldWidth = newValue; }
    138138
     139        static ObjectDecl * newObject( const std::string & name, Type * type, Initializer * init );
     140
    139141        virtual ObjectDecl *clone() const { return new ObjectDecl( *this ); }
    140142        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    155157        virtual ~FunctionDecl();
    156158
    157         Type * get_type() const;
    158         virtual void set_type(Type *);
     159        Type * get_type() const { return type; }
     160        virtual void set_type(Type * t) { type = strict_dynamic_cast< FunctionType* >( t ); }
    159161
    160162        FunctionType * get_functionType() const { return type; }
     
    230232        virtual TypeDecl *clone() const { return new TypeDecl( *this ); }
    231233        virtual void accept( Visitor &v ) { v.visit( this ); }
    232         virtual TypeDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     234        virtual Declaration *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    233235        virtual void print( std::ostream &os, int indent = 0 ) const;
    234236
  • src/SynTree/Expression.h

    rb2e2e34 rc935c3a  
    8686  public:
    8787        Expression * function;
     88        std::list<Expression *> args;
     89        InferredParams inferParams;
    8890
    8991        ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() );
     
    100102        virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }
    101103        virtual void print( std::ostream & os, int indent = 0 ) const;
    102 
    103   private:
    104         std::list<Expression *> args;
    105         InferredParams inferParams;
    106104};
    107105
  • src/SynTree/FunctionDecl.cc

    rb2e2e34 rc935c3a  
    4444        delete type;
    4545        delete statements;
    46 }
    47 
    48 Type * FunctionDecl::get_type() const {
    49         return type;
    50 }
    51 
    52 void FunctionDecl::set_type( Type *t ) {
    53         type = dynamic_cast< FunctionType* >( t );
    54         assert( type );
    5546}
    5647
  • src/SynTree/Mutator.cc

    rb2e2e34 rc935c3a  
    7878}
    7979
    80 TypeDecl * Mutator::mutate( TypeDecl *typeDecl ) {
     80Declaration * Mutator::mutate( TypeDecl *typeDecl ) {
    8181        handleNamedTypeDecl( typeDecl );
    8282        typeDecl->set_init( maybeMutate( typeDecl->get_init(), *this ) );
  • src/SynTree/Mutator.h

    rb2e2e34 rc935c3a  
    3131        virtual Declaration* mutate( EnumDecl *aggregateDecl );
    3232        virtual Declaration* mutate( TraitDecl *aggregateDecl );
    33         virtual TypeDecl* mutate( TypeDecl *typeDecl );
     33        virtual Declaration* mutate( TypeDecl *typeDecl );
    3434        virtual Declaration* mutate( TypedefDecl *typeDecl );
    3535        virtual AsmDecl* mutate( AsmDecl *asmDecl );
  • src/SynTree/ObjectDecl.cc

    rb2e2e34 rc935c3a  
    3838        delete init;
    3939        delete bitfieldWidth;
     40}
     41
     42ObjectDecl * ObjectDecl::newObject( const std::string & name, Type * type, Initializer * init ) {
     43        return new ObjectDecl( name, Type::StorageClasses(), LinkageSpec::C, 0, type, init );
    4044}
    4145
  • src/SynTree/Statement.cc

    rb2e2e34 rc935c3a  
    472472}
    473473
    474 NullStmt::NullStmt( std::list<Label> labels ) : CompoundStmt( labels ) {}
    475 NullStmt::NullStmt() : CompoundStmt( std::list<Label>() ) {}
     474NullStmt::NullStmt( std::list<Label> labels ) : Statement( labels ) {}
     475NullStmt::NullStmt() : Statement( std::list<Label>() ) {}
    476476
    477477void NullStmt::print( std::ostream &os, __attribute__((unused)) int indent ) const {
  • src/SynTree/Statement.h

    rb2e2e34 rc935c3a  
    6767};
    6868
    69 class NullStmt : public CompoundStmt {
     69class NullStmt : public Statement {
    7070  public:
    7171        NullStmt();
     
    155155  public:
    156156        Expression * condition;
     157        std::list<Statement *> statements;
    157158
    158159        SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements );
     
    170171        virtual SwitchStmt *clone() const { return new SwitchStmt( *this ); }
    171172        virtual void print( std::ostream &os, int indent = 0 ) const;
    172   private:
    173         std::list<Statement *> statements;
     173
    174174};
    175175
     
    327327class TryStmt : public Statement {
    328328  public:
    329         CompoundStmt *block;
     329        CompoundStmt * block;
    330330        std::list<CatchStmt *> handlers;
    331         FinallyStmt *finallyBlock;
     331        FinallyStmt * finallyBlock;
    332332
    333333        TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );
  • src/SynTree/TupleExpr.cc

    rb2e2e34 rc935c3a  
    1414//
    1515
    16 #include <cassert>              // for assert, safe_dynamic_cast, assertf
     16#include <cassert>              // for assert, strict_dynamic_cast, assertf
    1717#include <iterator>             // for next
    1818#include <list>                 // for list, _List_iterator
     
    6464
    6565TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) : tuple( tuple ), index( index )  {
    66         TupleType * type = safe_dynamic_cast< TupleType * >( tuple->get_result() );
     66        TupleType * type = strict_dynamic_cast< TupleType * >( tuple->get_result() );
    6767        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    6868        set_result( (*std::next( type->get_types().begin(), index ))->clone() );
  • src/SynTree/Visitor.h

    rb2e2e34 rc935c3a  
    148148}
    149149
    150 template< typename Container, typename VisitorType >
    151 void acceptAllFold( Container &container, VisitorType &visitor, VisitorType &around ) {
    152         SemanticError errors;
    153         for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    154                 try {
    155                         if ( *i ) {
    156                                 VisitorType *v = new VisitorType;
    157                                 (*i)->accept( *v );
    158 
    159                                 typename Container::iterator nxt = i; nxt++; // forward_iterator
    160                                 if ( nxt == container.end() )
    161                                         visitor += *v;
    162                                 else
    163                                         visitor += *v + around;
    164 
    165                                 delete v;
    166                         } // if
    167                 } catch( SemanticError &e ) {
    168                         e.set_location( (*i)->location );
    169                         errors.append( e );
    170                 } // try
    171         } // for
    172         if ( ! errors.isEmpty() ) {
    173                 throw errors;
    174         } // if
    175 }
    176 
    177150// Local Variables: //
    178151// tab-width: 4 //
  • src/Tuples/TupleExpansion.cc

    rb2e2e34 rc935c3a  
    168168                                // steal the already generated assignment to var from the unqExpr - this has been generated by FixInit
    169169                                Expression * expr = unqExpr->get_expr();
    170                                 CommaExpr * commaExpr = safe_dynamic_cast< CommaExpr * >( expr );
     170                                CommaExpr * commaExpr = strict_dynamic_cast< CommaExpr * >( expr );
    171171                                assignUnq = commaExpr->get_arg1();
    172172                                commaExpr->set_arg1( nullptr );
     
    237237                delete tupleExpr;
    238238
    239                 StructInstType * type = safe_dynamic_cast< StructInstType * >( tuple->get_result() );
     239                StructInstType * type = strict_dynamic_cast< StructInstType * >( tuple->get_result() );
    240240                StructDecl * structDecl = type->get_baseStruct();
    241241                assert( structDecl->get_members().size() > idx );
    242242                Declaration * member = *std::next(structDecl->get_members().begin(), idx);
    243                 MemberExpr * memExpr = new MemberExpr( safe_dynamic_cast< DeclarationWithType * >( member ), tuple );
     243                MemberExpr * memExpr = new MemberExpr( strict_dynamic_cast< DeclarationWithType * >( member ), tuple );
    244244                memExpr->set_env( env );
    245245                return memExpr;
  • src/include/cassert

    rb2e2e34 rc935c3a  
    3131        __ASSERT_FUNCTION, fmt, ## __VA_ARGS__ ))
    3232
    33 void __assert_fail_f(   const char *assertion, const char *file, 
    34                                                 unsigned int line, const char *function, 
    35                                                 const char *fmt, ... 
     33void __assert_fail_f(   const char *assertion, const char *file,
     34                                                unsigned int line, const char *function,
     35                                                const char *fmt, ...
    3636        ) __attribute__((noreturn, format(printf, 5, 6)));
    3737
     
    3939
    4040template<typename T, typename U>
    41 static inline T safe_dynamic_cast( const U & src ) {
     41static inline T strict_dynamic_cast( const U & src ) {
    4242        T ret = dynamic_cast<T>(src);
    4343        assert(ret);
  • src/libcfa/concurrency/monitor

    rb2e2e34 rc935c3a  
    103103        unsigned short count;
    104104        monitor_desc ** monitors;
     105        bool is_dtor;
    105106};
    106107
  • src/main.cc

    rb2e2e34 rc935c3a  
    3939#include "Common/UnimplementedError.h"      // for UnimplementedError
    4040#include "Common/utility.h"                 // for deleteAll, filter, printAll
     41#include "Concurrency/Waitfor.h"            // for generateWaitfor
    4142#include "ControlStruct/ExceptTranslate.h"  // for translateEHM
    4243#include "ControlStruct/Mutate.h"           // for mutate
     
    304305                ControlStruct::translateEHM( translationUnit );
    305306
     307                OPTPRINT( "generateWaitfor" );
     308                Concurrency::generateWaitFor( translationUnit );
     309
    306310                OPTPRINT( "convertSpecializations" ) // needs to happen before tuple types are expanded
    307311                GenPoly::convertSpecializations( translationUnit );
  • src/tests/.expect/32/KRfunctions.txt

    rb2e2e34 rc935c3a  
    22__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
    33__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
    4 __attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
    5 __attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
    6 extern int printf(const char *__restrict __format, ...);
    7 int __f0__Fi_iPCii__1(int __a__i_1, const int *__b__PCi_1, int __c__i_1){
    8     __attribute__ ((unused)) int ___retval_f0__i_1;
     4__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern signed int atexit(void (*__func)(void));
     5__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(signed int __status);
     6extern signed int printf(const char *__restrict __format, ...);
     7signed int __f0__Fi_iPCii__1(signed int __a__i_1, const signed int *__b__PCi_1, signed int __c__i_1){
     8    __attribute__ ((unused)) signed int ___retval_f0__i_1;
    99}
    10 int __f1__Fi_PiiPi__1(int *__a__Pi_1, __attribute__ ((unused)) int __b__i_1, int *__c__Pi_1){
    11     __attribute__ ((unused)) int ___retval_f1__i_1;
     10signed int __f1__Fi_PiiPi__1(signed int *__a__Pi_1, __attribute__ ((unused)) signed int __b__i_1, signed int *__c__Pi_1){
     11    __attribute__ ((unused)) signed int ___retval_f1__i_1;
    1212}
    13 int __f2__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
    14     __attribute__ ((unused)) int ___retval_f2__i_1;
     13signed int __f2__Fi_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1){
     14    __attribute__ ((unused)) signed int ___retval_f2__i_1;
    1515}
    1616struct S {
    17     int __i__i_1;
     17    signed int __i__i_1;
    1818};
    1919static inline void ___constructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1);
     
    3636    return ((struct S )___ret__2sS_1);
    3737}
    38 static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, int __i__i_1){
     38static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __i__i_1){
    3939    ((void)((*___dst__R2sS_1).__i__i_1=__i__i_1) /* ?{} */);
    4040}
    41 int __f3__Fi_2sS2sSPi__1(struct S __a__2sS_1, struct S __b__2sS_1, int *__c__Pi_1){
    42     __attribute__ ((unused)) int ___retval_f3__i_1;
     41signed int __f3__Fi_2sS2sSPi__1(struct S __a__2sS_1, struct S __b__2sS_1, signed int *__c__Pi_1){
     42    __attribute__ ((unused)) signed int ___retval_f3__i_1;
    4343    struct S __s__2sS_2;
    4444}
    45 int __f4__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
    46     __attribute__ ((unused)) int ___retval_f4__i_1;
     45signed int __f4__Fi_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1){
     46    __attribute__ ((unused)) signed int ___retval_f4__i_1;
    4747}
    48 int __f5__Fi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
    49     __attribute__ ((unused)) int ___retval_f5__i_1;
     48signed int __f5__Fi_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1){
     49    __attribute__ ((unused)) signed int ___retval_f5__i_1;
    5050}
    51 int (*__f6__FPFi_i__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int __anonymous_object0){
    52     __attribute__ ((unused)) int (*___retval_f6__PFi_i__1)(int __anonymous_object1);
     51signed int (*__f6__FPFi_i__iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1))(signed int __anonymous_object0){
     52    __attribute__ ((unused)) signed int (*___retval_f6__PFi_i__1)(signed int __anonymous_object1);
    5353}
    54 int (*__f7__FPFi_ii__iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))(int __a__i_1, int __b__i_1){
    55     __attribute__ ((unused)) int (*___retval_f7__PFi_ii__1)(int __a__i_1, int __b__i_1);
     54signed int (*__f7__FPFi_ii__iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1))(signed int __a__i_1, signed int __b__i_1){
     55    __attribute__ ((unused)) signed int (*___retval_f7__PFi_ii__1)(signed int __a__i_1, signed int __b__i_1);
    5656}
    57 int *__f8__FPi_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1){
    58     __attribute__ ((unused)) int *___retval_f8__Pi_1;
     57signed int *__f8__FPi_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1){
     58    __attribute__ ((unused)) signed int *___retval_f8__Pi_1;
    5959}
    60 int *const __f9__FCPi_PiiPi__1(int *__a__Pi_1, int __b__i_1, int *__c__Pi_1){
    61     __attribute__ ((unused)) int *const ___retval_f9__CPi_1;
     60signed int *const __f9__FCPi_PiiPi__1(signed int *__a__Pi_1, signed int __b__i_1, signed int *__c__Pi_1){
     61    __attribute__ ((unused)) signed int *const ___retval_f9__CPi_1;
    6262}
    63 int *(*__f10__FPFPi_ii__iPiPid__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1, double __y__d_1))(int __x__i_1, int __y__i_1){
    64     __attribute__ ((unused)) int *(*___retval_f10__PFPi_ii__1)(int __x__i_1, int __y__i_1);
    65     int *__x__FPi_ii__2(int __anonymous_object2, int __anonymous_object3);
     63signed int *(*__f10__FPFPi_ii__iPiPid__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1, double __y__d_1))(signed int __x__i_1, signed int __y__i_1){
     64    __attribute__ ((unused)) signed int *(*___retval_f10__PFPi_ii__1)(signed int __x__i_1, signed int __y__i_1);
     65    signed int *__x__FPi_ii__2(signed int __anonymous_object2, signed int __anonymous_object3);
    6666    ((void)(___retval_f10__PFPi_ii__1=__x__FPi_ii__2) /* ?{} */);
    67     return ((int *(*)(int __x__i_1, int __y__i_1))___retval_f10__PFPi_ii__1);
     67    return ((signed int *(*)(signed int __x__i_1, signed int __y__i_1))___retval_f10__PFPi_ii__1);
    6868}
    69 int (*__f11__FPA0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[]{
    70     __attribute__ ((unused)) int (*___retval_f11__PA0i_1)[];
     69signed int (*__f11__FPA0i_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1))[]{
     70    __attribute__ ((unused)) signed int (*___retval_f11__PA0i_1)[];
    7171}
    72 int (*__f12__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((unsigned int )10)]{
    73     __attribute__ ((unused)) int (*___retval_f12__PA0A0i_1)[][((unsigned int )10)];
     72signed int (*__f12__FPA0A0i_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1))[][((unsigned int )10)]{
     73    __attribute__ ((unused)) signed int (*___retval_f12__PA0A0i_1)[][((unsigned int )10)];
    7474}
    75 int (*__f13__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((unsigned int )10)]{
    76     __attribute__ ((unused)) int (*___retval_f13__PA0A0i_1)[][((unsigned int )10)];
     75signed int (*__f13__FPA0A0i_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1))[][((unsigned int )10)]{
     76    __attribute__ ((unused)) signed int (*___retval_f13__PA0A0i_1)[][((unsigned int )10)];
    7777}
    78 int (*__f14__FPA0A0i_iPiPi__1(int __a__i_1, int *__b__Pi_1, int *__c__Pi_1))[][((unsigned int )10)]{
    79     __attribute__ ((unused)) int (*___retval_f14__PA0A0i_1)[][((unsigned int )10)];
     78signed int (*__f14__FPA0A0i_iPiPi__1(signed int __a__i_1, signed int *__b__Pi_1, signed int *__c__Pi_1))[][((unsigned int )10)]{
     79    __attribute__ ((unused)) signed int (*___retval_f14__PA0A0i_1)[][((unsigned int )10)];
    8080}
    81 int __f15__Fi_iii__1(int __a__i_1, int __b__i_1, int __c__i_1){
    82     __attribute__ ((unused)) int ___retval_f15__i_1;
     81signed int __f15__Fi_iii__1(signed int __a__i_1, signed int __b__i_1, signed int __c__i_1){
     82    __attribute__ ((unused)) signed int ___retval_f15__i_1;
    8383}
    84 const int __fred__FCi___1(){
    85     __attribute__ ((unused)) const int ___retval_fred__Ci_1;
    86     int *(*__x__PFPi_ii__2)(int __anonymous_object4, int __anonymous_object5);
    87     int __a__i_2;
    88     int __b__i_2;
    89     int *(*_tmp_cp_ret0)(int __x__i_1, int __y__i_1);
     84const signed int __fred__FCi___1(){
     85    __attribute__ ((unused)) const signed int ___retval_fred__Ci_1;
     86    signed int *(*__x__PFPi_ii__2)(signed int __anonymous_object4, signed int __anonymous_object5);
     87    signed int __a__i_2;
     88    signed int __b__i_2;
     89    signed int *(*_tmp_cp_ret0)(signed int __x__i_1, signed int __y__i_1);
    9090    ((void)(__x__PFPi_ii__2=(((void)(_tmp_cp_ret0=__f10__FPFPi_ii__iPiPid__1(3, (&__a__i_2), (&__b__i_2), 3.5))) , _tmp_cp_ret0)));
    9191    ((void)(_tmp_cp_ret0) /* ^?{} */);
    92     const int __f1__FCi_iPiPi__2(int __a__i_2, int *__b__Pi_2, int *__c__Pi_2){
    93         __attribute__ ((unused)) const int ___retval_f1__Ci_2;
     92    const signed int __f1__FCi_iPiPi__2(signed int __a__i_2, signed int *__b__Pi_2, signed int *__c__Pi_2){
     93        __attribute__ ((unused)) const signed int ___retval_f1__Ci_2;
    9494    }
    95     const int __f2__FCi_iii__2(int __a__i_2, int __b__i_2, int __c__i_2){
    96         __attribute__ ((unused)) const int ___retval_f2__Ci_2;
     95    const signed int __f2__FCi_iii__2(signed int __a__i_2, signed int __b__i_2, signed int __c__i_2){
     96        __attribute__ ((unused)) const signed int ___retval_f2__Ci_2;
    9797    }
    9898}
  • src/tests/.expect/32/attributes.txt

    rb2e2e34 rc935c3a  
    22__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
    33__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
    4 __attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
    5 __attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
    6 extern int printf(const char *__restrict __format, ...);
    7 int __la__Fi___1(){
    8     __attribute__ ((unused)) int ___retval_la__i_1;
     4__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern signed int atexit(void (*__func)(void));
     5__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(signed int __status);
     6extern signed int printf(const char *__restrict __format, ...);
     7signed int __la__Fi___1(){
     8    __attribute__ ((unused)) signed int ___retval_la__i_1;
    99    L: __attribute__ ((unused)) ((void)1);
    1010}
     
    5454__attribute__ ((unused)) struct __anonymous3;
    5555struct Fdl {
    56     __attribute__ ((unused)) int __f1__i_1;
    57     __attribute__ ((unused)) int __f2__i_1;
    58     __attribute__ ((unused,unused)) int __f3__i_1;
    59     __attribute__ ((unused)) int __f4__i_1;
    60     __attribute__ ((unused,unused)) int __f5__i_1;
    61     __attribute__ ((used,packed)) int __f6__i_1;
    62     __attribute__ ((used,unused,unused)) int __f7__i_1;
    63     __attribute__ ((used,used,unused)) int __f8__i_1;
    64     __attribute__ ((unused)) int __anonymous_object0;
    65     __attribute__ ((unused,unused)) int *__f9__Pi_1;
     56    __attribute__ ((unused)) signed int __f1__i_1;
     57    __attribute__ ((unused)) signed int __f2__i_1;
     58    __attribute__ ((unused,unused)) signed int __f3__i_1;
     59    __attribute__ ((unused)) signed int __f4__i_1;
     60    __attribute__ ((unused,unused)) signed int __f5__i_1;
     61    __attribute__ ((used,packed)) signed int __f6__i_1;
     62    __attribute__ ((used,unused,unused)) signed int __f7__i_1;
     63    __attribute__ ((used,used,unused)) signed int __f8__i_1;
     64    __attribute__ ((unused)) signed int __anonymous_object0;
     65    __attribute__ ((unused,unused)) signed int *__f9__Pi_1;
    6666};
    6767static inline void ___constructor__F_R4sFdl_autogen___1(struct Fdl *___dst__R4sFdl_1);
     
    116116    return ((struct Fdl )___ret__4sFdl_1);
    117117}
    118 static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, int __f1__i_1){
     118static inline void ___constructor__F_R4sFdli_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1){
    119119    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    120120    ((void)((*___dst__R4sFdl_1).__f2__i_1) /* ?{} */);
     
    127127    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    128128}
    129 static inline void ___constructor__F_R4sFdlii_autogen___1(struct Fdl *___dst__R4sFdl_1, int __f1__i_1, int __f2__i_1){
     129static inline void ___constructor__F_R4sFdlii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1){
    130130    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    131131    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     
    138138    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    139139}
    140 static inline void ___constructor__F_R4sFdliii_autogen___1(struct Fdl *___dst__R4sFdl_1, int __f1__i_1, int __f2__i_1, int __f3__i_1){
     140static inline void ___constructor__F_R4sFdliii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1){
    141141    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    142142    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     
    149149    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    150150}
    151 static inline void ___constructor__F_R4sFdliiii_autogen___1(struct Fdl *___dst__R4sFdl_1, int __f1__i_1, int __f2__i_1, int __f3__i_1, int __f4__i_1){
    152     ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    153     ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
    154     ((void)((*___dst__R4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */);
    155     ((void)((*___dst__R4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */);
    156     ((void)((*___dst__R4sFdl_1).__f5__i_1) /* ?{} */);
    157     ((void)((*___dst__R4sFdl_1).__f6__i_1) /* ?{} */);
    158     ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    159     ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
    160     ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    161 }
    162 static inline void ___constructor__F_R4sFdliiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, int __f1__i_1, int __f2__i_1, int __f3__i_1, int __f4__i_1, int __f5__i_1){
    163     ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    164     ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
    165     ((void)((*___dst__R4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */);
    166     ((void)((*___dst__R4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */);
    167     ((void)((*___dst__R4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */);
    168     ((void)((*___dst__R4sFdl_1).__f6__i_1) /* ?{} */);
    169     ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
    170     ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
    171     ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    172 }
    173 static inline void ___constructor__F_R4sFdliiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, int __f1__i_1, int __f2__i_1, int __f3__i_1, int __f4__i_1, int __f5__i_1, int __f6__i_1){
     151static inline void ___constructor__F_R4sFdliiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1){
     152    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
     153    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     154    ((void)((*___dst__R4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */);
     155    ((void)((*___dst__R4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */);
     156    ((void)((*___dst__R4sFdl_1).__f5__i_1) /* ?{} */);
     157    ((void)((*___dst__R4sFdl_1).__f6__i_1) /* ?{} */);
     158    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
     159    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     160    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
     161}
     162static inline void ___constructor__F_R4sFdliiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1){
     163    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
     164    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     165    ((void)((*___dst__R4sFdl_1).__f3__i_1=__f3__i_1) /* ?{} */);
     166    ((void)((*___dst__R4sFdl_1).__f4__i_1=__f4__i_1) /* ?{} */);
     167    ((void)((*___dst__R4sFdl_1).__f5__i_1=__f5__i_1) /* ?{} */);
     168    ((void)((*___dst__R4sFdl_1).__f6__i_1) /* ?{} */);
     169    ((void)((*___dst__R4sFdl_1).__f7__i_1) /* ?{} */);
     170    ((void)((*___dst__R4sFdl_1).__f8__i_1) /* ?{} */);
     171    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
     172}
     173static inline void ___constructor__F_R4sFdliiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1){
    174174    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    175175    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     
    182182    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    183183}
    184 static inline void ___constructor__F_R4sFdliiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, int __f1__i_1, int __f2__i_1, int __f3__i_1, int __f4__i_1, int __f5__i_1, int __f6__i_1, int __f7__i_1){
     184static inline void ___constructor__F_R4sFdliiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1){
    185185    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    186186    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     
    193193    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    194194}
    195 static inline void ___constructor__F_R4sFdliiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, int __f1__i_1, int __f2__i_1, int __f3__i_1, int __f4__i_1, int __f5__i_1, int __f6__i_1, int __f7__i_1, int __f8__i_1){
     195static inline void ___constructor__F_R4sFdliiiiiiii_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1){
    196196    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    197197    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     
    204204    ((void)((*___dst__R4sFdl_1).__f9__Pi_1) /* ?{} */);
    205205}
    206 static inline void ___constructor__F_R4sFdliiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, int __f1__i_1, int __f2__i_1, int __f3__i_1, int __f4__i_1, int __f5__i_1, int __f6__i_1, int __f7__i_1, int __f8__i_1, int *__f9__Pi_1){
     206static inline void ___constructor__F_R4sFdliiiiiiiiPi_autogen___1(struct Fdl *___dst__R4sFdl_1, signed int __f1__i_1, signed int __f2__i_1, signed int __f3__i_1, signed int __f4__i_1, signed int __f5__i_1, signed int __f6__i_1, signed int __f7__i_1, signed int __f8__i_1, signed int *__f9__Pi_1){
    207207    ((void)((*___dst__R4sFdl_1).__f1__i_1=__f1__i_1) /* ?{} */);
    208208    ((void)((*___dst__R4sFdl_1).__f2__i_1=__f2__i_1) /* ?{} */);
     
    215215    ((void)((*___dst__R4sFdl_1).__f9__Pi_1=__f9__Pi_1) /* ?{} */);
    216216}
    217 __attribute__ ((unused)) int __f__Fi___1() asm ( "xyz" );
    218 __attribute__ ((used,used)) const int __vd1__Ci_1;
    219 __attribute__ ((used,unused)) const int __vd2__Ci_1;
    220 __attribute__ ((used,used,used,used)) const int *__vd3__PCi_1;
    221 __attribute__ ((used,used,unused,used,unused)) const int *__vd4__PCi_1;
    222 __attribute__ ((used,used,used)) const int __vd5__A0Ci_1[((unsigned int )5)];
    223 __attribute__ ((used,used,unused,used)) const int __vd6__A0Ci_1[((unsigned int )5)];
    224 __attribute__ ((used,used,used,used)) const int (*__vd7__PFCi___1)();
    225 __attribute__ ((used,used,unused,used,used)) const int (*__vd8__PFCi___1)();
    226 __attribute__ ((unused,used)) int __f1__Fi___1();
    227 __attribute__ ((unused)) int __f1__Fi___1(){
    228     __attribute__ ((unused)) int ___retval_f1__i_1;
    229 }
    230 __attribute__ ((unused,unused,unused,used)) int **const __f2__FCPPi___1();
    231 __attribute__ ((unused,unused,unused)) int **const __f2__FCPPi___1(){
    232     __attribute__ ((unused)) int **const ___retval_f2__CPPi_1;
    233 }
    234 __attribute__ ((unused,used,unused)) int (*__f3__FPA0i_i__1(int __anonymous_object1))[];
    235 __attribute__ ((unused,unused)) int (*__f3__FPA0i_i__1(int __p__i_1))[]{
    236     __attribute__ ((unused)) int (*___retval_f3__PA0i_1)[];
    237 }
    238 __attribute__ ((unused,used,unused)) int (*__f4__FPFi_i____1())(int __anonymous_object2);
    239 __attribute__ ((unused,unused)) int (*__f4__FPFi_i____1())(int __anonymous_object3){
    240     __attribute__ ((unused)) int (*___retval_f4__PFi_i__1)(int __anonymous_object4);
    241 }
    242 int __vtr__Fi___1(){
    243     __attribute__ ((unused)) int ___retval_vtr__i_1;
    244     __attribute__ ((unused,unused,used)) int __t1__i_2;
    245     __attribute__ ((unused,unused,unused,unused,unused)) int **__t2__PPi_2;
    246     __attribute__ ((unused,unused,unused)) int __t3__A0i_2[((unsigned int )5)];
    247     __attribute__ ((unused,unused,unused,unused,unused)) int **__t4__A0PPi_2[((unsigned int )5)];
    248     __attribute__ ((unused,unused,unused)) int __t5__Fi___2();
    249     __attribute__ ((unused,unused,unused,unused)) int *__t6__FPi___2();
    250 }
    251 int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) int __p__i_1, __attribute__ ((unused,unused,unused)) int __q__i_1);
    252 int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) int __p__i_1, __attribute__ ((unused,unused,unused)) int __q__i_1){
    253     __attribute__ ((unused)) int ___retval_ipd1__i_1;
    254 }
    255 int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1);
    256 int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1){
    257     __attribute__ ((unused)) int ___retval_ipd2__i_1;
    258 }
    259 int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1);
    260 int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__p__Pi_1, __attribute__ ((unused,unused,unused)) int *__q__Pi_1){
    261     __attribute__ ((unused)) int ___retval_ipd3__i_1;
    262 }
    263 int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) int (*__q__PFi___1)());
    264 int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) int (*__q__PFi___1)()){
    265     __attribute__ ((unused)) int ___retval_ipd4__i_1;
    266 }
    267 int __tpr1__Fi_i__1(__attribute__ ((unused,unused,unused)) int __Foo__i_1);
    268 int __tpr2__Fi_PPi__1(__attribute__ ((unused,unused,unused,unused,unused,unused)) int **__Foo__PPi_1);
    269 int __tpr3__Fi_Pi__1(__attribute__ ((unused,unused,unused)) int *__Foo__Pi_1);
    270 int __tpr4__Fi_PFi_Pi___1(__attribute__ ((unused,unused)) int (*__anonymous_object5)(__attribute__ ((unused,unused)) int __anonymous_object6[((unsigned int )5)]));
    271 int __tpr5__Fi_PFi____1(__attribute__ ((unused,unused,unused)) int (*__Foo__PFi___1)());
    272 int __tpr6__Fi_PFi____1(__attribute__ ((unused,unused,unused)) int (*__Foo__PFi___1)());
    273 int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) int (*__anonymous_object7)(__attribute__ ((unused)) int (*__anonymous_object8)(__attribute__ ((unused,unused)) int __anonymous_object9)));
    274 int __ad__Fi___1(){
    275     __attribute__ ((unused)) int ___retval_ad__i_1;
    276     __attribute__ ((used,unused)) int __ad1__i_2;
    277     __attribute__ ((unused,unused,unused)) int *__ad2__Pi_2;
    278     __attribute__ ((unused,unused,unused)) int __ad3__A0i_2[((unsigned int )5)];
    279     __attribute__ ((unused,unused,unused,unused,unused)) int (*__ad4__PA0i_2)[((unsigned int )10)];
    280     __attribute__ ((unused,unused,unused,unused,used)) int __ad5__i_2;
    281     __attribute__ ((unused,unused,unused,unused,unused)) int __ad6__Fi___2();
    282     ((void)sizeof(__attribute__ ((unused,unused)) int ));
    283     ((void)sizeof(__attribute__ ((unused,unused,unused,unused)) int **));
    284     ((void)sizeof(__attribute__ ((unused,unused,unused)) int [5]));
    285     ((void)sizeof(__attribute__ ((unused,unused,unused)) int (*)[10]));
    286     ((void)sizeof(__attribute__ ((unused,unused,unused)) int ()));
     217__attribute__ ((unused)) signed int __f__Fi___1() asm ( "xyz" );
     218__attribute__ ((used,used)) const signed int __vd1__Ci_1;
     219__attribute__ ((used,unused)) const signed int __vd2__Ci_1;
     220__attribute__ ((used,used,used,used)) const signed int *__vd3__PCi_1;
     221__attribute__ ((used,used,unused,used,unused)) const signed int *__vd4__PCi_1;
     222__attribute__ ((used,used,used)) const signed int __vd5__A0Ci_1[((unsigned int )5)];
     223__attribute__ ((used,used,unused,used)) const signed int __vd6__A0Ci_1[((unsigned int )5)];
     224__attribute__ ((used,used,used,used)) const signed int (*__vd7__PFCi___1)();
     225__attribute__ ((used,used,unused,used,used)) const signed int (*__vd8__PFCi___1)();
     226__attribute__ ((unused,used)) signed int __f1__Fi___1();
     227__attribute__ ((unused)) signed int __f1__Fi___1(){
     228    __attribute__ ((unused)) signed int ___retval_f1__i_1;
     229}
     230__attribute__ ((unused,unused,unused,used)) signed int **const __f2__FCPPi___1();
     231__attribute__ ((unused,unused,unused)) signed int **const __f2__FCPPi___1(){
     232    __attribute__ ((unused)) signed int **const ___retval_f2__CPPi_1;
     233}
     234__attribute__ ((unused,used,unused)) signed int (*__f3__FPA0i_i__1(signed int __anonymous_object1))[];
     235__attribute__ ((unused,unused)) signed int (*__f3__FPA0i_i__1(signed int __p__i_1))[]{
     236    __attribute__ ((unused)) signed int (*___retval_f3__PA0i_1)[];
     237}
     238__attribute__ ((unused,used,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object2);
     239__attribute__ ((unused,unused)) signed int (*__f4__FPFi_i____1())(signed int __anonymous_object3){
     240    __attribute__ ((unused)) signed int (*___retval_f4__PFi_i__1)(signed int __anonymous_object4);
     241}
     242signed int __vtr__Fi___1(){
     243    __attribute__ ((unused)) signed int ___retval_vtr__i_1;
     244    __attribute__ ((unused,unused,used)) signed int __t1__i_2;
     245    __attribute__ ((unused,unused,unused,unused,unused)) signed int **__t2__PPi_2;
     246    __attribute__ ((unused,unused,unused)) signed int __t3__A0i_2[((unsigned int )5)];
     247    __attribute__ ((unused,unused,unused,unused,unused)) signed int **__t4__A0PPi_2[((unsigned int )5)];
     248    __attribute__ ((unused,unused,unused)) signed int __t5__Fi___2();
     249    __attribute__ ((unused,unused,unused,unused)) signed int *__t6__FPi___2();
     250}
     251signed int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) signed int __p__i_1, __attribute__ ((unused,unused,unused)) signed int __q__i_1);
     252signed int __ipd1__Fi_ii__1(__attribute__ ((unused,unused,unused)) signed int __p__i_1, __attribute__ ((unused,unused,unused)) signed int __q__i_1){
     253    __attribute__ ((unused)) signed int ___retval_ipd1__i_1;
     254}
     255signed int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) signed int *__p__Pi_1, __attribute__ ((unused,unused,unused)) signed int *__q__Pi_1);
     256signed int __ipd2__Fi_PiPi__1(__attribute__ ((unused,unused,unused,unused)) signed int *__p__Pi_1, __attribute__ ((unused,unused,unused)) signed int *__q__Pi_1){
     257    __attribute__ ((unused)) signed int ___retval_ipd2__i_1;
     258}
     259signed int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__p__Pi_1, __attribute__ ((unused,unused,unused)) signed int *__q__Pi_1);
     260signed int __ipd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__p__Pi_1, __attribute__ ((unused,unused,unused)) signed int *__q__Pi_1){
     261    __attribute__ ((unused)) signed int ___retval_ipd3__i_1;
     262}
     263signed int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) signed int (*__q__PFi___1)());
     264signed int __ipd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__p__PFi___1)(), __attribute__ ((unused,unused,unused)) signed int (*__q__PFi___1)()){
     265    __attribute__ ((unused)) signed int ___retval_ipd4__i_1;
     266}
     267signed int __tpr1__Fi_i__1(__attribute__ ((unused,unused,unused)) signed int __Foo__i_1);
     268signed int __tpr2__Fi_PPi__1(__attribute__ ((unused,unused,unused,unused,unused,unused)) signed int **__Foo__PPi_1);
     269signed int __tpr3__Fi_Pi__1(__attribute__ ((unused,unused,unused)) signed int *__Foo__Pi_1);
     270signed int __tpr4__Fi_PFi_Pi___1(__attribute__ ((unused,unused)) signed int (*__anonymous_object5)(__attribute__ ((unused,unused)) signed int __anonymous_object6[((unsigned int )5)]));
     271signed int __tpr5__Fi_PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__Foo__PFi___1)());
     272signed int __tpr6__Fi_PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__Foo__PFi___1)());
     273signed int __tpr7__Fi_PFi_PFi_i____1(__attribute__ ((unused,unused)) signed int (*__anonymous_object7)(__attribute__ ((unused)) signed int (*__anonymous_object8)(__attribute__ ((unused,unused)) signed int __anonymous_object9)));
     274signed int __ad__Fi___1(){
     275    __attribute__ ((unused)) signed int ___retval_ad__i_1;
     276    __attribute__ ((used,unused)) signed int __ad1__i_2;
     277    __attribute__ ((unused,unused,unused)) signed int *__ad2__Pi_2;
     278    __attribute__ ((unused,unused,unused)) signed int __ad3__A0i_2[((unsigned int )5)];
     279    __attribute__ ((unused,unused,unused,unused,unused)) signed int (*__ad4__PA0i_2)[((unsigned int )10)];
     280    __attribute__ ((unused,unused,unused,unused,used)) signed int __ad5__i_2;
     281    __attribute__ ((unused,unused,unused,unused,unused)) signed int __ad6__Fi___2();
     282    ((void)sizeof(__attribute__ ((unused,unused)) signed int ));
     283    ((void)sizeof(__attribute__ ((unused,unused,unused,unused)) signed int **));
     284    ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int [5]));
     285    ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int (*)[10]));
     286    ((void)sizeof(__attribute__ ((unused,unused,unused)) signed int ()));
    287287    __attribute__ ((unused)) struct __anonymous4 {
    288         int __i__i_2;
     288        signed int __i__i_2;
    289289    };
    290290    inline void ___constructor__F_R13s__anonymous4_autogen___2(struct __anonymous4 *___dst__R13s__anonymous4_2){
     
    303303        return ((struct __anonymous4 )___ret__13s__anonymous4_2);
    304304    }
    305     inline void ___constructor__F_R13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__R13s__anonymous4_2, int __i__i_2){
     305    inline void ___constructor__F_R13s__anonymous4i_autogen___2(struct __anonymous4 *___dst__R13s__anonymous4_2, signed int __i__i_2){
    306306        ((void)((*___dst__R13s__anonymous4_2).__i__i_2=__i__i_2) /* ?{} */);
    307307    }
     
    324324    ((void)sizeof(enum __anonymous5 ));
    325325}
    326 int __apd1__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__anonymous_object10, __attribute__ ((unused,unused,unused)) int *__anonymous_object11);
    327 int __apd2__Fi_PPiPPi__1(__attribute__ ((unused,unused,unused,unused)) int **__anonymous_object12, __attribute__ ((unused,unused,unused,unused)) int **__anonymous_object13);
    328 int __apd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) int *__anonymous_object14, __attribute__ ((unused,unused,unused)) int *__anonymous_object15);
    329 int __apd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__anonymous_object16)(), __attribute__ ((unused,unused,unused)) int (*__anonymous_object17)());
    330 int __apd5__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) int (*__anonymous_object18)(__attribute__ ((unused)) int __anonymous_object19), __attribute__ ((unused,unused,unused)) int (*__anonymous_object20)(__attribute__ ((unused)) int __anonymous_object21));
    331 int __apd6__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) int (*__anonymous_object22)(), __attribute__ ((unused,unused,unused)) int (*__anonymous_object23)());
    332 int __apd7__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) int (*__anonymous_object24)(__attribute__ ((unused)) int __anonymous_object25), __attribute__ ((unused,unused,unused)) int (*__anonymous_object26)(__attribute__ ((unused)) int __anonymous_object27));
     326signed int __apd1__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object10, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object11);
     327signed int __apd2__Fi_PPiPPi__1(__attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object12, __attribute__ ((unused,unused,unused,unused)) signed int **__anonymous_object13);
     328signed int __apd3__Fi_PiPi__1(__attribute__ ((unused,unused,unused)) signed int *__anonymous_object14, __attribute__ ((unused,unused,unused)) signed int *__anonymous_object15);
     329signed int __apd4__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object16)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object17)());
     330signed int __apd5__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object18)(__attribute__ ((unused)) signed int __anonymous_object19), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object20)(__attribute__ ((unused)) signed int __anonymous_object21));
     331signed int __apd6__Fi_PFi__PFi____1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object22)(), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object23)());
     332signed int __apd7__Fi_PFi_i_PFi_i___1(__attribute__ ((unused,unused,unused)) signed int (*__anonymous_object24)(__attribute__ ((unused)) signed int __anonymous_object25), __attribute__ ((unused,unused,unused)) signed int (*__anonymous_object26)(__attribute__ ((unused)) signed int __anonymous_object27));
    333333struct Vad {
    334     __attribute__ ((unused)) int __anonymous_object28;
    335     __attribute__ ((unused,unused)) int *__anonymous_object29;
    336     __attribute__ ((unused,unused)) int __anonymous_object30[((unsigned int )10)];
    337     __attribute__ ((unused,unused)) int (*__anonymous_object31)();
     334    __attribute__ ((unused)) signed int __anonymous_object28;
     335    __attribute__ ((unused,unused)) signed int *__anonymous_object29;
     336    __attribute__ ((unused,unused)) signed int __anonymous_object30[((unsigned int )10)];
     337    __attribute__ ((unused,unused)) signed int (*__anonymous_object31)();
    338338};
    339339static inline void ___constructor__F_R4sVad_autogen___1(struct Vad *___dst__R4sVad_1);
  • src/tests/.expect/32/declarationSpecifier.txt

    rb2e2e34 rc935c3a  
    22__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
    33__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
    4 __attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
    5 __attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
    6 extern int printf(const char *__restrict __format, ...);
    7 volatile const short __x1__CVs_1;
    8 static volatile const short __x2__CVs_1;
    9 static volatile const short __x3__CVs_1;
    10 static volatile const short __x4__CVs_1;
    11 static volatile const short __x5__CVs_1;
    12 static volatile const short __x6__CVs_1;
    13 static volatile const short __x7__CVs_1;
    14 static volatile const short __x8__CVs_1;
     4__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern signed int atexit(void (*__func)(void));
     5__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(signed int __status);
     6extern signed int printf(const char *__restrict __format, ...);
     7volatile const signed short int __x1__CVs_1;
     8static volatile const signed short int __x2__CVs_1;
     9static volatile const signed short int __x3__CVs_1;
     10static volatile const signed short int __x4__CVs_1;
     11static volatile const signed short int __x5__CVs_1;
     12static volatile const signed short int __x6__CVs_1;
     13static volatile const signed short int __x7__CVs_1;
     14static volatile const signed short int __x8__CVs_1;
    1515struct __anonymous0 {
    16     int __i__i_1;
     16    signed int __i__i_1;
    1717};
    1818static inline void ___constructor__F_R13s__anonymous0_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1);
     
    3535    return ((struct __anonymous0 )___ret__13s__anonymous0_1);
    3636}
    37 static inline void ___constructor__F_R13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, int __i__i_1){
     37static inline void ___constructor__F_R13s__anonymous0i_autogen___1(struct __anonymous0 *___dst__R13s__anonymous0_1, signed int __i__i_1){
    3838    ((void)((*___dst__R13s__anonymous0_1).__i__i_1=__i__i_1) /* ?{} */);
    3939}
    4040volatile const struct __anonymous0 __x10__CV13s__anonymous0_1;
    4141struct __anonymous1 {
    42     int __i__i_1;
     42    signed int __i__i_1;
    4343};
    4444static inline void ___constructor__F_R13s__anonymous1_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1);
     
    6161    return ((struct __anonymous1 )___ret__13s__anonymous1_1);
    6262}
    63 static inline void ___constructor__F_R13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1, int __i__i_1){
     63static inline void ___constructor__F_R13s__anonymous1i_autogen___1(struct __anonymous1 *___dst__R13s__anonymous1_1, signed int __i__i_1){
    6464    ((void)((*___dst__R13s__anonymous1_1).__i__i_1=__i__i_1) /* ?{} */);
    6565}
    6666volatile const struct __anonymous1 __x11__CV13s__anonymous1_1;
    6767struct __anonymous2 {
    68     int __i__i_1;
     68    signed int __i__i_1;
    6969};
    7070static inline void ___constructor__F_R13s__anonymous2_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1);
     
    8787    return ((struct __anonymous2 )___ret__13s__anonymous2_1);
    8888}
    89 static inline void ___constructor__F_R13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1, int __i__i_1){
     89static inline void ___constructor__F_R13s__anonymous2i_autogen___1(struct __anonymous2 *___dst__R13s__anonymous2_1, signed int __i__i_1){
    9090    ((void)((*___dst__R13s__anonymous2_1).__i__i_1=__i__i_1) /* ?{} */);
    9191}
    9292volatile const struct __anonymous2 __x12__CV13s__anonymous2_1;
    9393struct __anonymous3 {
    94     int __i__i_1;
     94    signed int __i__i_1;
    9595};
    9696static inline void ___constructor__F_R13s__anonymous3_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1);
     
    113113    return ((struct __anonymous3 )___ret__13s__anonymous3_1);
    114114}
    115 static inline void ___constructor__F_R13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1, int __i__i_1){
     115static inline void ___constructor__F_R13s__anonymous3i_autogen___1(struct __anonymous3 *___dst__R13s__anonymous3_1, signed int __i__i_1){
    116116    ((void)((*___dst__R13s__anonymous3_1).__i__i_1=__i__i_1) /* ?{} */);
    117117}
    118118static volatile const struct __anonymous3 __x13__CV13s__anonymous3_1;
    119119struct __anonymous4 {
    120     int __i__i_1;
     120    signed int __i__i_1;
    121121};
    122122static inline void ___constructor__F_R13s__anonymous4_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1);
     
    139139    return ((struct __anonymous4 )___ret__13s__anonymous4_1);
    140140}
    141 static inline void ___constructor__F_R13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1, int __i__i_1){
     141static inline void ___constructor__F_R13s__anonymous4i_autogen___1(struct __anonymous4 *___dst__R13s__anonymous4_1, signed int __i__i_1){
    142142    ((void)((*___dst__R13s__anonymous4_1).__i__i_1=__i__i_1) /* ?{} */);
    143143}
    144144static volatile const struct __anonymous4 __x14__CV13s__anonymous4_1;
    145145struct __anonymous5 {
    146     int __i__i_1;
     146    signed int __i__i_1;
    147147};
    148148static inline void ___constructor__F_R13s__anonymous5_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1);
     
    165165    return ((struct __anonymous5 )___ret__13s__anonymous5_1);
    166166}
    167 static inline void ___constructor__F_R13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1, int __i__i_1){
     167static inline void ___constructor__F_R13s__anonymous5i_autogen___1(struct __anonymous5 *___dst__R13s__anonymous5_1, signed int __i__i_1){
    168168    ((void)((*___dst__R13s__anonymous5_1).__i__i_1=__i__i_1) /* ?{} */);
    169169}
    170170static volatile const struct __anonymous5 __x15__CV13s__anonymous5_1;
    171171struct __anonymous6 {
    172     int __i__i_1;
     172    signed int __i__i_1;
    173173};
    174174static inline void ___constructor__F_R13s__anonymous6_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1);
     
    191191    return ((struct __anonymous6 )___ret__13s__anonymous6_1);
    192192}
    193 static inline void ___constructor__F_R13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1, int __i__i_1){
     193static inline void ___constructor__F_R13s__anonymous6i_autogen___1(struct __anonymous6 *___dst__R13s__anonymous6_1, signed int __i__i_1){
    194194    ((void)((*___dst__R13s__anonymous6_1).__i__i_1=__i__i_1) /* ?{} */);
    195195}
    196196static volatile const struct __anonymous6 __x16__CV13s__anonymous6_1;
    197197struct __anonymous7 {
    198     int __i__i_1;
     198    signed int __i__i_1;
    199199};
    200200static inline void ___constructor__F_R13s__anonymous7_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1);
     
    217217    return ((struct __anonymous7 )___ret__13s__anonymous7_1);
    218218}
    219 static inline void ___constructor__F_R13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1, int __i__i_1){
     219static inline void ___constructor__F_R13s__anonymous7i_autogen___1(struct __anonymous7 *___dst__R13s__anonymous7_1, signed int __i__i_1){
    220220    ((void)((*___dst__R13s__anonymous7_1).__i__i_1=__i__i_1) /* ?{} */);
    221221}
    222222static volatile const struct __anonymous7 __x17__CV13s__anonymous7_1;
    223 volatile const short __x20__CVs_1;
    224 static volatile const short __x21__CVs_1;
    225 static volatile const short __x22__CVs_1;
    226 static volatile const short __x23__CVs_1;
    227 static volatile const short __x24__CVs_1;
    228 static volatile const short __x25__CVs_1;
    229 static volatile const short __x26__CVs_1;
    230 static volatile const short __x27__CVs_1;
     223volatile const signed short int __x20__CVs_1;
     224static volatile const signed short int __x21__CVs_1;
     225static volatile const signed short int __x22__CVs_1;
     226static volatile const signed short int __x23__CVs_1;
     227static volatile const signed short int __x24__CVs_1;
     228static volatile const signed short int __x25__CVs_1;
     229static volatile const signed short int __x26__CVs_1;
     230static volatile const signed short int __x27__CVs_1;
    231231struct __anonymous8 {
    232     short __i__s_1;
     232    signed short int __i__s_1;
    233233};
    234234static inline void ___constructor__F_R13s__anonymous8_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1);
     
    251251    return ((struct __anonymous8 )___ret__13s__anonymous8_1);
    252252}
    253 static inline void ___constructor__F_R13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1, short __i__s_1){
     253static inline void ___constructor__F_R13s__anonymous8s_autogen___1(struct __anonymous8 *___dst__R13s__anonymous8_1, signed short int __i__s_1){
    254254    ((void)((*___dst__R13s__anonymous8_1).__i__s_1=__i__s_1) /* ?{} */);
    255255}
    256256volatile const struct __anonymous8 __x29__CV13s__anonymous8_1;
    257257struct __anonymous9 {
    258     short __i__s_1;
     258    signed short int __i__s_1;
    259259};
    260260static inline void ___constructor__F_R13s__anonymous9_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1);
     
    277277    return ((struct __anonymous9 )___ret__13s__anonymous9_1);
    278278}
    279 static inline void ___constructor__F_R13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1, short __i__s_1){
     279static inline void ___constructor__F_R13s__anonymous9s_autogen___1(struct __anonymous9 *___dst__R13s__anonymous9_1, signed short int __i__s_1){
    280280    ((void)((*___dst__R13s__anonymous9_1).__i__s_1=__i__s_1) /* ?{} */);
    281281}
    282282volatile const struct __anonymous9 __x30__CV13s__anonymous9_1;
    283283struct __anonymous10 {
    284     short __i__s_1;
     284    signed short int __i__s_1;
    285285};
    286286static inline void ___constructor__F_R14s__anonymous10_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1);
     
    303303    return ((struct __anonymous10 )___ret__14s__anonymous10_1);
    304304}
    305 static inline void ___constructor__F_R14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1, short __i__s_1){
     305static inline void ___constructor__F_R14s__anonymous10s_autogen___1(struct __anonymous10 *___dst__R14s__anonymous10_1, signed short int __i__s_1){
    306306    ((void)((*___dst__R14s__anonymous10_1).__i__s_1=__i__s_1) /* ?{} */);
    307307}
    308308volatile const struct __anonymous10 __x31__CV14s__anonymous10_1;
    309309struct __anonymous11 {
    310     short __i__s_1;
     310    signed short int __i__s_1;
    311311};
    312312static inline void ___constructor__F_R14s__anonymous11_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1);
     
    329329    return ((struct __anonymous11 )___ret__14s__anonymous11_1);
    330330}
    331 static inline void ___constructor__F_R14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1, short __i__s_1){
     331static inline void ___constructor__F_R14s__anonymous11s_autogen___1(struct __anonymous11 *___dst__R14s__anonymous11_1, signed short int __i__s_1){
    332332    ((void)((*___dst__R14s__anonymous11_1).__i__s_1=__i__s_1) /* ?{} */);
    333333}
    334334static volatile const struct __anonymous11 __x32__CV14s__anonymous11_1;
    335335struct __anonymous12 {
    336     short __i__s_1;
     336    signed short int __i__s_1;
    337337};
    338338static inline void ___constructor__F_R14s__anonymous12_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1);
     
    355355    return ((struct __anonymous12 )___ret__14s__anonymous12_1);
    356356}
    357 static inline void ___constructor__F_R14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1, short __i__s_1){
     357static inline void ___constructor__F_R14s__anonymous12s_autogen___1(struct __anonymous12 *___dst__R14s__anonymous12_1, signed short int __i__s_1){
    358358    ((void)((*___dst__R14s__anonymous12_1).__i__s_1=__i__s_1) /* ?{} */);
    359359}
    360360static volatile const struct __anonymous12 __x33__CV14s__anonymous12_1;
    361361struct __anonymous13 {
    362     short __i__s_1;
     362    signed short int __i__s_1;
    363363};
    364364static inline void ___constructor__F_R14s__anonymous13_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1);
     
    381381    return ((struct __anonymous13 )___ret__14s__anonymous13_1);
    382382}
    383 static inline void ___constructor__F_R14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1, short __i__s_1){
     383static inline void ___constructor__F_R14s__anonymous13s_autogen___1(struct __anonymous13 *___dst__R14s__anonymous13_1, signed short int __i__s_1){
    384384    ((void)((*___dst__R14s__anonymous13_1).__i__s_1=__i__s_1) /* ?{} */);
    385385}
    386386static volatile const struct __anonymous13 __x34__CV14s__anonymous13_1;
    387387struct __anonymous14 {
    388     short __i__s_1;
     388    signed short int __i__s_1;
    389389};
    390390static inline void ___constructor__F_R14s__anonymous14_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1);
     
    407407    return ((struct __anonymous14 )___ret__14s__anonymous14_1);
    408408}
    409 static inline void ___constructor__F_R14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1, short __i__s_1){
     409static inline void ___constructor__F_R14s__anonymous14s_autogen___1(struct __anonymous14 *___dst__R14s__anonymous14_1, signed short int __i__s_1){
    410410    ((void)((*___dst__R14s__anonymous14_1).__i__s_1=__i__s_1) /* ?{} */);
    411411}
    412412static volatile const struct __anonymous14 __x35__CV14s__anonymous14_1;
    413413struct __anonymous15 {
    414     short __i__s_1;
     414    signed short int __i__s_1;
    415415};
    416416static inline void ___constructor__F_R14s__anonymous15_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1);
     
    433433    return ((struct __anonymous15 )___ret__14s__anonymous15_1);
    434434}
    435 static inline void ___constructor__F_R14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1, short __i__s_1){
     435static inline void ___constructor__F_R14s__anonymous15s_autogen___1(struct __anonymous15 *___dst__R14s__anonymous15_1, signed short int __i__s_1){
    436436    ((void)((*___dst__R14s__anonymous15_1).__i__s_1=__i__s_1) /* ?{} */);
    437437}
    438438static volatile const struct __anonymous15 __x36__CV14s__anonymous15_1;
    439 static inline volatile const int __f11__FCVi___1();
    440 static inline volatile const int __f12__FCVi___1();
    441 static inline volatile const int __f13__FCVi___1();
    442 static inline volatile const int __f14__FCVi___1();
    443 static inline volatile const int __f15__FCVi___1();
    444 static inline volatile const int __f16__FCVi___1();
    445 static inline volatile const int __f17__FCVi___1();
    446 static inline volatile const int __f18__FCVi___1();
    447 static inline volatile const short __f21__FCVs___1();
    448 static inline volatile const short __f22__FCVs___1();
    449 static inline volatile const short __f23__FCVs___1();
    450 static inline volatile const short __f24__FCVs___1();
    451 static inline volatile const short __f25__FCVs___1();
    452 static inline volatile const short __f26__FCVs___1();
    453 static inline volatile const short __f27__FCVs___1();
    454 static inline volatile const short __f28__FCVs___1();
     439static inline volatile const signed int __f11__FCVi___1();
     440static inline volatile const signed int __f12__FCVi___1();
     441static inline volatile const signed int __f13__FCVi___1();
     442static inline volatile const signed int __f14__FCVi___1();
     443static inline volatile const signed int __f15__FCVi___1();
     444static inline volatile const signed int __f16__FCVi___1();
     445static inline volatile const signed int __f17__FCVi___1();
     446static inline volatile const signed int __f18__FCVi___1();
     447static inline volatile const signed short int __f21__FCVs___1();
     448static inline volatile const signed short int __f22__FCVs___1();
     449static inline volatile const signed short int __f23__FCVs___1();
     450static inline volatile const signed short int __f24__FCVs___1();
     451static inline volatile const signed short int __f25__FCVs___1();
     452static inline volatile const signed short int __f26__FCVs___1();
     453static inline volatile const signed short int __f27__FCVs___1();
     454static inline volatile const signed short int __f28__FCVs___1();
    455455struct __anonymous16 {
    456     int __i__i_1;
     456    signed int __i__i_1;
    457457};
    458458static inline void ___constructor__F_R14s__anonymous16_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1);
     
    475475    return ((struct __anonymous16 )___ret__14s__anonymous16_1);
    476476}
    477 static inline void ___constructor__F_R14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1, int __i__i_1){
     477static inline void ___constructor__F_R14s__anonymous16i_autogen___1(struct __anonymous16 *___dst__R14s__anonymous16_1, signed int __i__i_1){
    478478    ((void)((*___dst__R14s__anonymous16_1).__i__i_1=__i__i_1) /* ?{} */);
    479479}
    480480static inline volatile const struct __anonymous16 __f31__FCV14s__anonymous16___1();
    481481struct __anonymous17 {
    482     int __i__i_1;
     482    signed int __i__i_1;
    483483};
    484484static inline void ___constructor__F_R14s__anonymous17_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1);
     
    501501    return ((struct __anonymous17 )___ret__14s__anonymous17_1);
    502502}
    503 static inline void ___constructor__F_R14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1, int __i__i_1){
     503static inline void ___constructor__F_R14s__anonymous17i_autogen___1(struct __anonymous17 *___dst__R14s__anonymous17_1, signed int __i__i_1){
    504504    ((void)((*___dst__R14s__anonymous17_1).__i__i_1=__i__i_1) /* ?{} */);
    505505}
    506506static inline volatile const struct __anonymous17 __f32__FCV14s__anonymous17___1();
    507507struct __anonymous18 {
    508     int __i__i_1;
     508    signed int __i__i_1;
    509509};
    510510static inline void ___constructor__F_R14s__anonymous18_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1);
     
    527527    return ((struct __anonymous18 )___ret__14s__anonymous18_1);
    528528}
    529 static inline void ___constructor__F_R14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1, int __i__i_1){
     529static inline void ___constructor__F_R14s__anonymous18i_autogen___1(struct __anonymous18 *___dst__R14s__anonymous18_1, signed int __i__i_1){
    530530    ((void)((*___dst__R14s__anonymous18_1).__i__i_1=__i__i_1) /* ?{} */);
    531531}
    532532static inline volatile const struct __anonymous18 __f33__FCV14s__anonymous18___1();
    533533struct __anonymous19 {
    534     int __i__i_1;
     534    signed int __i__i_1;
    535535};
    536536static inline void ___constructor__F_R14s__anonymous19_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1);
     
    553553    return ((struct __anonymous19 )___ret__14s__anonymous19_1);
    554554}
    555 static inline void ___constructor__F_R14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1, int __i__i_1){
     555static inline void ___constructor__F_R14s__anonymous19i_autogen___1(struct __anonymous19 *___dst__R14s__anonymous19_1, signed int __i__i_1){
    556556    ((void)((*___dst__R14s__anonymous19_1).__i__i_1=__i__i_1) /* ?{} */);
    557557}
    558558static inline volatile const struct __anonymous19 __f34__FCV14s__anonymous19___1();
    559559struct __anonymous20 {
    560     int __i__i_1;
     560    signed int __i__i_1;
    561561};
    562562static inline void ___constructor__F_R14s__anonymous20_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1);
     
    579579    return ((struct __anonymous20 )___ret__14s__anonymous20_1);
    580580}
    581 static inline void ___constructor__F_R14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1, int __i__i_1){
     581static inline void ___constructor__F_R14s__anonymous20i_autogen___1(struct __anonymous20 *___dst__R14s__anonymous20_1, signed int __i__i_1){
    582582    ((void)((*___dst__R14s__anonymous20_1).__i__i_1=__i__i_1) /* ?{} */);
    583583}
    584584static inline volatile const struct __anonymous20 __f35__FCV14s__anonymous20___1();
    585585struct __anonymous21 {
    586     int __i__i_1;
     586    signed int __i__i_1;
    587587};
    588588static inline void ___constructor__F_R14s__anonymous21_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1);
     
    605605    return ((struct __anonymous21 )___ret__14s__anonymous21_1);
    606606}
    607 static inline void ___constructor__F_R14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1, int __i__i_1){
     607static inline void ___constructor__F_R14s__anonymous21i_autogen___1(struct __anonymous21 *___dst__R14s__anonymous21_1, signed int __i__i_1){
    608608    ((void)((*___dst__R14s__anonymous21_1).__i__i_1=__i__i_1) /* ?{} */);
    609609}
    610610static inline volatile const struct __anonymous21 __f36__FCV14s__anonymous21___1();
    611611struct __anonymous22 {
    612     int __i__i_1;
     612    signed int __i__i_1;
    613613};
    614614static inline void ___constructor__F_R14s__anonymous22_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1);
     
    631631    return ((struct __anonymous22 )___ret__14s__anonymous22_1);
    632632}
    633 static inline void ___constructor__F_R14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1, int __i__i_1){
     633static inline void ___constructor__F_R14s__anonymous22i_autogen___1(struct __anonymous22 *___dst__R14s__anonymous22_1, signed int __i__i_1){
    634634    ((void)((*___dst__R14s__anonymous22_1).__i__i_1=__i__i_1) /* ?{} */);
    635635}
    636636static inline volatile const struct __anonymous22 __f37__FCV14s__anonymous22___1();
    637637struct __anonymous23 {
    638     int __i__i_1;
     638    signed int __i__i_1;
    639639};
    640640static inline void ___constructor__F_R14s__anonymous23_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1);
     
    657657    return ((struct __anonymous23 )___ret__14s__anonymous23_1);
    658658}
    659 static inline void ___constructor__F_R14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1, int __i__i_1){
     659static inline void ___constructor__F_R14s__anonymous23i_autogen___1(struct __anonymous23 *___dst__R14s__anonymous23_1, signed int __i__i_1){
    660660    ((void)((*___dst__R14s__anonymous23_1).__i__i_1=__i__i_1) /* ?{} */);
    661661}
    662662static inline volatile const struct __anonymous23 __f38__FCV14s__anonymous23___1();
    663 static inline volatile const short __f41__FCVs___1();
    664 static inline volatile const short __f42__FCVs___1();
    665 static inline volatile const short __f43__FCVs___1();
    666 static inline volatile const short __f44__FCVs___1();
    667 static inline volatile const short __f45__FCVs___1();
    668 static inline volatile const short __f46__FCVs___1();
    669 static inline volatile const short __f47__FCVs___1();
    670 static inline volatile const short __f48__FCVs___1();
    671 int __main__Fi_iPPCc__1(int __argc__i_1, const char **__argv__PPCc_1){
    672     __attribute__ ((unused)) int ___retval_main__i_1;
    673     ((void)(___retval_main__i_1=((int )0)) /* ?{} */);
    674     return ((int )___retval_main__i_1);
     663static inline volatile const signed short int __f41__FCVs___1();
     664static inline volatile const signed short int __f42__FCVs___1();
     665static inline volatile const signed short int __f43__FCVs___1();
     666static inline volatile const signed short int __f44__FCVs___1();
     667static inline volatile const signed short int __f45__FCVs___1();
     668static inline volatile const signed short int __f46__FCVs___1();
     669static inline volatile const signed short int __f47__FCVs___1();
     670static inline volatile const signed short int __f48__FCVs___1();
     671signed int __main__Fi_iPPCc__1(signed int __argc__i_1, const char **__argv__PPCc_1){
     672    __attribute__ ((unused)) signed int ___retval_main__i_1;
     673    ((void)(___retval_main__i_1=((signed int )0)) /* ?{} */);
     674    return ((signed int )___retval_main__i_1);
    675675    ((void)(___retval_main__i_1=0) /* ?{} */);
    676     return ((int )___retval_main__i_1);
     676    return ((signed int )___retval_main__i_1);
    677677}
    678678static inline int invoke_main(int argc, char* argv[], char* envp[]) { (void)argc; (void)argv; (void)envp; return __main__Fi_iPPCc__1(argc, argv); }
     
    680680__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
    681681__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
    682 __attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
    683 __attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
    684 extern int printf(const char *__restrict __format, ...);
    685 static inline int invoke_main(int argc, char **argv, char **envp);
    686 int main(int __argc__i_1, char **__argv__PPc_1, char **__envp__PPc_1){
    687     __attribute__ ((unused)) int ___retval_main__i_1;
    688     int _tmp_cp_ret0;
     682__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern signed int atexit(void (*__func)(void));
     683__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(signed int __status);
     684extern signed int printf(const char *__restrict __format, ...);
     685static inline signed int invoke_main(signed int argc, char **argv, char **envp);
     686signed int main(signed int __argc__i_1, char **__argv__PPc_1, char **__envp__PPc_1){
     687    __attribute__ ((unused)) signed int ___retval_main__i_1;
     688    signed int _tmp_cp_ret0;
    689689    ((void)(___retval_main__i_1=(((void)(_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1))) , _tmp_cp_ret0)) /* ?{} */);
    690690    ((void)(_tmp_cp_ret0) /* ^?{} */);
    691     return ((int )___retval_main__i_1);
    692 }
     691    return ((signed int )___retval_main__i_1);
     692}
  • src/tests/.expect/32/extension.txt

    rb2e2e34 rc935c3a  
    22__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
    33__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
    4 __attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
    5 __attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
    6 extern int printf(const char *__restrict __format, ...);
    7 __extension__ int __a__i_1;
    8 __extension__ int __b__i_1;
    9 __extension__ int __c__i_1;
     4__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern signed int atexit(void (*__func)(void));
     5__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(signed int __status);
     6extern signed int printf(const char *__restrict __format, ...);
     7__extension__ signed int __a__i_1;
     8__extension__ signed int __b__i_1;
     9__extension__ signed int __c__i_1;
    1010__extension__ struct S {
    11     __extension__ int __a__i_1;
    12     __extension__ int __b__i_1;
    13     __extension__ int __c__i_1;
     11    __extension__ signed int __a__i_1;
     12    __extension__ signed int __b__i_1;
     13    __extension__ signed int __c__i_1;
    1414};
    1515static inline void ___constructor__F_R2sS_autogen___1(struct S *___dst__R2sS_1);
     
    4040    return ((struct S )___ret__2sS_1);
    4141}
    42 static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, int __a__i_1){
     42static inline void ___constructor__F_R2sSi_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1){
    4343    ((void)((*___dst__R2sS_1).__a__i_1=__a__i_1) /* ?{} */);
    4444    ((void)((*___dst__R2sS_1).__b__i_1) /* ?{} */);
    4545    ((void)((*___dst__R2sS_1).__c__i_1) /* ?{} */);
    4646}
    47 static inline void ___constructor__F_R2sSii_autogen___1(struct S *___dst__R2sS_1, int __a__i_1, int __b__i_1){
     47static inline void ___constructor__F_R2sSii_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1, signed int __b__i_1){
    4848    ((void)((*___dst__R2sS_1).__a__i_1=__a__i_1) /* ?{} */);
    4949    ((void)((*___dst__R2sS_1).__b__i_1=__b__i_1) /* ?{} */);
    5050    ((void)((*___dst__R2sS_1).__c__i_1) /* ?{} */);
    5151}
    52 static inline void ___constructor__F_R2sSiii_autogen___1(struct S *___dst__R2sS_1, int __a__i_1, int __b__i_1, int __c__i_1){
     52static inline void ___constructor__F_R2sSiii_autogen___1(struct S *___dst__R2sS_1, signed int __a__i_1, signed int __b__i_1, signed int __c__i_1){
    5353    ((void)((*___dst__R2sS_1).__a__i_1=__a__i_1) /* ?{} */);
    5454    ((void)((*___dst__R2sS_1).__b__i_1=__b__i_1) /* ?{} */);
     
    5656}
    5757__extension__ union U {
    58     __extension__ int __a__i_1;
    59     __extension__ int __b__i_1;
    60     __extension__ int __c__i_1;
     58    __extension__ signed int __a__i_1;
     59    __extension__ signed int __b__i_1;
     60    __extension__ signed int __c__i_1;
    6161};
    6262static inline void ___constructor__F_R2uU_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1){
     
    7373    return ((union U )___ret__2uU_1);
    7474}
    75 static inline void ___constructor__F_R2uUi_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1, int __src__i_1){
    76     ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&__src__i_1)), sizeof(int )));
     75static inline void ___constructor__F_R2uUi_autogen___1(__attribute__ ((unused)) union U *___dst__R2uU_1, signed int __src__i_1){
     76    ((void)__builtin_memcpy(((void *)___dst__R2uU_1), ((const void *)(&__src__i_1)), sizeof(signed int )));
    7777}
    7878__extension__ enum E {
     
    8181    __B__C2eE_1,
    8282};
    83 __extension__ int __f__Fi___1();
    84 __extension__ int i;
    85 __extension__ int j;
    86 __extension__ int __fred__Fi_i__1(int __p__i_1){
    87     __attribute__ ((unused)) int ___retval_fred__i_1;
     83__extension__ signed int __f__Fi___1();
     84__extension__ signed int i;
     85__extension__ signed int j;
     86__extension__ signed int __fred__Fi_i__1(signed int __p__i_1){
     87    __attribute__ ((unused)) signed int ___retval_fred__i_1;
    8888    __extension__ struct S {
    89         __extension__ int __a__i_2;
    90         __extension__ int __b__i_2;
    91         __extension__ int __c__i_2;
    92         __extension__ int *__x__Pi_2;
    93         __extension__ int *__y__Pi_2;
    94         __extension__ int *__z__Pi_2;
     89        __extension__ signed int __a__i_2;
     90        __extension__ signed int __b__i_2;
     91        __extension__ signed int __c__i_2;
     92        __extension__ signed int *__x__Pi_2;
     93        __extension__ signed int *__y__Pi_2;
     94        __extension__ signed int *__z__Pi_2;
    9595    };
    96     int __i__i_2 = ((int )(__extension__ __a__i_1+__extension__ 3));
     96    signed int __i__i_2 = ((signed int )(__extension__ __a__i_1+__extension__ 3));
    9797    ((void)__extension__ 3);
    9898    ((void)__extension__ __a__i_1);
    99     __extension__ int __a__i_2;
    100     __extension__ int __b__i_2;
    101     __extension__ int __c__i_2;
     99    __extension__ signed int __a__i_2;
     100    __extension__ signed int __b__i_2;
     101    __extension__ signed int __c__i_2;
    102102    ((void)(__extension__ __a__i_2=(__extension__ __b__i_2+__extension__ __c__i_2)));
    103     int _tmp_cp_ret0;
     103    signed int _tmp_cp_ret0;
    104104    ((void)(((void)(_tmp_cp_ret0=__extension__ __fred__Fi_i__1(3))) , _tmp_cp_ret0));
    105105    ((void)(_tmp_cp_ret0) /* ^?{} */);
    106     __extension__ int __mary__Fi_i__2(int __p__i_2){
    107         __attribute__ ((unused)) int ___retval_mary__i_2;
     106    __extension__ signed int __mary__Fi_i__2(signed int __p__i_2){
     107        __attribute__ ((unused)) signed int ___retval_mary__i_2;
    108108    }
    109109    ((void)__extension__ sizeof(3));
    110     ((void)__extension__ (((int )(3!=((int )0))) || ((int )(4!=((int )0)))));
     110    ((void)__extension__ (((signed int )(3!=((signed int )0))) || ((signed int )(4!=((signed int )0)))));
    111111    ((void)__extension__ __alignof__(__extension__ __a__i_2));
    112     ((void)(((int )(__extension__ __a__i_2!=((int )0))) || ((int )((((int )(__extension__ __b__i_2!=((int )0))) && ((int )(__extension__ __c__i_2!=((int )0))))!=((int )0)))));
    113     ((void)(((int )((__extension__ __a__i_2>__extension__ __b__i_2)!=((int )0))) ? __extension__ __c__i_2 : __extension__ __c__i_2));
     112    ((void)(((signed int )(__extension__ __a__i_2!=((signed int )0))) || ((signed int )((((signed int )(__extension__ __b__i_2!=((signed int )0))) && ((signed int )(__extension__ __c__i_2!=((signed int )0))))!=((signed int )0)))));
     113    ((void)(((signed int )((__extension__ __a__i_2>__extension__ __b__i_2)!=((signed int )0))) ? __extension__ __c__i_2 : __extension__ __c__i_2));
    114114    ((void)(__extension__ __a__i_2=__extension__ (__extension__ __b__i_2+__extension__ __c__i_2)));
    115115    ((void)(((void)(((void)__extension__ __a__i_2) , __extension__ __b__i_2)) , __extension__ __c__i_2));
  • src/tests/.expect/32/gccExtensions.txt

    rb2e2e34 rc935c3a  
    22__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
    33__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
    4 __attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
    5 __attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
    6 extern int printf(const char *__restrict __format, ...);
    7 extern int __x__i_1 asm ( "xx" );
    8 int __main__Fi_iPPCc__1(int __argc__i_1, const char **__argv__PPCc_1){
    9     __attribute__ ((unused)) int ___retval_main__i_1;
     4__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern signed int atexit(void (*__func)(void));
     5__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(signed int __status);
     6extern signed int printf(const char *__restrict __format, ...);
     7extern signed int __x__i_1 asm ( "xx" );
     8signed int __main__Fi_iPPCc__1(signed int __argc__i_1, const char **__argv__PPCc_1){
     9    __attribute__ ((unused)) signed int ___retval_main__i_1;
    1010    asm ( "nop" :  :  :  );
    1111    asm ( "nop" :  :  :  );
    1212    asm ( "nop" :  :  :  );
    13     static int __y__i_2 asm ( "yy" );
    14     static int *__z__Pi_2 asm ( "zz" );
    15     int __src__i_2;
    16     int __dst__i_2;
    17     asm volatile ( "mov %1, %0\n\tadd $1, %0" :  :  :  );
    18     asm volatile ( "mov %1, %0\n\tadd $1, %0" : "=r" ( __dst__i_2 ) :  :  );
    19     asm volatile ( "mov %1, %0\n\tadd $1, %0" : "=r" ( __dst__i_2 ) : "r" ( __src__i_2 ) :  );
    20     asm ( "mov %1, %0\n\tadd $1, %0" : "=r" ( __dst__i_2 ), "=r" ( __src__i_2 ) : [ __src__i_2 ] "r" ( __dst__i_2 ) : "r0" );
     13    static signed int __y__i_2 asm ( "yy" );
     14    static signed int *__z__Pi_2 asm ( "zz" );
     15    signed int __src__i_2;
     16    signed int __dst__i_2;
     17    asm volatile ( "mov %1, %0\n\t" "add $1, %0" :  :  :  );
     18    asm volatile ( "mov %1, %0\n\t" "add $1, %0" : "=" "r" ( __dst__i_2 ) :  :  );
     19    asm volatile ( "mov %1, %0\n\t" "add $1, %0" : "=r" ( __dst__i_2 ) : "r" ( __src__i_2 ) :  );
     20    asm ( "mov %1, %0\n\t" "add $1, %0" : "=r" ( __dst__i_2 ), "=r" ( __src__i_2 ) : [ __src__i_2 ] "r" ( __dst__i_2 ) : "r0" );
    2121    L2: L1: asm goto ( "frob %%r5, %1; jc %l[L1]; mov (%2), %%r5" :  : "r" ( __src__i_2 ), "r" ( (&__dst__i_2) ) : "r5", "memory" : L1, L2 );
    2222    double _Complex __c1__Xd_2;
    2323    double _Complex __c2__Xd_2;
    24     const int __i1__Ci_2;
    25     const int __i2__Ci_2;
    26     const int __i3__Ci_2;
    27     inline int __f1__Fi___2(){
    28         __attribute__ ((unused)) int ___retval_f1__i_2;
     24    const signed int __i1__Ci_2;
     25    const signed int __i2__Ci_2;
     26    const signed int __i3__Ci_2;
     27    inline signed int __f1__Fi___2(){
     28        __attribute__ ((unused)) signed int ___retval_f1__i_2;
    2929    }
    30     inline int __f2__Fi___2(){
    31         __attribute__ ((unused)) int ___retval_f2__i_2;
     30    inline signed int __f2__Fi___2(){
     31        __attribute__ ((unused)) signed int ___retval_f2__i_2;
    3232    }
    33     int __s1__i_2;
    34     int __s2__i_2;
    35     volatile int __v1__Vi_2;
    36     volatile int __v2__Vi_2;
    37     int __t1___2;
    38     int __t2___2;
    39     __extension__ const int __ex__Ci_2;
     33    signed int __s1__i_2;
     34    signed int __s2__i_2;
     35    volatile signed int __v1__Vi_2;
     36    volatile signed int __v2__Vi_2;
     37    signed int __t1___2;
     38    signed int __t2___2;
     39    __extension__ const signed int __ex__Ci_2;
    4040    struct S {
    41         __extension__ int __a__i_2;
    42         __extension__ int __b__i_2;
    43         __extension__ int __c__i_2;
     41        __extension__ signed int __a__i_2;
     42        __extension__ signed int __b__i_2;
     43        __extension__ signed int __c__i_2;
    4444    };
    4545    inline void ___constructor__F_R2sS_autogen___2(struct S *___dst__R2sS_2){
     
    6666        return ((struct S )___ret__2sS_2);
    6767    }
    68     inline void ___constructor__F_R2sSi_autogen___2(struct S *___dst__R2sS_2, int __a__i_2){
     68    inline void ___constructor__F_R2sSi_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2){
    6969        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
    7070        ((void)((*___dst__R2sS_2).__b__i_2) /* ?{} */);
    7171        ((void)((*___dst__R2sS_2).__c__i_2) /* ?{} */);
    7272    }
    73     inline void ___constructor__F_R2sSii_autogen___2(struct S *___dst__R2sS_2, int __a__i_2, int __b__i_2){
     73    inline void ___constructor__F_R2sSii_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2){
    7474        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
    7575        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
    7676        ((void)((*___dst__R2sS_2).__c__i_2) /* ?{} */);
    7777    }
    78     inline void ___constructor__F_R2sSiii_autogen___2(struct S *___dst__R2sS_2, int __a__i_2, int __b__i_2, int __c__i_2){
     78    inline void ___constructor__F_R2sSiii_autogen___2(struct S *___dst__R2sS_2, signed int __a__i_2, signed int __b__i_2, signed int __c__i_2){
    7979        ((void)((*___dst__R2sS_2).__a__i_2=__a__i_2) /* ?{} */);
    8080        ((void)((*___dst__R2sS_2).__b__i_2=__b__i_2) /* ?{} */);
    8181        ((void)((*___dst__R2sS_2).__c__i_2=__c__i_2) /* ?{} */);
    8282    }
    83     int __i__i_2 = ((int )__extension__ 3);
    84     __extension__ int __a__i_2;
    85     __extension__ int __b__i_2;
    86     __extension__ int __c__i_2;
     83    signed int __i__i_2 = ((signed int )__extension__ 3);
     84    __extension__ signed int __a__i_2;
     85    __extension__ signed int __b__i_2;
     86    __extension__ signed int __c__i_2;
    8787    ((void)(((void)(((void)__extension__ __a__i_2) , __extension__ __b__i_2)) , __extension__ __c__i_2));
    8888    ((void)(__extension__ __a__i_2=(__extension__ __b__i_2+__extension__ __c__i_2)));
    8989    ((void)(__extension__ __a__i_2=__extension__ (__extension__ __b__i_2+__extension__ __c__i_2)));
    90     int __a1__i_2;
    91     const int __a2__Ci_2;
    92     static const int __a3__Ci_2;
    93     static const int __a4__Ci_2;
    94     static const int __a5__Ci_2;
    95     static const int __a6__Ci_2;
    96     static const int __a7__Ci_2;
    97     int *__p1__Pi_2;
    98     int *__p2__Pi_2;
     90    signed int __a1__i_2;
     91    const signed int __a2__Ci_2;
     92    static const signed int __a3__Ci_2;
     93    static const signed int __a4__Ci_2;
     94    static const signed int __a5__Ci_2;
     95    static const signed int __a6__Ci_2;
     96    static const signed int __a7__Ci_2;
     97    signed int *__p1__Pi_2;
     98    signed int *__p2__Pi_2;
    9999    struct s1;
    100100    struct s2 {
    101         int __i__i_2;
     101        signed int __i__i_2;
    102102    };
    103103    inline void ___constructor__F_R3ss2_autogen___2(struct s2 *___dst__R3ss2_2){
     
    116116        return ((struct s2 )___ret__3ss2_2);
    117117    }
    118     inline void ___constructor__F_R3ss2i_autogen___2(struct s2 *___dst__R3ss2_2, int __i__i_2){
     118    inline void ___constructor__F_R3ss2i_autogen___2(struct s2 *___dst__R3ss2_2, signed int __i__i_2){
    119119        ((void)((*___dst__R3ss2_2).__i__i_2=__i__i_2) /* ?{} */);
    120120    }
    121121    struct s3 {
    122         int __i__i_2;
     122        signed int __i__i_2;
    123123    };
    124124    inline void ___constructor__F_R3ss3_autogen___2(struct s3 *___dst__R3ss3_2){
     
    137137        return ((struct s3 )___ret__3ss3_2);
    138138    }
    139     inline void ___constructor__F_R3ss3i_autogen___2(struct s3 *___dst__R3ss3_2, int __i__i_2){
     139    inline void ___constructor__F_R3ss3i_autogen___2(struct s3 *___dst__R3ss3_2, signed int __i__i_2){
    140140        ((void)((*___dst__R3ss3_2).__i__i_2=__i__i_2) /* ?{} */);
    141141    }
     
    143143    struct s3 __y1__3ss3_2;
    144144    struct s4 {
    145         int __i__i_2;
     145        signed int __i__i_2;
    146146    };
    147147    inline void ___constructor__F_R3ss4_autogen___2(struct s4 *___dst__R3ss4_2){
     
    160160        return ((struct s4 )___ret__3ss4_2);
    161161    }
    162     inline void ___constructor__F_R3ss4i_autogen___2(struct s4 *___dst__R3ss4_2, int __i__i_2){
     162    inline void ___constructor__F_R3ss4i_autogen___2(struct s4 *___dst__R3ss4_2, signed int __i__i_2){
    163163        ((void)((*___dst__R3ss4_2).__i__i_2=__i__i_2) /* ?{} */);
    164164    }
    165165    struct s4 __x2__3ss4_2;
    166166    struct s4 __y2__3ss4_2;
    167     int __m1__A0i_2[((unsigned int )10)];
    168     int __m2__A0A0i_2[((unsigned int )10)][((unsigned int )10)];
    169     int __m3__A0A0i_2[((unsigned int )10)][((unsigned int )10)];
    170     ((void)(___retval_main__i_1=((int )0)) /* ?{} */);
    171     return ((int )___retval_main__i_1);
     167    signed int __m1__A0i_2[((unsigned int )10)];
     168    signed int __m2__A0A0i_2[((unsigned int )10)][((unsigned int )10)];
     169    signed int __m3__A0A0i_2[((unsigned int )10)][((unsigned int )10)];
     170    ((void)(___retval_main__i_1=((signed int )0)) /* ?{} */);
     171    return ((signed int )___retval_main__i_1);
    172172    ((void)(___retval_main__i_1=0) /* ?{} */);
    173     return ((int )___retval_main__i_1);
     173    return ((signed int )___retval_main__i_1);
    174174}
    175175static inline int invoke_main(int argc, char* argv[], char* envp[]) { (void)argc; (void)argv; (void)envp; return __main__Fi_iPPCc__1(argc, argv); }
     
    177177__attribute__ ((__nothrow__,__leaf__)) extern void free(void *__ptr);
    178178__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void abort(void);
    179 __attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern int atexit(void (*__func)(void));
    180 __attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(int __status);
    181 extern int printf(const char *__restrict __format, ...);
    182 static inline int invoke_main(int argc, char **argv, char **envp);
    183 int main(int __argc__i_1, char **__argv__PPc_1, char **__envp__PPc_1){
    184     __attribute__ ((unused)) int ___retval_main__i_1;
    185     int _tmp_cp_ret0;
     179__attribute__ ((__nothrow__,__leaf__,__nonnull__(1))) extern signed int atexit(void (*__func)(void));
     180__attribute__ ((__nothrow__,__leaf__,__noreturn__)) extern void exit(signed int __status);
     181extern signed int printf(const char *__restrict __format, ...);
     182static inline signed int invoke_main(signed int argc, char **argv, char **envp);
     183signed int main(signed int __argc__i_1, char **__argv__PPc_1, char **__envp__PPc_1){
     184    __attribute__ ((unused)) signed int ___retval_main__i_1;
     185    signed int _tmp_cp_ret0;
    186186    ((void)(___retval_main__i_1=(((void)(_tmp_cp_ret0=invoke_main(__argc__i_1, __argv__PPc_1, __envp__PPc_1))) , _tmp_cp_ret0)) /* ?{} */);
    187187    ((void)(_tmp_cp_ret0) /* ^?{} */);
    188     return ((int )___retval_main__i_1);
     188    return ((signed int )___retval_main__i_1);
    189189}
Note: See TracChangeset for help on using the changeset viewer.