Changeset c331406


Ignore:
Timestamp:
Aug 5, 2016, 11:03:04 AM (9 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
a2f920f
Parents:
5070fe4 (diff), 1b0020a (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 changes from master

Files:
2 added
2 deleted
60 edited

Legend:

Unmodified
Added
Removed
  • doc/aaron_comp_II/comp_II.tex

    r5070fe4 rc331406  
    156156
    157157forall(otype M | has_magnitude(M))
    158 int sgn( M m ) {
     158M abs( M m ) {
    159159    M zero = 0;  // uses zero_t constructor from trait
    160     if ( m < zero ) return -1;
    161     if ( zero < m ) return 1;
    162     return 0;
    163 }
    164 
    165 // TODO write another function
    166 \end{lstlisting}
     160    return m < zero ? -m : m;
     161}
     162
     163forall(otype M | has_magnitude(M))
     164M max_magnitude( M a, M b ) {
     165    M aa = abs(a), ab = abs(b);
     166    return aa < ab ? b : a;
     167}
     168\end{lstlisting}
     169
     170Semantically, a trait is merely a named list of type assertions, but they can be used in many of the same situations where an interface in Java or an abstract base class in \CC would be used.
     171Unlike Java interfaces or \CC base classes, \CFA types do not explicitly state any inheritance relationship to traits they satisfy; this can be considered a form of structural inheritance, similar to interface implementation in Go, as opposed to the nominal inheritance model of Java and \CC.
     172% TODO talk about modelling of nominal inheritance with structural inheritance, possibility of investigating some resolver algorithms that require nominal
    167173
    168174\subsection{Name Overloading}
  • src/CodeGen/CodeGenerator.cc

    r5070fe4 rc331406  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By :
    12 // Last Modified On : Sun Jul 31 08:42:18 2016
    13 // Update Count     : 345
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Thu Aug  4 13:35:30 2016
     13// Update Count     : 352
    1414//
    1515
     
    4848        }
    4949
    50         void CodeGenerator::extension( Expression *expr ) {
     50        void CodeGenerator::extension( Expression * expr ) {
    5151                if ( expr->get_extension() ) {
    5252                        output << "__extension__ ";
     
    5454        } // extension
    5555
    56         void CodeGenerator::extension( Declaration *decl ) {
     56        void CodeGenerator::extension( Declaration * decl ) {
    5757                if ( decl->get_extension() ) {
    5858                        output << "__extension__ ";
     
    7373        }
    7474
    75         ostream & operator<<( ostream & output, CodeGenerator::LabelPrinter &printLabels ) {
     75        ostream & operator<<( ostream & output, CodeGenerator::LabelPrinter & printLabels ) {
    7676                std::list< Label > & labs = *printLabels.labels;
    7777                // l.unique(); // assumes a sorted list. Why not use set? Does order matter?
     
    7979                        output << l.get_name() + ": ";
    8080                        printLabels.cg.genAttributes( l.get_attributes() );
    81                 }
     81                } // for
    8282                return output;
    8383        }
    8484
    85         CodeGenerator::CodeGenerator( std::ostream &os ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ) {}
    86 
    87         CodeGenerator::CodeGenerator( std::ostream &os, std::string init, int indentation, bool infunp )
     85        CodeGenerator::CodeGenerator( std::ostream & os ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ) {}
     86
     87        CodeGenerator::CodeGenerator( std::ostream & os, std::string init, int indentation, bool infunp )
    8888                        : indent( *this), cur_indent( indentation ), insideFunction( infunp ), output( os ), printLabels( *this ) {
    8989                //output << std::string( init );
    9090        }
    9191
    92         CodeGenerator::CodeGenerator( std::ostream &os, char *init, int indentation, bool infunp )
     92        CodeGenerator::CodeGenerator( std::ostream & os, char * init, int indentation, bool infunp )
    9393                        : indent( *this ), cur_indent( indentation ), insideFunction( infunp ), output( os ), printLabels( *this ) {
    9494                //output << std::string( init );
    9595        }
    9696
    97         string mangleName( DeclarationWithType *decl ) {
     97        string mangleName( DeclarationWithType * decl ) {
    9898                if ( decl->get_mangleName() != "" ) {
    9999                        // need to incorporate scope level in order to differentiate names for destructors
     
    112112                                        genCommaList( attr->get_parameters().begin(), attr->get_parameters().end() );
    113113                                        output << ")";
    114                                 }
     114                                } // if
    115115                                output << ",";
    116                         }
     116                        } // for
    117117                        output << ")) ";
    118                 }
     118                } // if
    119119        }
    120120
    121121
    122122        //*** Declarations
    123         void CodeGenerator::visit( FunctionDecl *functionDecl ) {
     123        void CodeGenerator::visit( FunctionDecl * functionDecl ) {
    124124                extension( functionDecl );
    125125                genAttributes( functionDecl->get_attributes() );
     
    146146        }
    147147
    148         void CodeGenerator::visit( ObjectDecl *objectDecl ) {
     148        void CodeGenerator::visit( ObjectDecl * objectDecl ) {
    149149                extension( objectDecl );
     150                genAttributes( objectDecl->get_attributes() );
     151
    150152                handleStorageClass( objectDecl );
    151153                output << genType( objectDecl->get_type(), mangleName( objectDecl ) );
     
    162164        }
    163165
    164         void CodeGenerator::handleAggregate( AggregateDecl *aggDecl ) {
     166        void CodeGenerator::handleAggregate( AggregateDecl * aggDecl ) {
    165167                if ( aggDecl->get_name() != "" )
    166168                        output << aggDecl->get_name();
    167169
    168                 std::list< Declaration * > &memb = aggDecl->get_members();
     170                std::list< Declaration * > & memb = aggDecl->get_members();
    169171                if ( ! memb.empty() ) {
    170172//              if ( aggDecl->has_body() ) {
    171 //                      std::list< Declaration * > &memb = aggDecl->get_members();
     173//                      std::list< Declaration * > & memb = aggDecl->get_members();
    172174                        output << " {" << endl;
    173175
     
    185187        }
    186188
    187         void CodeGenerator::visit( StructDecl *structDecl ) {
     189        void CodeGenerator::visit( StructDecl * structDecl ) {
    188190                extension( structDecl );
    189191                output << "struct ";
     
    191193        }
    192194
    193         void CodeGenerator::visit( UnionDecl *unionDecl ) {
     195        void CodeGenerator::visit( UnionDecl * unionDecl ) {
    194196                extension( unionDecl );
    195197                output << "union ";
     
    197199        }
    198200
    199         void CodeGenerator::visit( EnumDecl *enumDecl ) {
     201        void CodeGenerator::visit( EnumDecl * enumDecl ) {
    200202                extension( enumDecl );
    201203                output << "enum ";
     
    211213                        cur_indent += CodeGenerator::tabsize;
    212214                        for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end();  i++) {
    213                                 ObjectDecl *obj = dynamic_cast< ObjectDecl* >( *i );
     215                                ObjectDecl * obj = dynamic_cast< ObjectDecl* >( *i );
    214216                                assert( obj );
    215217                                output << indent << mangleName( obj );
     
    227229        }
    228230
    229         void CodeGenerator::visit( TraitDecl *traitDecl ) {}
    230 
    231         void CodeGenerator::visit( TypedefDecl *typeDecl ) {
     231        void CodeGenerator::visit( TraitDecl * traitDecl ) {}
     232
     233        void CodeGenerator::visit( TypedefDecl * typeDecl ) {
    232234                assert( false && "Typedefs are removed and substituted in earlier passes." );
    233235                //output << "typedef ";
     
    235237        }
    236238
    237         void CodeGenerator::visit( TypeDecl *typeDecl ) {
     239        void CodeGenerator::visit( TypeDecl * typeDecl ) {
    238240                // really, we should mutate this into something that isn't a TypeDecl but that requires large-scale changes,
    239241                // still to be done
     
    263265        }
    264266
    265         void CodeGenerator::visit( SingleInit *init ) {
     267        void CodeGenerator::visit( SingleInit * init ) {
    266268                printDesignators( init->get_designators() );
    267269                init->get_value()->accept( *this );
    268270        }
    269271
    270         void CodeGenerator::visit( ListInit *init ) {
     272        void CodeGenerator::visit( ListInit * init ) {
    271273                printDesignators( init->get_designators() );
    272274                output << "{ ";
    273                 if ( init->begin_initializers() == init->end_initializers() ) {
     275                if ( init->begin() == init->end() ) {
    274276                        // illegal to leave initializer list empty for scalar initializers, but always legal to have 0
    275277                        output << "0";
    276278                } else {
    277                         genCommaList( init->begin_initializers(), init->end_initializers() );
    278                 }
     279                        genCommaList( init->begin(), init->end() );
     280                } // if
    279281                output << " }";
    280282        }
    281283
    282         void CodeGenerator::visit( Constant *constant ) {
     284        void CodeGenerator::visit( Constant * constant ) {
    283285                output << constant->get_value() ;
    284286        }
    285287
    286288        //*** Expressions
    287         void CodeGenerator::visit( ApplicationExpr *applicationExpr ) {
     289        void CodeGenerator::visit( ApplicationExpr * applicationExpr ) {
    288290                extension( applicationExpr );
    289                 if ( VariableExpr *varExpr = dynamic_cast< VariableExpr* >( applicationExpr->get_function() ) ) {
     291                if ( VariableExpr * varExpr = dynamic_cast< VariableExpr* >( applicationExpr->get_function() ) ) {
    290292                        OperatorInfo opInfo;
    291293                        if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic && operatorLookup( varExpr->get_var()->get_name(), opInfo ) ) {
     
    299301                                        {
    300302                                                assert( arg != applicationExpr->get_args().end() );
    301                                                 if ( AddressExpr *addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) {
     303                                                if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) {
    302304                                                        // remove & from first assignment/ctor argument
    303305                                                        *arg = addrExpr->get_arg();
    304306                                                } else {
    305307                                                        // no address-of operator, so must be a pointer - add dereference
    306                                                         UntypedExpr *newExpr = new UntypedExpr( new NameExpr( "*?" ) );
     308                                                        UntypedExpr * newExpr = new UntypedExpr( new NameExpr( "*?" ) );
    307309                                                        newExpr->get_args().push_back( *arg );
    308310                                                        assert( (*arg)->get_results().size() == 1 );
     
    352354                                                // no constructors with 0 or more than 2 parameters
    353355                                                assert( false );
    354                                         }
     356                                        } // if
    355357                                        break;
    356358
     
    401403        }
    402404
    403         void CodeGenerator::visit( UntypedExpr *untypedExpr ) {
     405        void CodeGenerator::visit( UntypedExpr * untypedExpr ) {
    404406                extension( untypedExpr );
    405                 if ( NameExpr *nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) {
     407                if ( NameExpr * nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) {
    406408                        OperatorInfo opInfo;
    407409                        if ( operatorLookup( nameExpr->get_name(), opInfo ) ) {
     
    472474                                } // switch
    473475                        } else {
    474                                 if ( nameExpr->get_name() == "Range" ) { // case V1 ... V2 or case V1~V2
     476                                if ( nameExpr->get_name() == "..." ) { // case V1 ... V2 or case V1~V2
    475477                                        assert( untypedExpr->get_args().size() == 2 );
    476478                                        (*untypedExpr->get_args().begin())->accept( *this );
     
    492494        }
    493495
    494         void CodeGenerator::visit( NameExpr *nameExpr ) {
     496        void CodeGenerator::visit( RangeExpr * rangeExpr ) {
     497                rangeExpr->get_low()->accept( *this );
     498                output << " ... ";
     499                rangeExpr->get_high()->accept( *this );
     500        }
     501
     502        void CodeGenerator::visit( NameExpr * nameExpr ) {
    495503                extension( nameExpr );
    496504                OperatorInfo opInfo;
     
    503511        }
    504512
    505         void CodeGenerator::visit( AddressExpr *addressExpr ) {
     513        void CodeGenerator::visit( AddressExpr * addressExpr ) {
    506514                extension( addressExpr );
    507515                output << "(&";
    508516                // this hack makes sure that we don't convert "constant_zero" to "0" if we're taking its address
    509                 if ( VariableExpr *variableExpr = dynamic_cast< VariableExpr* >( addressExpr->get_arg() ) ) {
     517                if ( VariableExpr * variableExpr = dynamic_cast< VariableExpr* >( addressExpr->get_arg() ) ) {
    510518                        output << mangleName( variableExpr->get_var() );
    511519                } else {
     
    515523        }
    516524
    517         void CodeGenerator::visit( CastExpr *castExpr ) {
     525        void CodeGenerator::visit( CastExpr * castExpr ) {
    518526                extension( castExpr );
    519527                output << "(";
     
    533541        }
    534542
    535         void CodeGenerator::visit( UntypedMemberExpr *memberExpr ) {
     543        void CodeGenerator::visit( UntypedMemberExpr * memberExpr ) {
    536544                assert( false );
    537545        }
    538546
    539         void CodeGenerator::visit( MemberExpr *memberExpr ) {
     547        void CodeGenerator::visit( MemberExpr * memberExpr ) {
    540548                extension( memberExpr );
    541549                memberExpr->get_aggregate()->accept( *this );
     
    543551        }
    544552
    545         void CodeGenerator::visit( VariableExpr *variableExpr ) {
     553        void CodeGenerator::visit( VariableExpr * variableExpr ) {
    546554                extension( variableExpr );
    547555                OperatorInfo opInfo;
     
    553561        }
    554562
    555         void CodeGenerator::visit( ConstantExpr *constantExpr ) {
     563        void CodeGenerator::visit( ConstantExpr * constantExpr ) {
    556564                assert( constantExpr->get_constant() );
    557565                extension( constantExpr );
     
    559567        }
    560568
    561         void CodeGenerator::visit( SizeofExpr *sizeofExpr ) {
     569        void CodeGenerator::visit( SizeofExpr * sizeofExpr ) {
    562570                extension( sizeofExpr );
    563571                output << "sizeof(";
     
    570578        }
    571579
    572         void CodeGenerator::visit( AlignofExpr *alignofExpr ) {
     580        void CodeGenerator::visit( AlignofExpr * alignofExpr ) {
    573581                // use GCC extension to avoid bumping std to C11
    574582                extension( alignofExpr );
     
    582590        }
    583591
    584         void CodeGenerator::visit( UntypedOffsetofExpr *offsetofExpr ) {
     592        void CodeGenerator::visit( UntypedOffsetofExpr * offsetofExpr ) {
    585593                assert( false && "UntypedOffsetofExpr should not reach code generation." );
    586594        }
    587595
    588         void CodeGenerator::visit( OffsetofExpr *offsetofExpr ) {
     596        void CodeGenerator::visit( OffsetofExpr * offsetofExpr ) {
    589597                // use GCC builtin
    590598                output << "__builtin_offsetof(";
     
    594602        }
    595603
    596         void CodeGenerator::visit( OffsetPackExpr *offsetPackExpr ) {
     604        void CodeGenerator::visit( OffsetPackExpr * offsetPackExpr ) {
    597605                assert( false && "OffsetPackExpr should not reach code generation." );
    598606        }
    599607
    600         void CodeGenerator::visit( LogicalExpr *logicalExpr ) {
     608        void CodeGenerator::visit( LogicalExpr * logicalExpr ) {
    601609                extension( logicalExpr );
    602610                output << "(";
     
    611619        }
    612620
    613         void CodeGenerator::visit( ConditionalExpr *conditionalExpr ) {
     621        void CodeGenerator::visit( ConditionalExpr * conditionalExpr ) {
    614622                extension( conditionalExpr );
    615623                output << "(";
     
    622630        }
    623631
    624         void CodeGenerator::visit( CommaExpr *commaExpr ) {
     632        void CodeGenerator::visit( CommaExpr * commaExpr ) {
    625633                extension( commaExpr );
    626634                output << "(";
     
    631639        }
    632640
    633         void CodeGenerator::visit( TupleExpr *tupleExpr ) {}
    634 
    635         void CodeGenerator::visit( TypeExpr *typeExpr ) {}
    636 
    637         void CodeGenerator::visit( AsmExpr *asmExpr ) {
     641        void CodeGenerator::visit( TupleExpr * tupleExpr ) {}
     642
     643        void CodeGenerator::visit( TypeExpr * typeExpr ) {}
     644
     645        void CodeGenerator::visit( AsmExpr * asmExpr ) {
    638646                if ( asmExpr->get_inout() ) {
    639647                        output << "[ ";
     
    648656
    649657        //*** Statements
    650         void CodeGenerator::visit( CompoundStmt *compoundStmt ) {
     658        void CodeGenerator::visit( CompoundStmt * compoundStmt ) {
    651659                std::list<Statement*> ks = compoundStmt->get_kids();
    652660                output << "{" << endl;
     
    662670                                output << endl;
    663671                        } // if
    664                 }
     672                } // for
    665673                cur_indent -= CodeGenerator::tabsize;
    666674
     
    668676        }
    669677
    670         void CodeGenerator::visit( ExprStmt *exprStmt ) {
     678        void CodeGenerator::visit( ExprStmt * exprStmt ) {
    671679                assert( exprStmt );
    672680                // cast the top-level expression to void to reduce gcc warnings.
     
    676684        }
    677685
    678         void CodeGenerator::visit( AsmStmt *asmStmt ) {
     686        void CodeGenerator::visit( AsmStmt * asmStmt ) {
    679687                output << "asm ";
    680688                if ( asmStmt->get_voltile() ) output << "volatile ";
     
    699707        }
    700708
    701         void CodeGenerator::visit( IfStmt *ifStmt ) {
     709        void CodeGenerator::visit( IfStmt * ifStmt ) {
    702710                output << "if ( ";
    703711                ifStmt->get_condition()->accept( *this );
     
    712720        }
    713721
    714         void CodeGenerator::visit( SwitchStmt *switchStmt ) {
     722        void CodeGenerator::visit( SwitchStmt * switchStmt ) {
    715723                output << "switch ( " ;
    716724                switchStmt->get_condition()->accept( *this );
     
    719727                output << "{" << std::endl;
    720728                cur_indent += CodeGenerator::tabsize;
    721 
    722                 acceptAll( switchStmt->get_branches(), *this );
    723 
     729                acceptAll( switchStmt->get_statements(), *this );
    724730                cur_indent -= CodeGenerator::tabsize;
    725 
    726731                output << indent << "}";
    727732        }
    728733
    729         void CodeGenerator::visit( CaseStmt *caseStmt ) {
     734        void CodeGenerator::visit( CaseStmt * caseStmt ) {
    730735                output << indent;
    731736                if ( caseStmt->isDefault()) {
     
    748753        }
    749754
    750         void CodeGenerator::visit( BranchStmt *branchStmt ) {
     755        void CodeGenerator::visit( BranchStmt * branchStmt ) {
    751756                switch ( branchStmt->get_type()) {
    752757                  case BranchStmt::Goto:
     
    771776
    772777
    773         void CodeGenerator::visit( ReturnStmt *returnStmt ) {
     778        void CodeGenerator::visit( ReturnStmt * returnStmt ) {
    774779                output << "return ";
    775780                maybeAccept( returnStmt->get_expr(), *this );
     
    777782        }
    778783
    779         void CodeGenerator::visit( WhileStmt *whileStmt ) {
     784        void CodeGenerator::visit( WhileStmt * whileStmt ) {
    780785                if ( whileStmt->get_isDoWhile() ) {
    781786                        output << "do" ;
     
    799804        }
    800805
    801         void CodeGenerator::visit( ForStmt *forStmt ) {
     806        void CodeGenerator::visit( ForStmt * forStmt ) {
    802807                // initialization is always hoisted, so don't bother doing anything with that
    803808                output << "for (;";
     
    821826        }
    822827
    823         void CodeGenerator::visit( NullStmt *nullStmt ) {
     828        void CodeGenerator::visit( NullStmt * nullStmt ) {
    824829                //output << indent << CodeGenerator::printLabels( nullStmt->get_labels() );
    825830                output << "/* null statement */ ;";
    826831        }
    827832
    828         void CodeGenerator::visit( DeclStmt *declStmt ) {
     833        void CodeGenerator::visit( DeclStmt * declStmt ) {
    829834                declStmt->get_decl()->accept( *this );
    830835
     
    834839        }
    835840
    836         void CodeGenerator::handleStorageClass( Declaration *decl ) {
     841        void CodeGenerator::handleStorageClass( Declaration * decl ) {
    837842                switch ( decl->get_storageClass() ) {
    838843                  case DeclarationNode::Extern:
  • src/CodeGen/CodeGenerator.h

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 30 11:10:42 2016
    13 // Update Count     : 37
     12// Last Modified On : Thu Aug  4 13:37:07 2016
     13// Update Count     : 38
    1414//
    1515
     
    5454                virtual void visit( ApplicationExpr *applicationExpr );
    5555                virtual void visit( UntypedExpr *untypedExpr );
     56                virtual void visit( RangeExpr * rangeExpr );
    5657                virtual void visit( NameExpr *nameExpr );
    5758                virtual void visit( AddressExpr *addressExpr );
  • src/ControlStruct/MLEMutator.cc

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:36:51 2016
    13 // Update Count     : 197
     12// Last Modified On : Thu Aug  4 11:21:32 2016
     13// Update Count     : 202
    1414//
    1515
     
    128128                Label brkLabel = generator->newLabel("switchBreak");
    129129                enclosingControlStructures.push_back( Entry(switchStmt, brkLabel) );
    130                 mutateAll( switchStmt->get_branches(), *this );
     130                mutateAll( switchStmt->get_statements(), *this );
    131131
    132132                Entry &e = enclosingControlStructures.back();
     
    138138                        // switch should be CastStmts), append the exit label + break to the last case statement; create a default
    139139                        // case if there are no cases
    140                         std::list< Statement * > &branches = switchStmt->get_branches();
    141                         if ( branches.empty() ) {
    142                                 branches.push_back( CaseStmt::makeDefault() );
    143                         } // if
    144 
    145                         if ( CaseStmt * c = dynamic_cast< CaseStmt * >( branches.back() ) ) {
     140                        std::list< Statement * > &statements = switchStmt->get_statements();
     141                        if ( statements.empty() ) {
     142                                statements.push_back( CaseStmt::makeDefault() );
     143                        } // if
     144
     145                        if ( CaseStmt * c = dynamic_cast< CaseStmt * >( statements.back() ) ) {
    146146                                std::list<Label> temp; temp.push_back( brkLabel );
    147147                                c->get_statements().push_back( new BranchStmt( temp, Label("brkLabel"), BranchStmt::Break ) );
    148                         } else assert(0); // as of this point, all branches of a switch are still CaseStmts
     148                        } else assert(0); // as of this point, all statements of a switch are still CaseStmts
    149149                } // if
    150150
  • src/ControlStruct/Mutate.cc

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:37:45 2016
    13 // Update Count     : 8
     12// Last Modified On : Thu Aug  4 11:39:08 2016
     13// Update Count     : 9
    1414//
    1515
     
    2222#include "LabelFixer.h"
    2323#include "MLEMutator.h"
    24 #include "CaseRangeMutator.h"
    2524#include "ForExprMutator.h"
    2625#include "LabelTypeChecker.h"
     
    4140                LabelFixer lfix;
    4241
    43                 // expand case ranges and turn fallthru into a null statement
    44                 CaseRangeMutator ranges;
    45 
    4642                //ExceptMutator exc;
    4743                // LabelTypeChecker lbl;
     
    4945                mutateAll( translationUnit, formut );
    5046                acceptAll( translationUnit, lfix );
    51                 mutateAll( translationUnit, ranges );
    5247                //mutateAll( translationUnit, exc );
    5348                //acceptAll( translationUnit, lbl );
  • src/ControlStruct/module.mk

    r5070fe4 rc331406  
    1111## Created On       : Mon Jun  1 17:49:17 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Tue Jul 12 17:40:31 2016
    14 ## Update Count     : 2
     13## Last Modified On : Thu Aug  4 11:38:06 2016
     14## Update Count     : 3
    1515###############################################################################
    1616
     
    1818        ControlStruct/LabelFixer.cc \
    1919        ControlStruct/MLEMutator.cc \
    20         ControlStruct/CaseRangeMutator.cc \
    2120        ControlStruct/Mutate.cc \
    2221        ControlStruct/ForExprMutator.cc \
  • src/GenPoly/DeclMutator.cc

    r5070fe4 rc331406  
    1010// Created On       : Fri Nov 27 14:44:00 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:38:46 2016
    13 // Update Count     : 2
     12// Last Modified On : Thu Aug  4 11:16:43 2016
     13// Update Count     : 3
    1414//
    1515
     
    163163        Statement* DeclMutator::mutate(SwitchStmt *switchStmt) {
    164164                switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) );
    165                 mutateAll( switchStmt->get_branches(), *this );
     165                mutateAll( switchStmt->get_statements(), *this );
    166166                return switchStmt;
    167167        }
  • src/GenPoly/DeclMutator.h

    r5070fe4 rc331406  
    2828        class DeclMutator : public Mutator {
    2929        public:
     30                typedef Mutator Parent;
     31
    3032                DeclMutator();
    3133                virtual ~DeclMutator();
    32                
     34
     35                using Parent::mutate;
    3336                virtual CompoundStmt* mutate(CompoundStmt *compoundStmt);
    3437                virtual Statement* mutate(IfStmt *ifStmt);
     
    4245                /// Mutates a list of declarations with this visitor
    4346                void mutateDeclarationList(std::list< Declaration* >& decls);
    44                
     47
    4548                /// Called on entry to a new scope; overriders should call this as a super-class call
    4649                virtual void doBeginScope();
  • src/GenPoly/PolyMutator.cc

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:39:32 2016
    13 // Update Count     : 12
     12// Last Modified On : Thu Aug  4 11:26:22 2016
     13// Update Count     : 16
    1414//
    1515
     
    9999
    100100        Statement * PolyMutator::mutate(SwitchStmt *switchStmt) {
    101                 mutateStatementList( switchStmt->get_branches() );
     101                mutateStatementList( switchStmt->get_statements() );
    102102                switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) );
    103103                return switchStmt;
  • src/GenPoly/Specialize.cc

    r5070fe4 rc331406  
    3131#include "Common/UniqueName.h"
    3232#include "Common/utility.h"
     33#include "InitTweak/InitTweak.h"
    3334
    3435namespace GenPoly {
     
    184185                mutateAll( appExpr->get_args(), *this );
    185186
    186                 // create thunks for the inferred parameters
    187                 for ( InferredParams::iterator inferParam = appExpr->get_inferParams().begin(); inferParam != appExpr->get_inferParams().end(); ++inferParam ) {
    188                         inferParam->second.expr = doSpecialization( inferParam->second.formalType, inferParam->second.expr, &appExpr->get_inferParams() );
    189                 }
    190 
    191                 handleExplicitParams( appExpr );
     187                if ( ! InitTweak::isIntrinsicCallExpr( appExpr ) ) {
     188                        // create thunks for the inferred parameters
     189                        // don't need to do this for intrinsic calls, because they aren't actually passed
     190                        for ( InferredParams::iterator inferParam = appExpr->get_inferParams().begin(); inferParam != appExpr->get_inferParams().end(); ++inferParam ) {
     191                                inferParam->second.expr = doSpecialization( inferParam->second.formalType, inferParam->second.expr, &appExpr->get_inferParams() );
     192                        }
     193
     194                        handleExplicitParams( appExpr );
     195                }
    192196
    193197                return appExpr;
  • src/InitTweak/FixGlobalInit.cc

    r5070fe4 rc331406  
    4646                FunctionDecl * destroyFunction;
    4747        };
    48 
    49         class ConstExprChecker : public Visitor {
    50         public:
    51                 ConstExprChecker() : isConstExpr( true ) {}
    52 
    53                 virtual void visit( ApplicationExpr *applicationExpr ) { isConstExpr = false; }
    54                 virtual void visit( UntypedExpr *untypedExpr ) { isConstExpr = false; }
    55                 virtual void visit( NameExpr *nameExpr ) { isConstExpr = false; }
    56                 virtual void visit( CastExpr *castExpr ) { isConstExpr = false; }
    57                 virtual void visit( LabelAddressExpr *labAddressExpr ) { isConstExpr = false; }
    58                 virtual void visit( UntypedMemberExpr *memberExpr ) { isConstExpr = false; }
    59                 virtual void visit( MemberExpr *memberExpr ) { isConstExpr = false; }
    60                 virtual void visit( VariableExpr *variableExpr ) { isConstExpr = false; }
    61                 virtual void visit( ConstantExpr *constantExpr ) { /* bottom out */ }
    62                 // these might be okay?
    63                 // virtual void visit( SizeofExpr *sizeofExpr );
    64                 // virtual void visit( AlignofExpr *alignofExpr );
    65                 // virtual void visit( UntypedOffsetofExpr *offsetofExpr );
    66                 // virtual void visit( OffsetofExpr *offsetofExpr );
    67                 // virtual void visit( OffsetPackExpr *offsetPackExpr );
    68                 // virtual void visit( AttrExpr *attrExpr );
    69                 // virtual void visit( CommaExpr *commaExpr );
    70                 // virtual void visit( LogicalExpr *logicalExpr );
    71                 // virtual void visit( ConditionalExpr *conditionalExpr );
    72                 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }
    73                 virtual void visit( SolvedTupleExpr *tupleExpr ) { isConstExpr = false; }
    74                 virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; }
    75                 virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; }
    76                 virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; }
    77                 virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; }
    78 
    79                 bool isConstExpr;
    80         };
    81 
    82         bool isConstExpr( Initializer * init ) {
    83                 if ( init ) {
    84                         ConstExprChecker checker;
    85                         init->accept( checker );
    86                         return checker.isConstExpr;
    87                 } // if
    88                 // for all intents and purposes, no initializer means const expr
    89                 return true;
    90         }
    9148
    9249        void fixGlobalInit( std::list< Declaration * > & translationUnit, const std::string & name, bool inLibrary ) {
     
    14097                std::list< Statement * > & destroyStatements = destroyFunction->get_statements()->get_kids();
    14198
    142                 if ( ! tryConstruct( objDecl ) ) return; // don't construct @= or designated objects
    143                 if ( objDecl->get_storageClass() == DeclarationNode::Extern ) return;
    14499                // C allows you to initialize objects with constant expressions
    145100                // xxx - this is an optimization. Need to first resolve constructors before we decide
     
    147102                // if ( isConstExpr( objDecl->get_init() ) ) return;
    148103
    149                 if ( dynamic_cast< ArrayType * > ( objDecl->get_type() ) ) {
    150                         // xxx - initialize each element of the array
    151                 } else {
    152                         // steal initializer from object and attach it to a new temporary
    153                         ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, objDecl->get_type()->clone(), objDecl->get_init() );
    154                         objDecl->set_init( NULL );
    155                         initStatements.push_back( new DeclStmt( noLabels, newObj ) );
     104                if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) {
     105                        // a decision should have been made by the resolver, so ctor and init are not both non-NULL
     106                        assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() );
    156107
    157                         // copy construct objDecl using temporary
    158                         UntypedExpr * init = new UntypedExpr( new NameExpr( "?{}" ) );
    159                         init->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) );
    160                         init->get_args().push_back( new VariableExpr( newObj ) );
    161                         initStatements.push_back( new ImplicitCtorDtorStmt( new ExprStmt( noLabels, init ) ) );
    162 
    163                         // add destructor calls to global destroy function
    164                         UntypedExpr * destroy = new UntypedExpr( new NameExpr( "^?{}" ) );
    165                         destroy->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) );
    166                         destroyStatements.push_front( new ImplicitCtorDtorStmt( new ExprStmt( noLabels, destroy ) ) );
     108                        Statement * dtor = ctorInit->get_dtor();
     109                        if ( dtor && ! isIntrinsicSingleArgCallStmt( dtor ) ) {
     110                                // don't need to call intrinsic dtor, because it does nothing, but
     111                                // non-intrinsic dtors must be called
     112                                destroyStatements.push_front( dtor );
     113                                ctorInit->set_dtor( NULL );
     114                        } // if
     115                        if ( Statement * ctor = ctorInit->get_ctor() ) {
     116                                initStatements.push_back( ctor );
     117                                objDecl->set_init( NULL );
     118                                ctorInit->set_ctor( NULL );
     119                        } else if ( Initializer * init = ctorInit->get_init() ) {
     120                                objDecl->set_init( init );
     121                                ctorInit->set_init( NULL );
     122                        } else {
     123                                // no constructor and no initializer, which is okay
     124                                objDecl->set_init( NULL );
     125                        } // if
     126                        delete ctorInit;
    167127                } // if
    168128        }
  • src/InitTweak/FixInit.cc

    r5070fe4 rc331406  
    1818#include <iterator>
    1919#include <algorithm>
     20#include "InitTweak.h"
    2021#include "FixInit.h"
    21 #include "InitTweak.h"
     22#include "FixGlobalInit.h"
    2223#include "ResolvExpr/Resolver.h"
    2324#include "ResolvExpr/typeops.h"
     
    2526#include "SynTree/Type.h"
    2627#include "SynTree/Expression.h"
     28#include "SynTree/Attribute.h"
    2729#include "SynTree/Statement.h"
    2830#include "SynTree/Initializer.h"
     
    8385                };
    8486
     87                // debug
    8588                struct printSet {
    8689                        typedef ObjDeclCollector::ObjectSet ObjectSet;
     
    159162
    160163                        virtual DeclarationWithType * mutate( ObjectDecl *objDecl );
     164
     165                        std::list< Declaration * > staticDtorDecls;
    161166                };
    162167
     
    171176        } // namespace
    172177
    173         void fix( std::list< Declaration * > & translationUnit ) {
     178        void fix( std::list< Declaration * > & translationUnit, const std::string & filename, bool inLibrary ) {
     179                // fixes ConstructorInit for global variables. should happen before fixInitializers.
     180                InitTweak::fixGlobalInit( translationUnit, filename, inLibrary );
     181
    174182                InsertImplicitCalls::insert( translationUnit );
    175183                ResolveCopyCtors::resolveImplicitCalls( translationUnit );
     
    194202                void FixInit::fixInitializers( std::list< Declaration * > & translationUnit ) {
    195203                        FixInit fixer;
    196                         mutateAll( translationUnit, fixer );
     204
     205                        // can't use mutateAll, because need to insert declarations at top-level
     206                        // can't use DeclMutator, because sometimes need to insert IfStmt, etc.
     207                        SemanticError errors;
     208                        for ( std::list< Declaration * >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) {
     209                                try {
     210                                        *i = maybeMutate( *i, fixer );
     211                                        translationUnit.splice( i, fixer.staticDtorDecls );
     212                                } catch( SemanticError &e ) {
     213                                        errors.append( e );
     214                                } // try
     215                        } // for
     216                        if ( ! errors.isEmpty() ) {
     217                                throw errors;
     218                        } // if
    197219                }
    198220
     
    422444                                if ( Statement * ctor = ctorInit->get_ctor() ) {
    423445                                        if ( objDecl->get_storageClass() == DeclarationNode::Static ) {
     446                                                // originally wanted to take advantage of gcc nested functions, but
     447                                                // we get memory errors with this approach. To remedy this, the static
     448                                                // variable is hoisted when the destructor needs to be called.
     449                                                //
    424450                                                // generate:
    425                                                 // static bool __objName_uninitialized = true;
    426                                                 // if (__objName_uninitialized) {
    427                                                 //   __ctor(__objName);
    428                                                 //   void dtor_atexit() {
    429                                                 //     __dtor(__objName);
     451                                                // static T __objName_static_varN;
     452                                                // void __objName_dtor_atexitN() {
     453                                                //   __dtor__...;
     454                                                // }
     455                                                // int f(...) {
     456                                                //   ...
     457                                                //   static bool __objName_uninitialized = true;
     458                                                //   if (__objName_uninitialized) {
     459                                                //     __ctor(__objName);
     460                                                //     __objName_uninitialized = false;
     461                                                //     atexit(__objName_dtor_atexitN);
    430462                                                //   }
    431                                                 //   on_exit(dtorOnExit, &__objName);
    432                                                 //   __objName_uninitialized = false;
     463                                                //   ...
    433464                                                // }
    434465
    435                                                 // generate first line
     466                                                static UniqueName dtorCallerNamer( "_dtor_atexit" );
     467
     468                                                // static bool __objName_uninitialized = true
    436469                                                BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool );
    437470                                                SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant( boolType->clone(), "1" ) ), noDesignators );
     
    439472                                                isUninitializedVar->fixUniqueId();
    440473
    441                                                 // void dtor_atexit(...) {...}
    442                                                 FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + "_dtor_atexit", DeclarationNode::NoStorageClass, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ), false, false );
    443                                                 dtorCaller->fixUniqueId();
    444                                                 dtorCaller->get_statements()->get_kids().push_back( ctorInit->get_dtor()->clone() );
    445 
    446                                                 // on_exit(dtor_atexit);
    447                                                 UntypedExpr * callAtexit = new UntypedExpr( new NameExpr( "atexit" ) );
    448                                                 callAtexit->get_args().push_back( new VariableExpr( dtorCaller ) );
    449 
    450474                                                // __objName_uninitialized = false;
    451475                                                UntypedExpr * setTrue = new UntypedExpr( new NameExpr( "?=?" ) );
     
    457481                                                std::list< Statement * > & body = initStmts->get_kids();
    458482                                                body.push_back( ctor );
    459                                                 body.push_back( new DeclStmt( noLabels, dtorCaller ) );
    460                                                 body.push_back( new ExprStmt( noLabels, callAtexit ) );
    461483                                                body.push_back( new ExprStmt( noLabels, setTrue ) );
    462484
     
    465487                                                stmtsToAddAfter.push_back( new DeclStmt( noLabels, isUninitializedVar ) );
    466488                                                stmtsToAddAfter.push_back( ifStmt );
     489
     490                                                if ( ctorInit->get_dtor() ) {
     491                                                        // if the object has a non-trivial destructor, have to
     492                                                        // hoist it and the object into the global space and
     493                                                        // call the destructor function with atexit.
     494
     495                                                        Statement * dtorStmt = ctorInit->get_dtor()->clone();
     496
     497                                                        // void __objName_dtor_atexitN(...) {...}
     498                                                        FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), DeclarationNode::Static, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ), false, false );
     499                                                        dtorCaller->fixUniqueId();
     500                                                        dtorCaller->get_statements()->get_kids().push_back( dtorStmt );
     501
     502                                                        // atexit(dtor_atexit);
     503                                                        UntypedExpr * callAtexit = new UntypedExpr( new NameExpr( "atexit" ) );
     504                                                        callAtexit->get_args().push_back( new VariableExpr( dtorCaller ) );
     505
     506                                                        body.push_back( new ExprStmt( noLabels, callAtexit ) );
     507
     508                                                        // hoist variable and dtor caller decls to list of decls that will be added into global scope
     509                                                        staticDtorDecls.push_back( objDecl );
     510                                                        staticDtorDecls.push_back( dtorCaller );
     511
     512                                                        // need to rename object uniquely since it now appears
     513                                                        // at global scope and there could be multiple function-scoped
     514                                                        // static variables with the same name in different functions.
     515                                                        static UniqueName staticNamer( "_static_var" );
     516                                                        objDecl->set_mangleName( objDecl->get_mangleName() + staticNamer.newName() );
     517
     518                                                        objDecl->set_init( NULL );
     519                                                        ctorInit->set_ctor( NULL );
     520                                                        delete ctorInit;
     521
     522                                                        // xxx - temporary hack: need to return a declaration, but want to hoist the current object out of this scope
     523                                                        // create a new object which is never used
     524                                                        static UniqueName dummyNamer( "_dummy" );
     525                                                        ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), DeclarationNode::Static, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } );
     526                                                        return dummy;
     527                                                }
    467528                                        } else {
    468529                                                stmtsToAddAfter.push_back( ctor );
     
    524585                                        assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() );
    525586                                        Statement * dtor = ctorInit->get_dtor();
    526                                         if ( dtor && ! isInstrinsicSingleArgCallStmt( dtor ) ) {
     587                                        if ( dtor && ! isIntrinsicSingleArgCallStmt( dtor ) ) {
    527588                                                // don't need to call intrinsic dtor, because it does nothing, but
    528589                                                // non-intrinsic dtors must be called
  • src/InitTweak/FixInit.h

    r5070fe4 rc331406  
    2727  /// replace constructor initializers with expression statements
    2828  /// and unwrap basic C-style initializers
    29         void fix( std::list< Declaration * > & translationUnit );
     29        void fix( std::list< Declaration * > & translationUnit, const std::string & name, bool inLibrary );
    3030} // namespace
    3131
  • src/InitTweak/GenInit.cc

    r5070fe4 rc331406  
    2626#include "SymTab/Autogen.h"
    2727#include "GenPoly/PolyMutator.h"
     28#include "GenPoly/DeclMutator.h"
    2829
    2930namespace InitTweak {
     
    5556          public:
    5657                /// create constructor and destructor statements for object declarations.
    57                 /// Destructors are inserted directly into the code, whereas constructors
    58                 /// will be added in after the resolver has run so that the initializer expression
    59                 /// is only removed if a constructor is found
     58                /// the actual call statements will be added in after the resolver has run
     59                /// so that the initializer expression is only removed if a constructor is found
     60                /// and the same destructor call is inserted in all of the appropriate locations.
    6061                static void generateCtorDtor( std::list< Declaration * > &translationUnit );
    61 
    62                 CtorDtor() : inFunction( false ) {}
    6362
    6463                virtual DeclarationWithType * mutate( ObjectDecl * );
    6564                virtual DeclarationWithType * mutate( FunctionDecl *functionDecl );
    66                 virtual Declaration* mutate( StructDecl *aggregateDecl );
    67                 virtual Declaration* mutate( UnionDecl *aggregateDecl );
    68                 virtual Declaration* mutate( EnumDecl *aggregateDecl );
    69                 virtual Declaration* mutate( TraitDecl *aggregateDecl );
    70                 virtual TypeDecl* mutate( TypeDecl *typeDecl );
    71                 virtual Declaration* mutate( TypedefDecl *typeDecl );
    72 
    73                 virtual Type * mutate( FunctionType *funcType );
     65                // should not traverse into any of these declarations to find objects
     66                // that need to be constructed or destructed
     67                virtual Declaration* mutate( StructDecl *aggregateDecl ) { return aggregateDecl; }
     68                virtual Declaration* mutate( UnionDecl *aggregateDecl ) { return aggregateDecl; }
     69                virtual Declaration* mutate( EnumDecl *aggregateDecl ) { return aggregateDecl; }
     70                virtual Declaration* mutate( TraitDecl *aggregateDecl ) { return aggregateDecl; }
     71                virtual TypeDecl* mutate( TypeDecl *typeDecl ) { return typeDecl; }
     72                virtual Declaration* mutate( TypedefDecl *typeDecl ) { return typeDecl; }
     73
     74                virtual Type * mutate( FunctionType *funcType ) { return funcType; }
    7475
    7576          protected:
    76                 bool inFunction;
     77        };
     78
     79        class HoistArrayDimension : public GenPoly::DeclMutator {
     80          public:
     81                typedef GenPoly::DeclMutator Parent;
     82
     83                /// hoist dimension from array types in object declaration so that it uses a single
     84                /// const variable of type size_t, so that side effecting array dimensions are only
     85                /// computed once.
     86                static void hoistArrayDimension( std::list< Declaration * > & translationUnit );
     87
     88          private:
     89                virtual DeclarationWithType * mutate( ObjectDecl * objectDecl );
     90                virtual DeclarationWithType * mutate( FunctionDecl *functionDecl );
     91                // should not traverse into any of these declarations to find objects
     92                // that need to be constructed or destructed
     93                virtual Declaration* mutate( StructDecl *aggregateDecl ) { return aggregateDecl; }
     94                virtual Declaration* mutate( UnionDecl *aggregateDecl ) { return aggregateDecl; }
     95                virtual Declaration* mutate( EnumDecl *aggregateDecl ) { return aggregateDecl; }
     96                virtual Declaration* mutate( TraitDecl *aggregateDecl ) { return aggregateDecl; }
     97                virtual TypeDecl* mutate( TypeDecl *typeDecl ) { return typeDecl; }
     98                virtual Declaration* mutate( TypedefDecl *typeDecl ) { return typeDecl; }
     99
     100                virtual Type* mutate( FunctionType *funcType ) { return funcType; }
     101
     102                void hoist( Type * type );
     103
     104                DeclarationNode::StorageClass storageclass = DeclarationNode::NoStorageClass;
     105                bool inFunction = false;
    77106        };
    78107
    79108        void genInit( std::list< Declaration * > & translationUnit ) {
    80109                ReturnFixer::makeReturnTemp( translationUnit );
     110                HoistArrayDimension::hoistArrayDimension( translationUnit );
    81111                CtorDtor::generateCtorDtor( translationUnit );
    82112        }
     
    124154        }
    125155
     156        // precompute array dimension expression, because constructor generation may duplicate it,
     157        // which would be incorrect if it is a side-effecting computation.
     158        void HoistArrayDimension::hoistArrayDimension( std::list< Declaration * > & translationUnit ) {
     159                HoistArrayDimension hoister;
     160                hoister.mutateDeclarationList( translationUnit );
     161        }
     162
     163        DeclarationWithType * HoistArrayDimension::mutate( ObjectDecl * objectDecl ) {
     164                storageclass = objectDecl->get_storageClass();
     165                DeclarationWithType * temp = Parent::mutate( objectDecl );
     166                hoist( objectDecl->get_type() );
     167                storageclass = DeclarationNode::NoStorageClass;
     168                return temp;
     169        }
     170
     171        void HoistArrayDimension::hoist( Type * type ) {
     172                // if in function, generate const size_t var
     173                static UniqueName dimensionName( "_array_dim" );
     174
     175                // C doesn't allow variable sized arrays at global scope or for static variables,
     176                // so don't hoist dimension.
     177                if ( ! inFunction ) return;
     178                if ( storageclass == DeclarationNode::Static ) return;
     179
     180                if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {
     181                        if ( ! arrayType->get_dimension() ) return; // xxx - recursive call to hoist?
     182
     183                        // don't need to hoist dimension if it's a constexpr - only need to if there's potential
     184                        // for side effects.
     185                        if ( isConstExpr( arrayType->get_dimension() ) ) return;
     186
     187                        ObjectDecl * arrayDimension = new ObjectDecl( dimensionName.newName(), storageclass, LinkageSpec::C, 0, SymTab::SizeType->clone(), new SingleInit( arrayType->get_dimension() ) );
     188                        arrayDimension->get_type()->set_isConst( true );
     189
     190                        arrayType->set_dimension( new VariableExpr( arrayDimension ) );
     191                        addDeclaration( arrayDimension );
     192
     193                        hoist( arrayType->get_base() );
     194                        return;
     195                }
     196        }
     197
     198        DeclarationWithType * HoistArrayDimension::mutate( FunctionDecl *functionDecl ) {
     199                bool oldInFunc = inFunction;
     200                inFunction = true;
     201                DeclarationWithType * decl = Parent::mutate( functionDecl );
     202                inFunction = oldInFunc;
     203                return decl;
     204        }
    126205
    127206        void CtorDtor::generateCtorDtor( std::list< Declaration * > & translationUnit ) {
     
    130209        }
    131210
    132         namespace {
    133                 Expression * makeCtorDtorExpr( std::string name, ObjectDecl * objDecl, std::list< Expression * > args ) {
    134                         UntypedExpr * expr = new UntypedExpr( new NameExpr( name ) );
    135                         expr->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) );
    136                         expr->get_args().splice( expr->get_args().end(), args );
    137                         return expr;
    138                 }
    139         }
    140 
    141211        DeclarationWithType * CtorDtor::mutate( ObjectDecl * objDecl ) {
    142                 // hands off if designated or if @=
     212                // hands off if designated, if @=, or if extern
    143213                if ( tryConstruct( objDecl ) ) {
    144                         if ( inFunction ) {
    145                                 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) {
    146                                         // call into makeArrayFunction from validate.cc to generate calls to ctor/dtor for each element of array
    147                                         // TODO: walk initializer and generate appropriate copy ctor if element has initializer
    148                                         std::list< Expression * > args = makeInitList( objDecl->get_init() );
    149                                         if ( args.empty() ) {
    150                                                 std::list< Statement * > ctor;
    151                                                 std::list< Statement * > dtor;
    152 
    153                                                 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "?{}", back_inserter( ctor ) );
    154                                                 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "^?{}", front_inserter( dtor ), false );
    155 
    156                                                 // Currently makeArrayFunction produces a single Statement - a CompoundStmt
    157                                                 // which  wraps everything that needs to happen. As such, it's technically
    158                                                 // possible to use a Statement ** in the above calls, but this is inherently
    159                                                 // unsafe, so instead we take the slightly less efficient route, but will be
    160                                                 // immediately informed if somehow the above assumption is broken. In this case,
    161                                                 // we could always wrap the list of statements at this point with a CompoundStmt,
    162                                                 // but it seems reasonable at the moment for this to be done by makeArrayFunction
    163                                                 // itself
    164                                                 assert( ctor.size() == 1 && dynamic_cast< ImplicitCtorDtorStmt * >( ctor.front() ) );
    165                                                 assert( dtor.size() == 1 && dynamic_cast< ImplicitCtorDtorStmt * >( dtor.front() ) );
    166                                                 objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) );
    167                                         } else {
    168                                                 // array came with an initializer list: initialize each element
    169                                                 // may have more initializers than elements in the array - need to check at each index that
    170                                                 // we haven't exceeded size. This requires precomputing the size because it might be a side-effecting
    171                                                 // computation.
    172                                                 // may have fewer initializers than eleemnts in the array - need to default construct
    173                                                 // remaining elements.
    174                                                 // might be able to merge this with the case above.
    175                                         }
    176                                 } else {
    177                                         // it's sufficient to attempt to call the ctor/dtor for the given object and its initializer
    178                                         Expression * ctor = makeCtorDtorExpr( "?{}", objDecl, makeInitList( objDecl->get_init() ) );
    179                                         Expression * dtor = makeCtorDtorExpr( "^?{}", objDecl, std::list< Expression * >() );
    180 
    181                                         // need to remember init expression, in case no ctors exist
    182                                         // if ctor does exist, want to use ctor expression instead of init
    183                                         // push this decision to the resolver
    184                                         ExprStmt * ctorStmt = new ExprStmt( noLabels, ctor );
    185                                         ExprStmt * dtorStmt = new ExprStmt( noLabels, dtor );
    186                                         objDecl->set_init( new ConstructorInit( new ImplicitCtorDtorStmt( ctorStmt ), new ImplicitCtorDtorStmt( dtorStmt ), objDecl->get_init() ) );
    187                                 }
     214                        // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor
     215                        // for each constructable object
     216                        std::list< Statement * > ctor;
     217                        std::list< Statement * > dtor;
     218
     219                        InitExpander srcParam( objDecl->get_init() );
     220                        InitExpander nullParam( (Initializer *)NULL );
     221                        SymTab::genImplicitCall( srcParam, new VariableExpr( objDecl ), "?{}", back_inserter( ctor ), objDecl );
     222                        SymTab::genImplicitCall( nullParam, new VariableExpr( objDecl ), "^?{}", front_inserter( dtor ), objDecl, false );
     223
     224                        // Currently genImplicitCall produces a single Statement - a CompoundStmt
     225                        // which  wraps everything that needs to happen. As such, it's technically
     226                        // possible to use a Statement ** in the above calls, but this is inherently
     227                        // unsafe, so instead we take the slightly less efficient route, but will be
     228                        // immediately informed if somehow the above assumption is broken. In this case,
     229                        // we could always wrap the list of statements at this point with a CompoundStmt,
     230                        // but it seems reasonable at the moment for this to be done by genImplicitCall
     231                        // itself. It is possible that genImplicitCall produces no statements (e.g. if
     232                        // an array type does not have a dimension). In this case, it's fine to ignore
     233                        // the object for the purposes of construction.
     234                        assert( ctor.size() == dtor.size() && ctor.size() <= 1 );
     235                        if ( ctor.size() == 1 ) {
     236                                // need to remember init expression, in case no ctors exist
     237                                // if ctor does exist, want to use ctor expression instead of init
     238                                // push this decision to the resolver
     239                                assert( dynamic_cast< ImplicitCtorDtorStmt * > ( ctor.front() ) && dynamic_cast< ImplicitCtorDtorStmt * > ( dtor.front() ) );
     240                                objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) );
    188241                        }
    189242                }
     
    193246        DeclarationWithType * CtorDtor::mutate( FunctionDecl *functionDecl ) {
    194247                // parameters should not be constructed and destructed, so don't mutate FunctionType
    195                 bool oldInFunc = inFunction;
    196248                mutateAll( functionDecl->get_oldDecls(), *this );
    197                 inFunction = true;
    198249                functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) );
    199                 inFunction = oldInFunc;
    200250                return functionDecl;
    201251        }
    202 
    203         // should not traverse into any of these declarations to find objects
    204         // that need to be constructed or destructed
    205         Declaration* CtorDtor::mutate( StructDecl *aggregateDecl ) { return aggregateDecl; }
    206         Declaration* CtorDtor::mutate( UnionDecl *aggregateDecl ) { return aggregateDecl; }
    207         Declaration* CtorDtor::mutate( EnumDecl *aggregateDecl ) { return aggregateDecl; }
    208         Declaration* CtorDtor::mutate( TraitDecl *aggregateDecl ) { return aggregateDecl; }
    209         TypeDecl* CtorDtor::mutate( TypeDecl *typeDecl ) { return typeDecl; }
    210         Declaration* CtorDtor::mutate( TypedefDecl *typeDecl ) { return typeDecl; }
    211         Type* CtorDtor::mutate( FunctionType *funcType ) { return funcType; }
    212 
    213252} // namespace InitTweak
    214253
  • src/InitTweak/InitTweak.cc

    r5070fe4 rc331406  
     1#include <algorithm>
    12#include "InitTweak.h"
    23#include "SynTree/Visitor.h"
     
    45#include "SynTree/Initializer.h"
    56#include "SynTree/Expression.h"
     7#include "SynTree/Attribute.h"
    68#include "GenPoly/GenPoly.h"
    79
     
    2022                };
    2123
    22                 class InitExpander : public Visitor {
     24                class InitFlattener : public Visitor {
    2325                        public:
    24                         InitExpander() {}
    2526                        virtual void visit( SingleInit * singleInit );
    2627                        virtual void visit( ListInit * listInit );
     
    2829                };
    2930
    30                 void InitExpander::visit( SingleInit * singleInit ) {
     31                void InitFlattener::visit( SingleInit * singleInit ) {
    3132                        argList.push_back( singleInit->get_value()->clone() );
    3233                }
    3334
    34                 void InitExpander::visit( ListInit * listInit ) {
    35                         // xxx - for now, assume no nested list inits
    36                         std::list<Initializer*>::iterator it = listInit->begin_initializers();
    37                         for ( ; it != listInit->end_initializers(); ++it ) {
     35                void InitFlattener::visit( ListInit * listInit ) {
     36                        // flatten nested list inits
     37                        std::list<Initializer*>::iterator it = listInit->begin();
     38                        for ( ; it != listInit->end(); ++it ) {
    3839                                (*it)->accept( *this );
    3940                        }
     
    4243
    4344        std::list< Expression * > makeInitList( Initializer * init ) {
    44                 InitExpander expander;
    45                 maybeAccept( init, expander );
    46                 return expander.argList;
     45                InitFlattener flattener;
     46                maybeAccept( init, flattener );
     47                return flattener.argList;
    4748        }
    4849
     
    5354        }
    5455
     56        class InitExpander::ExpanderImpl {
     57        public:
     58                virtual std::list< Expression * > next( std::list< Expression * > & indices ) = 0;
     59                virtual Statement * buildListInit( UntypedExpr * callExpr, std::list< Expression * > & indices ) = 0;
     60        };
     61
     62        class InitImpl : public InitExpander::ExpanderImpl {
     63        public:
     64                InitImpl( Initializer * init ) : init( init ) {}
     65
     66                virtual std::list< Expression * > next( std::list< Expression * > & indices ) {
     67                        // this is wrong, but just a placeholder for now
     68                        // if ( ! flattened ) flatten( indices );
     69                        // return ! inits.empty() ? makeInitList( inits.front() ) : std::list< Expression * >();
     70                        return makeInitList( init );
     71                }
     72
     73                virtual Statement * buildListInit( UntypedExpr * callExpr, std::list< Expression * > & indices );
     74        private:
     75                Initializer * init;
     76        };
     77
     78        class ExprImpl : public InitExpander::ExpanderImpl {
     79        public:
     80                ExprImpl( Expression * expr ) : arg( expr ) {}
     81
     82                virtual std::list< Expression * > next( std::list< Expression * > & indices ) {
     83                        std::list< Expression * > ret;
     84                        Expression * expr = maybeClone( arg );
     85                        if ( expr ) {
     86                                for ( std::list< Expression * >::reverse_iterator it = indices.rbegin(); it != indices.rend(); ++it ) {
     87                                        // go through indices and layer on subscript exprs ?[?]
     88                                        ++it;
     89                                        UntypedExpr * subscriptExpr = new UntypedExpr( new NameExpr( "?[?]") );
     90                                        subscriptExpr->get_args().push_back( expr );
     91                                        subscriptExpr->get_args().push_back( (*it)->clone() );
     92                                        expr = subscriptExpr;
     93                                }
     94                                ret.push_back( expr );
     95                        }
     96                        return ret;
     97                }
     98
     99                virtual Statement * buildListInit( UntypedExpr * callExpr, std::list< Expression * > & indices );
     100        private:
     101                Expression * arg;
     102        };
     103
     104        InitExpander::InitExpander( Initializer * init ) : expander( new InitImpl( init ) ) {}
     105
     106        InitExpander::InitExpander( Expression * expr ) : expander( new ExprImpl( expr ) ) {}
     107
     108        std::list< Expression * > InitExpander::operator*() {
     109                return cur;
     110        }
     111
     112        InitExpander & InitExpander::operator++() {
     113                cur = expander->next( indices );
     114                return *this;
     115        }
     116
     117        // use array indices list to build switch statement
     118        void InitExpander::addArrayIndex( Expression * index, Expression * dimension ) {
     119                indices.push_back( index );
     120                indices.push_back( dimension );
     121        }
     122
     123        void InitExpander::clearArrayIndices() {
     124                indices.clear();
     125        }
     126
     127        namespace {
     128                /// given index i, dimension d, initializer init, and callExpr f, generates
     129                ///   if (i < d) f(..., init)
     130                ///   ++i;
     131                /// so that only elements within the range of the array are constructed
     132                template< typename OutIterator >
     133                void buildCallExpr( UntypedExpr * callExpr, Expression * index, Expression * dimension, Initializer * init, OutIterator out ) {
     134                        UntypedExpr * cond = new UntypedExpr( new NameExpr( "?<?") );
     135                        cond->get_args().push_back( index->clone() );
     136                        cond->get_args().push_back( dimension->clone() );
     137
     138                        std::list< Expression * > args = makeInitList( init );
     139                        callExpr->get_args().splice( callExpr->get_args().end(), args );
     140
     141                        *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), NULL );
     142
     143                        UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) );
     144                        increment->get_args().push_back( new AddressExpr( index->clone() ) );
     145                        *out++ = new ExprStmt( noLabels, increment );
     146                }
     147
     148                template< typename OutIterator >
     149                void build( UntypedExpr * callExpr, InitExpander::IndexList::iterator idx, InitExpander::IndexList::iterator idxEnd, Initializer * init, OutIterator out ) {
     150                        if ( idx == idxEnd ) return;
     151                        Expression * index = *idx++;
     152                        assert( idx != idxEnd );
     153                        Expression * dimension = *idx++;
     154
     155                        // xxx - may want to eventually issue a warning here if we can detect
     156                        // that the number of elements exceeds to dimension of the array
     157                        if ( idx == idxEnd ) {
     158                                if ( ListInit * listInit = dynamic_cast< ListInit * >( init ) ) {
     159                                        for ( Initializer * init : *listInit ) {
     160                                                buildCallExpr( callExpr->clone(), index, dimension, init, out );
     161                                        }
     162                                } else {
     163                                        buildCallExpr( callExpr->clone(), index, dimension, init, out );
     164                                }
     165                        } else {
     166                                std::list< Statement * > branches;
     167
     168                                unsigned long cond = 0;
     169                                ListInit * listInit = dynamic_cast< ListInit * >( init );
     170                                if ( ! listInit ) {
     171                                        // xxx - this shouldn't be an error, but need a way to
     172                                        // terminate without creating output, so should catch this error
     173                                        throw SemanticError( "unbalanced list initializers" );
     174                                }
     175
     176                                static UniqueName targetLabel( "L__autogen__" );
     177                                Label switchLabel( targetLabel.newName(), 0, std::list< Attribute * >{ new Attribute("unused") } );
     178                                for ( Initializer * init : *listInit ) {
     179                                        Expression * condition;
     180                                        // check for designations
     181                                        // if ( init-> ) {
     182                                                condition = new ConstantExpr( Constant::from_ulong( cond ) );
     183                                                ++cond;
     184                                        // } else {
     185                                        //      condition = // ... take designation
     186                                        //      cond = // ... take designation+1
     187                                        // }
     188                                        std::list< Statement * > stmts;
     189                                        build( callExpr, idx, idxEnd, init, back_inserter( stmts ) );
     190                                        stmts.push_back( new BranchStmt( noLabels, switchLabel, BranchStmt::Break ) );
     191                                        CaseStmt * caseStmt = new CaseStmt( noLabels, condition, stmts );
     192                                        branches.push_back( caseStmt );
     193                                }
     194                                *out++ = new SwitchStmt( noLabels, index->clone(), branches );
     195                                *out++ = new NullStmt( std::list<Label>{ switchLabel } );
     196                        }
     197                }
     198        }
     199
     200        // if array came with an initializer list: initialize each element
     201        // may have more initializers than elements in the array - need to check at each index that
     202        // we haven't exceeded size.
     203        // may have fewer initializers than elements in the array - need to default construct
     204        // remaining elements.
     205        // To accomplish this, generate switch statement, consuming all of expander's elements
     206        Statement * InitImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) {
     207                if ( ! init ) return NULL;
     208                CompoundStmt * block = new CompoundStmt( noLabels );
     209                build( dst, indices.begin(), indices.end(), init, back_inserter( block->get_kids() ) );
     210                if ( block->get_kids().empty() ) {
     211                        delete block;
     212                        return NULL;
     213                } else {
     214                        init = NULL; // init was consumed in creating the list init
     215                        return block;
     216                }
     217        }
     218
     219        Statement * ExprImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) {
     220                return NULL;
     221        }
     222
     223        Statement * InitExpander::buildListInit( UntypedExpr * dst ) {
     224                return expander->buildListInit( dst, indices );
     225        }
     226
    55227        bool tryConstruct( ObjectDecl * objDecl ) {
    56228                return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) &&
    57229                        (objDecl->get_init() == NULL ||
    58230                                ( objDecl->get_init() != NULL && objDecl->get_init()->get_maybeConstructed() )) &&
    59                         ! isDesignated( objDecl->get_init() );
     231                        ! isDesignated( objDecl->get_init() )
     232                        && objDecl->get_storageClass() != DeclarationNode::Extern;
     233        }
     234
     235        class CallFinder : public Visitor {
     236        public:
     237                typedef Visitor Parent;
     238                CallFinder( const std::list< std::string > & names ) : names( names ) {}
     239
     240                virtual void visit( ApplicationExpr * appExpr ) {
     241                        handleCallExpr( appExpr );
     242                }
     243
     244                virtual void visit( UntypedExpr * untypedExpr ) {
     245                        handleCallExpr( untypedExpr );
     246                }
     247
     248                std::list< Expression * > * matches;
     249        private:
     250                const std::list< std::string > names;
     251
     252                template< typename CallExpr >
     253                void handleCallExpr( CallExpr * expr ) {
     254                        Parent::visit( expr );
     255                        std::string fname = getFunctionName( expr );
     256                        if ( std::find( names.begin(), names.end(), fname ) != names.end() ) {
     257                                matches->push_back( expr );
     258                        }
     259                }
     260        };
     261
     262        void collectCtorDtorCalls( Statement * stmt, std::list< Expression * > & matches ) {
     263                static CallFinder finder( std::list< std::string >{ "?{}", "^?{}" } );
     264                finder.matches = &matches;
     265                maybeAccept( stmt, finder );
    60266        }
    61267
    62268        Expression * getCtorDtorCall( Statement * stmt ) {
    63                 if ( stmt == NULL ) return NULL;
    64                 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( stmt ) ) {
    65                         return exprStmt->get_expr();
    66                 } else if ( CompoundStmt * compoundStmt = dynamic_cast< CompoundStmt * >( stmt ) ) {
    67                         // could also be a compound statement with a loop, in the case of an array
    68                         if( compoundStmt->get_kids().size() == 2 ) {
    69                                 // loop variable and loop
    70                                 ForStmt * forStmt = dynamic_cast< ForStmt * >( compoundStmt->get_kids().back() );
    71                                 assert( forStmt && forStmt->get_body() );
    72                                 return getCtorDtorCall( forStmt->get_body() );
    73                         } else if ( compoundStmt->get_kids().size() == 1 ) {
    74                                 // should be the call statement, but in any case there's only one option
    75                                 return getCtorDtorCall( compoundStmt->get_kids().front() );
    76                         } else {
    77                                 assert( false && "too many statements in compoundStmt for getCtorDtorCall" );
    78                         }
    79                 } if ( ImplicitCtorDtorStmt * impCtorDtorStmt = dynamic_cast< ImplicitCtorDtorStmt * > ( stmt ) ) {
    80                         return getCtorDtorCall( impCtorDtorStmt->get_callStmt() );
    81                 } else {
    82                         // should never get here
    83                         assert( false && "encountered unknown call statement" );
    84                 }
    85         }
    86 
    87         bool isInstrinsicSingleArgCallStmt( Statement * stmt ) {
    88                 Expression * callExpr = getCtorDtorCall( stmt );
    89                 if ( ! callExpr ) return false;
    90                 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( callExpr );
    91                 assert( appExpr );
    92                 VariableExpr * function = dynamic_cast< VariableExpr * >( appExpr->get_function() );
     269                std::list< Expression * > matches;
     270                collectCtorDtorCalls( stmt, matches );
     271                assert( matches.size() <= 1 );
     272                return matches.size() == 1 ? matches.front() : NULL;
     273        }
     274
     275        namespace {
     276                VariableExpr * getCalledFunction( ApplicationExpr * appExpr ) {
     277                        assert( appExpr );
     278                        // xxx - it's possible this can be other things, e.g. MemberExpr, so this is insufficient
     279                        return dynamic_cast< VariableExpr * >( appExpr->get_function() );
     280                }
     281        }
     282
     283        ApplicationExpr * isIntrinsicCallExpr( Expression * expr ) {
     284                ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr );
     285                if ( ! appExpr ) return NULL;
     286                VariableExpr * function = getCalledFunction( appExpr );
    93287                assert( function );
    94288                // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor
    95289                // will call all member dtors, and some members may have a user defined dtor.
    96                 FunctionType * funcType = GenPoly::getFunctionType( function->get_var()->get_type() );
    97                 assert( funcType );
    98                 return function->get_var()->get_linkage() == LinkageSpec::Intrinsic && funcType->get_parameters().size() == 1;
     290                return function->get_var()->get_linkage() == LinkageSpec::Intrinsic ? appExpr : NULL;
     291        }
     292
     293        bool isIntrinsicSingleArgCallStmt( Statement * stmt ) {
     294                std::list< Expression * > callExprs;
     295                collectCtorDtorCalls( stmt, callExprs );
     296                // if ( callExprs.empty() ) return false; // xxx - do I still need this check?
     297                return std::all_of( callExprs.begin(), callExprs.end(), []( Expression * callExpr ){
     298                        if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) {
     299                                assert( ! appExpr->get_function()->get_results().empty() );
     300                                FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_results().front() );
     301                                assert( funcType );
     302                                return funcType->get_parameters().size() == 1;
     303                        }
     304                        return false;
     305                });
    99306        }
    100307
     
    160367                else return NULL;
    161368        }
     369
     370        class ConstExprChecker : public Visitor {
     371        public:
     372                ConstExprChecker() : isConstExpr( true ) {}
     373
     374                virtual void visit( ApplicationExpr *applicationExpr ) { isConstExpr = false; }
     375                virtual void visit( UntypedExpr *untypedExpr ) { isConstExpr = false; }
     376                virtual void visit( NameExpr *nameExpr ) { isConstExpr = false; }
     377                virtual void visit( CastExpr *castExpr ) { isConstExpr = false; }
     378                virtual void visit( LabelAddressExpr *labAddressExpr ) { isConstExpr = false; }
     379                virtual void visit( UntypedMemberExpr *memberExpr ) { isConstExpr = false; }
     380                virtual void visit( MemberExpr *memberExpr ) { isConstExpr = false; }
     381                virtual void visit( VariableExpr *variableExpr ) { isConstExpr = false; }
     382                virtual void visit( ConstantExpr *constantExpr ) { /* bottom out */ }
     383                // these might be okay?
     384                // virtual void visit( SizeofExpr *sizeofExpr );
     385                // virtual void visit( AlignofExpr *alignofExpr );
     386                // virtual void visit( UntypedOffsetofExpr *offsetofExpr );
     387                // virtual void visit( OffsetofExpr *offsetofExpr );
     388                // virtual void visit( OffsetPackExpr *offsetPackExpr );
     389                // virtual void visit( AttrExpr *attrExpr );
     390                // virtual void visit( CommaExpr *commaExpr );
     391                // virtual void visit( LogicalExpr *logicalExpr );
     392                // virtual void visit( ConditionalExpr *conditionalExpr );
     393                virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }
     394                virtual void visit( SolvedTupleExpr *tupleExpr ) { isConstExpr = false; }
     395                virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; }
     396                virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; }
     397                virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; }
     398                virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; }
     399
     400                bool isConstExpr;
     401        };
     402
     403        bool isConstExpr( Expression * expr ) {
     404                if ( expr ) {
     405                        ConstExprChecker checker;
     406                        expr->accept( checker );
     407                        return checker.isConstExpr;
     408                }
     409                return true;
     410        }
     411
     412        bool isConstExpr( Initializer * init ) {
     413                if ( init ) {
     414                        ConstExprChecker checker;
     415                        init->accept( checker );
     416                        return checker.isConstExpr;
     417                } // if
     418                // for all intents and purposes, no initializer means const expr
     419                return true;
     420        }
     421
    162422}
  • src/InitTweak/InitTweak.h

    r5070fe4 rc331406  
    2626// helper functions for initialization
    2727namespace InitTweak {
    28   /// transform Initializer into an argument list that can be passed to a call expression
    29   std::list< Expression * > makeInitList( Initializer * init );
     28        /// transform Initializer into an argument list that can be passed to a call expression
     29        std::list< Expression * > makeInitList( Initializer * init );
    3030
    31   /// True if the resolver should try to construct objDecl
    32   bool tryConstruct( ObjectDecl * objDecl );
     31        /// True if the resolver should try to construct objDecl
     32        bool tryConstruct( ObjectDecl * objDecl );
    3333
    34   /// True if the Initializer contains designations
    35   bool isDesignated( Initializer * init );
     34        /// True if the Initializer contains designations
     35        bool isDesignated( Initializer * init );
    3636
    37   /// True if stmt is a call statement where the function called is intrinsic and takes one parameter.
    38   /// Intended to be used for default ctor/dtor calls, but might have use elsewhere.
    39   /// Currently has assertions that make it less than fully general.
    40   bool isInstrinsicSingleArgCallStmt( Statement * expr );
     37  /// Non-Null if expr is a call expression whose target function is intrinsic
     38  ApplicationExpr * isIntrinsicCallExpr( Expression * expr );
    4139
    42   /// get the Ctor/Dtor call expression from a Statement that looks like a generated ctor/dtor call
    43   Expression * getCtorDtorCall( Statement * stmt );
     40        /// True if stmt is a call statement where the function called is intrinsic and takes one parameter.
     41        /// Intended to be used for default ctor/dtor calls, but might have use elsewhere.
     42        /// Currently has assertions that make it less than fully general.
     43        bool isIntrinsicSingleArgCallStmt( Statement * expr );
    4444
    45   /// returns the name of the function being called
    46   std::string getFunctionName( Expression * expr );
     45        /// get all Ctor/Dtor call expressions from a Statement
     46        void collectCtorDtorCalls( Statement * stmt, std::list< Expression * > & matches );
    4747
    48   /// returns the argument to a call expression in position N indexed from 0
    49   Expression *& getCallArg( Expression * callExpr, unsigned int pos );
     48        /// get the Ctor/Dtor call expression from a Statement that looks like a generated ctor/dtor call
     49        Expression * getCtorDtorCall( Statement * stmt );
    5050
    51   /// returns the base type of a PointerType or ArrayType, else returns NULL
    52   Type * getPointerBase( Type * );
     51        /// returns the name of the function being called
     52        std::string getFunctionName( Expression * expr );
    5353
    54   /// returns the argument if it is a PointerType or ArrayType, else returns NULL
    55   Type * isPointerType( Type * );
     54        /// returns the argument to a call expression in position N indexed from 0
     55        Expression *& getCallArg( Expression * callExpr, unsigned int pos );
     56
     57        /// returns the base type of a PointerType or ArrayType, else returns NULL
     58        Type * getPointerBase( Type * );
     59
     60        /// returns the argument if it is a PointerType or ArrayType, else returns NULL
     61        Type * isPointerType( Type * );
     62
     63        /// returns true if expr is trivially a compile-time constant
     64        bool isConstExpr( Expression * expr );
     65        bool isConstExpr( Initializer * init );
     66
     67        class InitExpander {
     68        public:
     69                // expand by stepping through init to get each list of arguments
     70                InitExpander( Initializer * init );
     71
     72                // always expand to expr
     73                InitExpander( Expression * expr );
     74
     75                // iterator-like interface
     76                std::list< Expression * > operator*();
     77                InitExpander & operator++();
     78
     79                // builds statement which has the same semantics as a C-style list initializer
     80                // (for array initializers) using callExpr as the base expression to perform initialization
     81                Statement * buildListInit( UntypedExpr * callExpr );
     82                void addArrayIndex( Expression * index, Expression * dimension );
     83                void clearArrayIndices();
     84
     85                class ExpanderImpl;
     86        private:
     87                std::shared_ptr< ExpanderImpl > expander;
     88                std::list< Expression * > cur;
     89
     90                // invariant: list of size 2N (elements come in pairs [index, dimension])
     91                typedef std::list< Expression * > IndexList;
     92                IndexList indices;
     93        };
    5694} // namespace
    5795
  • src/Makefile.in

    r5070fe4 rc331406  
    108108        ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) \
    109109        ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT) \
    110         ControlStruct/driver_cfa_cpp-CaseRangeMutator.$(OBJEXT) \
    111110        ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \
    112111        ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \
     
    373372        Common/SemanticError.cc Common/UniqueName.cc \
    374373        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    375         ControlStruct/MLEMutator.cc ControlStruct/CaseRangeMutator.cc \
    376         ControlStruct/Mutate.cc ControlStruct/ForExprMutator.cc \
     374        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
     375        ControlStruct/ForExprMutator.cc \
    377376        ControlStruct/LabelTypeChecker.cc Designators/Processor.cc \
    378377        GenPoly/Box.cc GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \
     
    543542        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    544543ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT):  \
    545         ControlStruct/$(am__dirstamp) \
    546         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    547 ControlStruct/driver_cfa_cpp-CaseRangeMutator.$(OBJEXT):  \
    548544        ControlStruct/$(am__dirstamp) \
    549545        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     
    823819        -rm -f Common/driver_cfa_cpp-SemanticError.$(OBJEXT)
    824820        -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT)
    825         -rm -f ControlStruct/driver_cfa_cpp-CaseRangeMutator.$(OBJEXT)
    826821        -rm -f ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT)
    827822        -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT)
     
    934929@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po@am__quote@
    935930@AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@
    936 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Po@am__quote@
    937931@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@
    938932@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@
     
    12171211@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-MLEMutator.obj `if test -f 'ControlStruct/MLEMutator.cc'; then $(CYGPATH_W) 'ControlStruct/MLEMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/MLEMutator.cc'; fi`
    12181212
    1219 ControlStruct/driver_cfa_cpp-CaseRangeMutator.o: ControlStruct/CaseRangeMutator.cc
    1220 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-CaseRangeMutator.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Tpo -c -o ControlStruct/driver_cfa_cpp-CaseRangeMutator.o `test -f 'ControlStruct/CaseRangeMutator.cc' || echo '$(srcdir)/'`ControlStruct/CaseRangeMutator.cc
    1221 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Po
    1222 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/CaseRangeMutator.cc' object='ControlStruct/driver_cfa_cpp-CaseRangeMutator.o' libtool=no @AMDEPBACKSLASH@
    1223 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1224 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-CaseRangeMutator.o `test -f 'ControlStruct/CaseRangeMutator.cc' || echo '$(srcdir)/'`ControlStruct/CaseRangeMutator.cc
    1225 
    1226 ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj: ControlStruct/CaseRangeMutator.cc
    1227 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Tpo -c -o ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj `if test -f 'ControlStruct/CaseRangeMutator.cc'; then $(CYGPATH_W) 'ControlStruct/CaseRangeMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/CaseRangeMutator.cc'; fi`
    1228 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Po
    1229 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/CaseRangeMutator.cc' object='ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj' libtool=no @AMDEPBACKSLASH@
    1230 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1231 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj `if test -f 'ControlStruct/CaseRangeMutator.cc'; then $(CYGPATH_W) 'ControlStruct/CaseRangeMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/CaseRangeMutator.cc'; fi`
    1232 
    12331213ControlStruct/driver_cfa_cpp-Mutate.o: ControlStruct/Mutate.cc
    12341214@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-Mutate.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Tpo -c -o ControlStruct/driver_cfa_cpp-Mutate.o `test -f 'ControlStruct/Mutate.cc' || echo '$(srcdir)/'`ControlStruct/Mutate.cc
  • src/Parser/ExpressionNode.cc

    r5070fe4 rc331406  
    1010// Created On       : Sat May 16 13:17:07 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul  5 13:41:55 2016
    13 // Update Count     : 320
     12// Last Modified On : Fri Aug  5 07:56:23 2016
     13// Update Count     : 375
    1414//
    1515
     
    8383}
    8484
    85 CommaExprNode *ExpressionNode::add_to_list( ExpressionNode *exp ) {
    86         return new CommaExprNode( this, exp );
    87 }
     85// CommaExprNode *ExpressionNode::add_to_list( ExpressionNode *exp ) {
     86//      return new CommaExprNode( this, exp );
     87// }
    8888
    8989//##############################################################################
     
    246246        "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?",
    247247        "?=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?",
    248         "?[?]", "FieldSel", "PFieldSel", "Range",
     248        "?[?]", "FieldSel", "PFieldSel", "...",
    249249        // monadic
    250250        "+?", "-?", "AddressOf", "*?", "!?", "~?", "++?", "?++", "--?", "?--", "&&"
     
    258258OperatorNode::~OperatorNode() {}
    259259
    260 OperatorNode::Type OperatorNode::get_type( void ) const{
     260OperatorNode::Type OperatorNode::get_type( void ) const {
    261261        return type;
    262262}
     
    311311}
    312312
    313 #include "Common/utility.h"
     313
     314Expression *build_cast( TypeValueNode * arg, ExpressionNode *expr_node ) {
     315        DeclarationNode *decl_node = arg->get_decl();
     316
     317        Type *targetType = decl_node->buildType();
     318        if ( dynamic_cast< VoidType* >( targetType ) ) {
     319                delete targetType;
     320                return new CastExpr( maybeBuild<Expression>(expr_node) );
     321        } else {
     322                return new CastExpr( maybeBuild<Expression>(expr_node), targetType );
     323        } // if
     324}
     325
     326Expression *build_fieldSel( ExpressionNode *expr_node, VarRefNode *member ) {
     327        NameExpr* memberExpr = dynamic_cast<NameExpr*> ( maybeBuild<Expression>( member) );
     328        assert( memberExpr );
     329        UntypedMemberExpr *ret = new UntypedMemberExpr( memberExpr->get_name(), maybeBuild<Expression>(expr_node) );
     330        delete member;
     331        return ret;
     332}
     333
     334Expression *build_pfieldSel( ExpressionNode *expr_node, VarRefNode *member ) {
     335        NameExpr* memberExpr = dynamic_cast<NameExpr*> ( maybeBuild<Expression>( member) );
     336        assert( memberExpr );
     337        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
     338        deref->get_args().push_back( maybeBuild<Expression>(expr_node) );
     339        UntypedMemberExpr *ret = new UntypedMemberExpr( memberExpr->get_name(), deref );
     340        delete member;
     341        return ret;
     342}
     343
     344Expression *build_addressOf( ExpressionNode *expr_node ) {
     345                return new AddressExpr( maybeBuild<Expression>(expr_node) );
     346}
     347Expression *build_sizeOf( ExpressionNode *expr_node ) {
     348        if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( expr_node ) ) {
     349                return new SizeofExpr( arg->get_decl()->buildType() );
     350        } else {
     351                return new SizeofExpr( maybeBuild<Expression>(expr_node) );
     352        } // if
     353}
     354Expression *build_alignOf( ExpressionNode *expr_node ) {
     355        if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( expr_node ) ) {
     356                return new AlignofExpr( arg->get_decl()->buildType() );
     357        } else {
     358                return new AlignofExpr( maybeBuild<Expression>(expr_node) );
     359        } // if
     360}
     361Expression *build_offsetOf( TypeValueNode * arg, VarRefNode *member ) {
     362        NameExpr *memberExpr = dynamic_cast<NameExpr *>( maybeBuild<Expression>( member ) );
     363        assert( memberExpr );
     364        return new UntypedOffsetofExpr( arg->get_decl()->buildType(), memberExpr->get_name() );
     365}
     366
     367Expression *build_and_or( ExpressionNode *expr_node1, ExpressionNode *expr_node2, bool kind ) {
     368        return new LogicalExpr( notZeroExpr( maybeBuild<Expression>(expr_node1) ), notZeroExpr( maybeBuild<Expression>(expr_node2) ), kind );
     369}
     370
     371Expression *build_opr1( OperatorNode::Type op, ExpressionNode *expr_node ) {
     372        std::list<Expression *> args;
     373        args.push_back( new AddressExpr( maybeBuild<Expression>(expr_node) ) );
     374        return new UntypedExpr( new NameExpr( opName[ op ] ), args );
     375}
     376Expression *build_opr2( OperatorNode::Type op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
     377        std::list<Expression *> args;
     378        args.push_back( maybeBuild<Expression>(expr_node1) );
     379        args.push_back( maybeBuild<Expression>(expr_node2) );
     380        return new UntypedExpr( new NameExpr( opName[ op ] ), args );
     381}
     382
     383Expression *build_cond( ExpressionNode *expr_node1, ExpressionNode *expr_node2, ExpressionNode *expr_node3 ) {
     384        return new ConditionalExpr( notZeroExpr( maybeBuild<Expression>(expr_node1) ), maybeBuild<Expression>(expr_node2), maybeBuild<Expression>(expr_node3) );
     385}
     386
     387Expression *build_comma( ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) {
     388        return new CommaExpr( maybeBuild<Expression>(expr_node1), maybeBuild<Expression>(expr_node2) );
     389}
     390
     391CompositeExprNode2::CompositeExprNode2( Expression *expr ) : expr( expr ) {}
     392CompositeExprNode2::CompositeExprNode2( const CompositeExprNode2 &other ) : expr( other.expr->clone() ) {}
     393CompositeExprNode2::~CompositeExprNode2() { delete expr; }
     394void CompositeExprNode2::print( std::ostream &, int indent ) const { assert( false ); }
     395void CompositeExprNode2::printOneLine( std::ostream &, int indent ) const { assert( false ); }
     396
    314397
    315398Expression *CompositeExprNode::build() const {
     
    323406        } // if
    324407
    325         switch ( op->get_type()) {
    326           case OperatorNode::Incr:
    327           case OperatorNode::Decr:
    328           case OperatorNode::IncrPost:
    329           case OperatorNode::DecrPost:
     408        switch ( op->get_type() ) {
    330409          case OperatorNode::Assign:
    331410          case OperatorNode::MulAssn:
     
    339418          case OperatorNode::ERAssn:
    340419          case OperatorNode::OrAssn:
    341                 // the rewrite rules for these expressions specify that the first argument has its address taken
    342420                assert( ! args.empty() );
    343421                args.front() = new AddressExpr( args.front() );
    344                 break;
    345           default:              // do nothing
    346                 ;
    347         } // switch
    348 
    349         switch ( op->get_type() ) {
    350           case OperatorNode::Incr:
    351           case OperatorNode::Decr:
    352           case OperatorNode::IncrPost:
    353           case OperatorNode::DecrPost:
    354           case OperatorNode::Assign:
    355           case OperatorNode::MulAssn:
    356           case OperatorNode::DivAssn:
    357           case OperatorNode::ModAssn:
    358           case OperatorNode::PlusAssn:
    359           case OperatorNode::MinusAssn:
    360           case OperatorNode::LSAssn:
    361           case OperatorNode::RSAssn:
    362           case OperatorNode::AndAssn:
    363           case OperatorNode::ERAssn:
    364           case OperatorNode::OrAssn:
    365           case OperatorNode::Plus:
    366           case OperatorNode::Minus:
    367           case OperatorNode::Mul:
    368           case OperatorNode::Div:
    369           case OperatorNode::Mod:
    370           case OperatorNode::BitOr:
    371           case OperatorNode::BitAnd:
    372           case OperatorNode::Xor:
    373           case OperatorNode::LShift:
    374           case OperatorNode::RShift:
    375           case OperatorNode::LThan:
    376           case OperatorNode::GThan:
    377           case OperatorNode::LEThan:
    378           case OperatorNode::GEThan:
    379           case OperatorNode::Eq:
    380           case OperatorNode::Neq:
    381           case OperatorNode::Index:
    382           case OperatorNode::Range:
    383422          case OperatorNode::UnPlus:
    384423          case OperatorNode::UnMinus:
     
    388427          case OperatorNode::LabelAddress:
    389428                return new UntypedExpr( new NameExpr( opName[ op->get_type() ] ), args );
    390           case OperatorNode::AddressOf:
    391                 assert( args.size() == 1 );
    392                 assert( args.front() );
    393 
    394                 return new AddressExpr( args.front() );
    395           case OperatorNode::Cast:
    396                 {
    397                         TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args());
    398                         assert( arg );
    399 
    400                         DeclarationNode *decl_node = arg->get_decl();
    401                         ExpressionNode *expr_node = dynamic_cast<ExpressionNode *>( arg->get_link());
    402 
    403                         Type *targetType = decl_node->buildType();
    404                         if ( dynamic_cast< VoidType* >( targetType ) ) {
    405                                 delete targetType;
    406                                 return new CastExpr( maybeBuild<Expression>(expr_node), maybeBuild< Expression >( get_argName() ) );
    407                         } else {
    408                                 return new CastExpr( maybeBuild<Expression>(expr_node),targetType, maybeBuild< Expression >( get_argName() ) );
    409                         } // if
    410                 }
    411           case OperatorNode::FieldSel:
    412                 {
    413                         assert( args.size() == 2 );
    414 
    415                         NameExpr *member = dynamic_cast<NameExpr *>( args.back());
    416                         // TupleExpr *memberTup = dynamic_cast<TupleExpr *>( args.back());
    417 
    418                         if ( member != 0 ) {
    419                                 UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), args.front());
    420                                 delete member;
    421                                 return ret;
    422                                 /* else if ( memberTup != 0 )
    423                                    {
    424                                    UntypedMemberExpr *ret = new UntypedMemberExpr( memberTup->get_name(), args.front());
    425                                    delete member;
    426                                    return ret;
    427                                    } */
    428                         } else
    429                                 assert( false );
    430                 }
    431           case OperatorNode::PFieldSel:
    432                 {
    433                         assert( args.size() == 2 );
    434 
    435                         NameExpr *member = dynamic_cast<NameExpr *>( args.back());  // modify for Tuples   xxx
    436                         assert( member != 0 );
    437 
    438                         UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    439                         deref->get_args().push_back( args.front() );
    440 
    441                         UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), deref );
    442                         delete member;
    443                         return ret;
    444                 }
    445           case OperatorNode::SizeOf:
    446                 {
    447                         if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()) ) {
    448                                 return new SizeofExpr( arg->get_decl()->buildType());
    449                         } else {
    450                                 return new SizeofExpr( args.front());
    451                         } // if
    452                 }
    453           case OperatorNode::AlignOf:
    454                 {
    455                         if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()) ) {
    456                                 return new AlignofExpr( arg->get_decl()->buildType());
    457                         } else {
    458                                 return new AlignofExpr( args.front());
    459                         } // if
    460                 }
    461           case OperatorNode::OffsetOf:
    462                 {
    463                         assert( args.size() == 2 );
    464 
    465                         if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args() ) ) {
    466                                 NameExpr *member = dynamic_cast<NameExpr *>( args.back() );
    467                                 assert( member != 0 );
    468 
    469                                 return new UntypedOffsetofExpr( arg->get_decl()->buildType(), member->get_name() );
    470                         } else assert( false );
    471                 }
     429
    472430          case OperatorNode::Attr:
    473431                {
    474                         VarRefNode *var = dynamic_cast<VarRefNode *>( get_args());
     432                        VarRefNode *var = dynamic_cast<VarRefNode *>( get_args() );
    475433                        assert( var );
    476434                        if ( ! get_args()->get_link() ) {
    477435                                return new AttrExpr( maybeBuild<Expression>(var), ( Expression*)0);
    478                         } else if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()->get_link()) ) {
    479                                 return new AttrExpr( maybeBuild<Expression>(var), arg->get_decl()->buildType());
     436                        } else if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()->get_link() ) ) {
     437                                return new AttrExpr( maybeBuild<Expression>(var), arg->get_decl()->buildType() );
    480438                        } else {
    481                                 return new AttrExpr( maybeBuild<Expression>(var), args.back());
     439                                return new AttrExpr( maybeBuild<Expression>(var), args.back() );
    482440                        } // if
    483441                }
    484           case OperatorNode::Or:
    485           case OperatorNode::And:
    486                 assert( args.size() == 2);
    487                 return new LogicalExpr( notZeroExpr( args.front() ), notZeroExpr( args.back() ), ( op->get_type() == OperatorNode::And ) );
    488442          case OperatorNode::Cond:
    489443                {
     
    497451          case OperatorNode::NCond:
    498452                throw UnimplementedError( "GNU 2-argument conditional expression" );
    499           case OperatorNode::Comma:
    500                 {
    501                         assert( args.size() == 2);
    502                         std::list< Expression * >::const_iterator i = args.begin();
    503                         Expression *ret = *i++;
    504                         while ( i != args.end() ) {
    505                                 ret = new CommaExpr( ret, *i++ );
    506                         }
    507                         return ret;
    508                 }
    509453                // Tuples
    510454          case OperatorNode::TupleC:
     
    515459                }
    516460          default:
    517                 // shouldn't happen
    518                 assert( false );
     461                assert( ((void)"CompositeExprNode::build", false) );
    519462                return 0;
    520463        } // switch
     
    605548
    606549void LabelNode::printOneLine( std::ostream &os, int indent ) const {}
    607 
    608 //##############################################################################
    609 
    610 CommaExprNode::CommaExprNode(): CompositeExprNode( new OperatorNode( OperatorNode::Comma )) {}
    611 
    612 CommaExprNode::CommaExprNode( ExpressionNode *exp ) : CompositeExprNode( new OperatorNode( OperatorNode::Comma ), exp ) {
    613 }
    614 
    615 CommaExprNode::CommaExprNode( ExpressionNode *exp1, ExpressionNode *exp2) : CompositeExprNode( new OperatorNode( OperatorNode::Comma ), exp1, exp2) {
    616 }
    617 
    618 CommaExprNode *CommaExprNode::add_to_list( ExpressionNode *exp ) {
    619         add_arg( exp );
    620 
    621         return this;
    622 }
    623 
    624 CommaExprNode::CommaExprNode( const CommaExprNode &other ) : CompositeExprNode( other ) {
    625 }
    626550
    627551//##############################################################################
     
    774698}
    775699
    776 
    777700ExpressionNode *flattenCommas( ExpressionNode *list ) {
    778701        if ( CompositeExprNode *composite = dynamic_cast< CompositeExprNode * >( list ) ) {
  • src/Parser/ParseNode.h

    r5070fe4 rc331406  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Jul 24 02:17:00 2016
    13 // Update Count     : 269
     12// Last Modified On : Fri Aug  5 07:49:32 2016
     13// Update Count     : 288
    1414//
    1515
     
    7777        virtual ExpressionNode *clone() const = 0;
    7878
    79         virtual CommaExprNode *add_to_list( ExpressionNode * );
     79        // virtual CommaExprNode *add_to_list( ExpressionNode * );
    8080
    8181        ExpressionNode *get_argName() const { return argName; }
     
    225225};
    226226
     227Expression *build_cast( TypeValueNode * arg, ExpressionNode *expr_node );
     228Expression *build_fieldSel( ExpressionNode *expr_node, VarRefNode *member );
     229Expression *build_pfieldSel( ExpressionNode *expr_node, VarRefNode *member );
     230Expression *build_addressOf( ExpressionNode *expr_node );
     231Expression *build_sizeOf( ExpressionNode *expr_node );
     232Expression *build_alignOf( ExpressionNode *expr_node );
     233Expression *build_offsetOf( TypeValueNode * arg, VarRefNode *member );
     234Expression *build_and( ExpressionNode *expr_node1, ExpressionNode *expr_node2 );
     235Expression *build_and_or( ExpressionNode *expr_node1, ExpressionNode *expr_node2, bool kind );
     236Expression *build_opr1( OperatorNode::Type op, ExpressionNode *expr_node );
     237Expression *build_opr2( OperatorNode::Type op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 );
     238Expression *build_cond( ExpressionNode *expr_node1, ExpressionNode *expr_node2, ExpressionNode *expr_node3 );
     239Expression *build_comma( ExpressionNode *expr_node1, ExpressionNode *expr_node2 );
     240
     241class CompositeExprNode2 : public ExpressionNode {
     242  public:
     243        CompositeExprNode2( Expression *expr );
     244        CompositeExprNode2( const CompositeExprNode2 &other );
     245        virtual ~CompositeExprNode2();
     246
     247        virtual CompositeExprNode2 *clone() const { return new CompositeExprNode2( *this ); }
     248        virtual Expression *build() const { return expr->clone(); }
     249
     250        virtual void print( std::ostream &, int indent = 0) const;
     251        virtual void printOneLine( std::ostream &, int indent = 0) const;
     252  private:
     253        Expression *expr;
     254};
     255
    227256class CompositeExprNode : public ExpressionNode {
    228257  public:
     
    290319  private:
    291320        std::list< Label > labels;
    292 };
    293 
    294 class CommaExprNode : public CompositeExprNode {
    295   public:
    296         CommaExprNode();
    297         CommaExprNode( ExpressionNode * );
    298         CommaExprNode( ExpressionNode *, ExpressionNode * );
    299         CommaExprNode( const CommaExprNode &other );
    300 
    301         virtual CommaExprNode *add_to_list( ExpressionNode * );
    302         virtual CommaExprNode *clone() const { return new CommaExprNode( *this ); }
    303321};
    304322
     
    485503        std::string get_target() const;
    486504
    487         StatementNode *add_controlexp( ExpressionNode * );
     505        // StatementNode *add_controlexp( ExpressionNode * );
    488506        StatementNode *append_block( StatementNode * );
    489507        StatementNode *append_last_case( StatementNode * );
     
    531549        ConstantNode *clobber;
    532550        std::list< Label > gotolabels;
    533 };
    534 
    535 class NullStmtNode : public CompoundStmtNode {
    536   public:
    537         Statement *build() const;
    538         void print( std::ostream &, int indent = 0 ) const;
    539551};
    540552
  • src/Parser/StatementNode.cc

    r5070fe4 rc331406  
    107107}
    108108
    109 StatementNode *StatementNode::add_controlexp( ExpressionNode *e ) {
    110         if ( control && e )
    111                 control->add_to_list( e ); // xxx - check this
    112         return this;
    113 }
     109// StatementNode *StatementNode::add_controlexp( ExpressionNode *e ) {
     110//      if ( control && e )
     111//              control->add_to_list( e ); // xxx - check this
     112//      return this;
     113// }
    114114
    115115StatementNode *StatementNode::append_block( StatementNode *stmt ) {
     
    417417}
    418418
    419 
    420 void NullStmtNode::print( ostream &os, int indent ) const {
    421         os << string( indent, ' ' ) << "Null Statement:" << endl;
    422 }
    423 
    424 Statement *NullStmtNode::build() const {
    425         return new NullStmt;
    426 }
    427 
    428419// Local Variables: //
    429420// tab-width: 4 //
  • src/Parser/TypeData.cc

    r5070fe4 rc331406  
    510510                return buildVariable();
    511511        } else {
    512                 return new ObjectDecl( name, sc, linkage, bitfieldWidth, build(), init, isInline, isNoreturn );
     512                return new ObjectDecl( name, sc, linkage, bitfieldWidth, build(), init, std::list< Attribute * >(),  isInline, isNoreturn );
    513513        } // if
    514514        return 0;
  • src/Parser/parser.cc

    r5070fe4 rc331406  
    354354        LabelNode *label;
    355355        InitializerNode *in;
     356        OperatorNode::Type op;
    356357        bool flag;
    357358
     
    359360
    360361/* Line 293 of yacc.c  */
    361 #line 362 "Parser/parser.cc"
     362#line 363 "Parser/parser.cc"
    362363} YYSTYPE;
    363364# define YYSTYPE_IS_TRIVIAL 1
     
    371372
    372373/* Line 343 of yacc.c  */
    373 #line 374 "Parser/parser.cc"
     374#line 375 "Parser/parser.cc"
    374375
    375376#ifdef short
     
    10161017static const yytype_uint16 yyrline[] =
    10171018{
    1018        0,   290,   290,   296,   305,   306,   307,   311,   312,   313,
    1019      317,   318,   322,   323,   327,   328,   332,   333,   339,   341,
    1020      343,   345,   350,   351,   357,   361,   363,   364,   366,   367,
    1021      369,   371,   373,   381,   382,   388,   389,   390,   395,   397,
    1022      402,   403,   407,   411,   413,   415,   417,   422,   425,   427,
    1023      429,   431,   436,   438,   440,   442,   444,   446,   448,   450,
    1024      452,   454,   456,   463,   464,   466,   470,   471,   472,   473,
    1025      477,   478,   480,   485,   486,   488,   490,   495,   496,   498,
    1026      503,   504,   506,   511,   512,   514,   516,   518,   523,   524,
    1027      526,   531,   532,   537,   538,   543,   544,   549,   550,   555,
    1028      556,   561,   562,   564,   566,   571,   576,   577,   579,   581,
    1029      587,   588,   594,   596,   598,   600,   605,   606,   611,   612,
    1030      613,   614,   615,   616,   617,   618,   619,   620,   624,   625,
    1031      631,   632,   638,   639,   640,   641,   642,   643,   644,   645,
    1032      646,   656,   663,   665,   675,   676,   681,   683,   689,   691,
    1033      695,   696,   701,   706,   709,   711,   713,   722,   724,   735,
    1034      736,   738,   742,   743,   748,   749,   754,   755,   759,   764,
    1035      765,   769,   771,   777,   778,   782,   784,   786,   788,   794,
    1036      795,   799,   801,   806,   808,   810,   815,   817,   822,   824,
    1037      828,   831,   835,   838,   842,   844,   848,   850,   857,   859,
    1038      861,   870,   872,   874,   876,   878,   883,   885,   887,   889,
    1039      894,   907,   908,   913,   915,   920,   924,   926,   928,   930,
    1040      932,   938,   939,   945,   946,   950,   951,   956,   958,   964,
    1041      965,   967,   972,   974,   981,   983,   987,   988,   993,   995,
    1042      999,  1000,  1004,  1006,  1010,  1011,  1015,  1016,  1020,  1021,
    1043     1036,  1037,  1038,  1039,  1040,  1044,  1049,  1056,  1066,  1071,
    1044     1076,  1084,  1089,  1094,  1099,  1104,  1112,  1134,  1139,  1146,
    1045     1148,  1155,  1160,  1165,  1176,  1181,  1186,  1191,  1196,  1205,
    1046     1210,  1218,  1219,  1220,  1221,  1227,  1232,  1240,  1241,  1242,
    1047     1243,  1247,  1248,  1249,  1250,  1255,  1256,  1265,  1266,  1271,
    1048     1272,  1277,  1279,  1281,  1283,  1285,  1288,  1287,  1299,  1300,
    1049     1302,  1312,  1313,  1318,  1322,  1324,  1326,  1328,  1330,  1332,
    1050     1334,  1336,  1341,  1343,  1345,  1347,  1349,  1351,  1353,  1355,
    1051     1357,  1359,  1361,  1363,  1365,  1371,  1372,  1374,  1376,  1378,
    1052     1383,  1384,  1390,  1391,  1393,  1395,  1400,  1402,  1404,  1406,
    1053     1411,  1412,  1414,  1416,  1421,  1422,  1424,  1429,  1430,  1432,
    1054     1434,  1439,  1441,  1443,  1448,  1449,  1453,  1455,  1461,  1460,
    1055     1464,  1466,  1471,  1473,  1479,  1480,  1485,  1486,  1488,  1489,
    1056     1498,  1499,  1501,  1503,  1508,  1510,  1516,  1517,  1519,  1522,
    1057     1525,  1530,  1531,  1536,  1541,  1545,  1547,  1553,  1552,  1559,
    1058     1561,  1567,  1568,  1576,  1577,  1581,  1582,  1583,  1585,  1587,
    1059     1594,  1595,  1597,  1599,  1604,  1605,  1611,  1612,  1616,  1617,
    1060     1622,  1623,  1624,  1626,  1634,  1635,  1637,  1640,  1642,  1646,
    1061     1647,  1648,  1650,  1652,  1656,  1661,  1669,  1670,  1679,  1681,
    1062     1686,  1687,  1688,  1692,  1693,  1694,  1698,  1699,  1700,  1704,
    1063     1705,  1706,  1711,  1712,  1713,  1714,  1720,  1721,  1723,  1728,
    1064     1729,  1734,  1735,  1736,  1737,  1738,  1753,  1754,  1759,  1760,
    1065     1768,  1770,  1772,  1775,  1777,  1779,  1802,  1803,  1805,  1807,
    1066     1812,  1813,  1815,  1820,  1825,  1826,  1832,  1831,  1835,  1839,
    1067     1841,  1843,  1849,  1850,  1855,  1860,  1862,  1867,  1869,  1870,
    1068     1872,  1877,  1879,  1881,  1886,  1888,  1893,  1898,  1906,  1912,
    1069     1911,  1925,  1926,  1931,  1932,  1936,  1941,  1946,  1954,  1959,
    1070     1970,  1971,  1982,  1983,  1989,  1990,  1994,  1995,  1996,  1999,
    1071     1998,  2009,  2018,  2024,  2030,  2039,  2045,  2051,  2057,  2063,
    1072     2071,  2077,  2085,  2091,  2100,  2101,  2102,  2106,  2110,  2112,
    1073     2117,  2118,  2122,  2123,  2128,  2134,  2135,  2138,  2140,  2141,
    1074     2145,  2146,  2147,  2148,  2182,  2184,  2185,  2187,  2192,  2197,
    1075     2202,  2204,  2206,  2211,  2213,  2215,  2217,  2222,  2224,  2233,
    1076     2235,  2236,  2241,  2243,  2245,  2250,  2252,  2254,  2259,  2261,
    1077     2263,  2272,  2273,  2274,  2278,  2280,  2282,  2287,  2289,  2291,
    1078     2296,  2298,  2300,  2315,  2317,  2318,  2320,  2325,  2326,  2331,
    1079     2333,  2335,  2340,  2342,  2344,  2346,  2351,  2353,  2355,  2365,
    1080     2367,  2368,  2370,  2375,  2377,  2379,  2384,  2386,  2388,  2390,
    1081     2395,  2397,  2399,  2430,  2432,  2433,  2435,  2440,  2445,  2453,
    1082     2455,  2457,  2462,  2464,  2469,  2471,  2485,  2486,  2488,  2493,
    1083     2495,  2497,  2499,  2501,  2506,  2507,  2509,  2511,  2516,  2518,
    1084     2520,  2526,  2528,  2530,  2534,  2536,  2538,  2540,  2554,  2555,
    1085     2557,  2562,  2564,  2566,  2568,  2570,  2575,  2576,  2578,  2580,
    1086     2585,  2587,  2589,  2595,  2596,  2598,  2607,  2610,  2612,  2615,
    1087     2617,  2619,  2632,  2633,  2635,  2640,  2642,  2644,  2646,  2648,
    1088     2653,  2654,  2656,  2658,  2663,  2665,  2673,  2674,  2675,  2680,
    1089     2681,  2685,  2687,  2689,  2691,  2693,  2695,  2702,  2704,  2706,
    1090     2708,  2710,  2712,  2714,  2716,  2718,  2720,  2725,  2727,  2729,
    1091     2734,  2760,  2761,  2763,  2767,  2768,  2772,  2774,  2776,  2778,
    1092     2780,  2782,  2789,  2791,  2793,  2795,  2797,  2799,  2804,  2809,
    1093     2811,  2813,  2831,  2833,  2838,  2839
     1019       0,   292,   292,   298,   307,   308,   309,   313,   314,   315,
     1020     319,   320,   324,   325,   329,   330,   334,   335,   341,   343,
     1021     345,   347,   352,   353,   359,   363,   365,   366,   368,   369,
     1022     371,   373,   375,   383,   384,   390,   391,   392,   397,   399,
     1023     404,   405,   409,   413,   415,   417,   419,   424,   427,   429,
     1024     431,   436,   439,   441,   443,   445,   447,   449,   451,   453,
     1025     455,   457,   459,   466,   467,   469,   473,   474,   475,   476,
     1026     480,   481,   483,   488,   489,   491,   493,   498,   499,   501,
     1027     506,   507,   509,   514,   515,   517,   519,   521,   526,   527,
     1028     529,   534,   535,   540,   541,   546,   547,   552,   553,   558,
     1029     559,   564,   565,   568,   570,   575,   580,   581,   583,   585,
     1030     591,   592,   598,   600,   602,   604,   609,   610,   615,   616,
     1031     617,   618,   619,   620,   621,   622,   623,   624,   628,   629,
     1032     636,   637,   643,   644,   645,   646,   647,   648,   649,   650,
     1033     651,   661,   668,   670,   680,   681,   686,   688,   694,   696,
     1034     700,   701,   706,   711,   714,   716,   718,   728,   730,   741,
     1035     742,   744,   748,   750,   754,   755,   760,   761,   765,   770,
     1036     771,   775,   777,   783,   784,   788,   790,   792,   794,   800,
     1037     801,   805,   807,   812,   814,   816,   821,   823,   828,   830,
     1038     834,   837,   841,   844,   848,   850,   854,   856,   863,   865,
     1039     867,   876,   878,   880,   882,   884,   889,   891,   893,   895,
     1040     900,   913,   914,   919,   921,   926,   930,   932,   934,   936,
     1041     938,   944,   945,   951,   952,   956,   957,   962,   964,   970,
     1042     971,   973,   978,   980,   987,   989,   993,   994,   999,  1001,
     1043    1005,  1006,  1010,  1012,  1016,  1017,  1021,  1022,  1026,  1027,
     1044    1042,  1043,  1044,  1045,  1046,  1050,  1055,  1062,  1072,  1077,
     1045    1082,  1090,  1095,  1100,  1105,  1110,  1118,  1140,  1145,  1152,
     1046    1154,  1161,  1166,  1171,  1182,  1187,  1192,  1197,  1202,  1211,
     1047    1216,  1224,  1225,  1226,  1227,  1233,  1238,  1246,  1247,  1248,
     1048    1249,  1253,  1254,  1255,  1256,  1261,  1262,  1271,  1272,  1277,
     1049    1278,  1283,  1285,  1287,  1289,  1291,  1294,  1293,  1305,  1306,
     1050    1308,  1318,  1319,  1324,  1328,  1330,  1332,  1334,  1336,  1338,
     1051    1340,  1342,  1347,  1349,  1351,  1353,  1355,  1357,  1359,  1361,
     1052    1363,  1365,  1367,  1369,  1371,  1377,  1378,  1380,  1382,  1384,
     1053    1389,  1390,  1396,  1397,  1399,  1401,  1406,  1408,  1410,  1412,
     1054    1417,  1418,  1420,  1422,  1427,  1428,  1430,  1435,  1436,  1438,
     1055    1440,  1445,  1447,  1449,  1454,  1455,  1459,  1461,  1467,  1466,
     1056    1470,  1472,  1477,  1479,  1485,  1486,  1491,  1492,  1494,  1495,
     1057    1504,  1505,  1507,  1509,  1514,  1516,  1522,  1523,  1525,  1528,
     1058    1531,  1536,  1537,  1542,  1547,  1551,  1553,  1559,  1558,  1565,
     1059    1567,  1573,  1574,  1582,  1583,  1587,  1588,  1589,  1591,  1593,
     1060    1600,  1601,  1603,  1605,  1610,  1611,  1617,  1618,  1622,  1623,
     1061    1628,  1629,  1630,  1632,  1640,  1641,  1643,  1646,  1648,  1652,
     1062    1653,  1654,  1656,  1658,  1662,  1667,  1675,  1676,  1685,  1687,
     1063    1692,  1693,  1694,  1698,  1699,  1700,  1704,  1705,  1706,  1710,
     1064    1711,  1712,  1717,  1718,  1719,  1720,  1726,  1727,  1729,  1734,
     1065    1735,  1740,  1741,  1742,  1743,  1744,  1759,  1760,  1765,  1766,
     1066    1774,  1776,  1778,  1781,  1783,  1785,  1808,  1809,  1811,  1813,
     1067    1818,  1819,  1821,  1826,  1831,  1832,  1838,  1837,  1841,  1845,
     1068    1847,  1849,  1855,  1856,  1861,  1866,  1868,  1873,  1875,  1876,
     1069    1878,  1883,  1885,  1887,  1892,  1894,  1899,  1904,  1912,  1918,
     1070    1917,  1931,  1932,  1937,  1938,  1942,  1947,  1952,  1960,  1965,
     1071    1976,  1977,  1988,  1989,  1995,  1996,  2000,  2001,  2002,  2005,
     1072    2004,  2015,  2024,  2030,  2036,  2045,  2051,  2057,  2063,  2069,
     1073    2077,  2083,  2091,  2097,  2106,  2107,  2108,  2112,  2116,  2118,
     1074    2123,  2124,  2128,  2129,  2134,  2140,  2141,  2144,  2146,  2147,
     1075    2151,  2152,  2153,  2154,  2188,  2190,  2191,  2193,  2198,  2203,
     1076    2208,  2210,  2212,  2217,  2219,  2221,  2223,  2228,  2230,  2239,
     1077    2241,  2242,  2247,  2249,  2251,  2256,  2258,  2260,  2265,  2267,
     1078    2269,  2278,  2279,  2280,  2284,  2286,  2288,  2293,  2295,  2297,
     1079    2302,  2304,  2306,  2321,  2323,  2324,  2326,  2331,  2332,  2337,
     1080    2339,  2341,  2346,  2348,  2350,  2352,  2357,  2359,  2361,  2371,
     1081    2373,  2374,  2376,  2381,  2383,  2385,  2390,  2392,  2394,  2396,
     1082    2401,  2403,  2405,  2436,  2438,  2439,  2441,  2446,  2451,  2459,
     1083    2461,  2463,  2468,  2470,  2475,  2477,  2491,  2492,  2494,  2499,
     1084    2501,  2503,  2505,  2507,  2512,  2513,  2515,  2517,  2522,  2524,
     1085    2526,  2532,  2534,  2536,  2540,  2542,  2544,  2546,  2560,  2561,
     1086    2563,  2568,  2570,  2572,  2574,  2576,  2581,  2582,  2584,  2586,
     1087    2591,  2593,  2595,  2601,  2602,  2604,  2613,  2616,  2618,  2621,
     1088    2623,  2625,  2638,  2639,  2641,  2646,  2648,  2650,  2652,  2654,
     1089    2659,  2660,  2662,  2664,  2669,  2671,  2679,  2680,  2681,  2686,
     1090    2687,  2691,  2693,  2695,  2697,  2699,  2701,  2708,  2710,  2712,
     1091    2714,  2716,  2718,  2720,  2722,  2724,  2726,  2731,  2733,  2735,
     1092    2740,  2766,  2767,  2769,  2773,  2774,  2778,  2780,  2782,  2784,
     1093    2786,  2788,  2795,  2797,  2799,  2801,  2803,  2805,  2810,  2815,
     1094    2817,  2819,  2837,  2839,  2844,  2845
    10941095};
    10951096#endif
     
    52165217
    52175218/* Line 1806 of yacc.c  */
    5218 #line 290 "parser.yy"
     5219#line 292 "parser.yy"
    52195220    {
    52205221                        typedefTable.enterScope();
     
    52255226
    52265227/* Line 1806 of yacc.c  */
    5227 #line 296 "parser.yy"
     5228#line 298 "parser.yy"
    52285229    {
    52295230                        typedefTable.leaveScope();
     
    52345235
    52355236/* Line 1806 of yacc.c  */
    5236 #line 305 "parser.yy"
     5237#line 307 "parser.yy"
    52375238    { (yyval.constant) = makeConstantInteger( *(yyvsp[(1) - (1)].tok) ); }
    52385239    break;
     
    52415242
    52425243/* Line 1806 of yacc.c  */
    5243 #line 306 "parser.yy"
     5244#line 308 "parser.yy"
    52445245    { (yyval.constant) = makeConstantFloat( *(yyvsp[(1) - (1)].tok) ); }
    52455246    break;
     
    52485249
    52495250/* Line 1806 of yacc.c  */
    5250 #line 307 "parser.yy"
     5251#line 309 "parser.yy"
    52515252    { (yyval.constant) = makeConstantChar( *(yyvsp[(1) - (1)].tok) ); }
    52525253    break;
     
    52555256
    52565257/* Line 1806 of yacc.c  */
    5257 #line 332 "parser.yy"
     5258#line 334 "parser.yy"
    52585259    { (yyval.constant) = makeConstantStr( *(yyvsp[(1) - (1)].tok) ); }
    52595260    break;
     
    52625263
    52635264/* Line 1806 of yacc.c  */
    5264 #line 333 "parser.yy"
     5265#line 335 "parser.yy"
    52655266    { (yyval.constant) = (yyvsp[(1) - (2)].constant)->appendstr( (yyvsp[(2) - (2)].tok) ); }
    52665267    break;
    52675268
    52685269  case 18:
    5269 
    5270 /* Line 1806 of yacc.c  */
    5271 #line 340 "parser.yy"
    5272     { (yyval.en) = new VarRefNode( (yyvsp[(1) - (1)].tok) ); }
    5273     break;
    5274 
    5275   case 19:
    52765270
    52775271/* Line 1806 of yacc.c  */
     
    52805274    break;
    52815275
     5276  case 19:
     5277
     5278/* Line 1806 of yacc.c  */
     5279#line 344 "parser.yy"
     5280    { (yyval.en) = new VarRefNode( (yyvsp[(1) - (1)].tok) ); }
     5281    break;
     5282
    52825283  case 20:
    52835284
    52845285/* Line 1806 of yacc.c  */
    5285 #line 344 "parser.yy"
     5286#line 346 "parser.yy"
    52865287    { (yyval.en) = (yyvsp[(2) - (3)].en); }
    52875288    break;
     
    52905291
    52915292/* Line 1806 of yacc.c  */
    5292 #line 346 "parser.yy"
     5293#line 348 "parser.yy"
    52935294    { (yyval.en) = new ValofExprNode( (yyvsp[(2) - (3)].sn) ); }
    52945295    break;
     
    52975298
    52985299/* Line 1806 of yacc.c  */
    5299 #line 356 "parser.yy"
    5300     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Index ), (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en) ); }
     5300#line 358 "parser.yy"
     5301    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Index, (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en) ) ); }
    53015302    break;
    53025303
     
    53045305
    53055306/* Line 1806 of yacc.c  */
    5306 #line 358 "parser.yy"
     5307#line 360 "parser.yy"
    53075308    { (yyval.en) = new CompositeExprNode( (yyvsp[(1) - (4)].en), (yyvsp[(3) - (4)].en) ); }
    53085309    break;
     
    53115312
    53125313/* Line 1806 of yacc.c  */
    5313 #line 362 "parser.yy"
    5314     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), (yyvsp[(1) - (3)].en), new VarRefNode( (yyvsp[(3) - (3)].tok) )); }
     5314#line 364 "parser.yy"
     5315    { (yyval.en) = new CompositeExprNode2( build_fieldSel( (yyvsp[(1) - (3)].en), new VarRefNode( (yyvsp[(3) - (3)].tok) ) ) ); }
    53155316    break;
    53165317
     
    53185319
    53195320/* Line 1806 of yacc.c  */
    5320 #line 365 "parser.yy"
    5321     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), (yyvsp[(1) - (3)].en), new VarRefNode( (yyvsp[(3) - (3)].tok) )); }
     5321#line 367 "parser.yy"
     5322    { (yyval.en) = new CompositeExprNode2( build_pfieldSel( (yyvsp[(1) - (3)].en), new VarRefNode( (yyvsp[(3) - (3)].tok) ) ) ); }
    53225323    break;
    53235324
     
    53255326
    53265327/* Line 1806 of yacc.c  */
    5327 #line 368 "parser.yy"
    5328     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::IncrPost ), (yyvsp[(1) - (2)].en) ); }
     5328#line 370 "parser.yy"
     5329    { (yyval.en) = new CompositeExprNode2( build_opr1( OperatorNode::IncrPost, (yyvsp[(1) - (2)].en) ) ); }
    53295330    break;
    53305331
     
    53325333
    53335334/* Line 1806 of yacc.c  */
    5334 #line 370 "parser.yy"
    5335     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::DecrPost ), (yyvsp[(1) - (2)].en) ); }
     5335#line 372 "parser.yy"
     5336    { (yyval.en) = new CompositeExprNode2( build_opr1( OperatorNode::DecrPost, (yyvsp[(1) - (2)].en) ) ); }
    53365337    break;
    53375338
     
    53395340
    53405341/* Line 1806 of yacc.c  */
    5341 #line 372 "parser.yy"
     5342#line 374 "parser.yy"
    53425343    { (yyval.en) = new CompoundLiteralNode( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ); }
    53435344    break;
     
    53465347
    53475348/* Line 1806 of yacc.c  */
    5348 #line 374 "parser.yy"
     5349#line 376 "parser.yy"
    53495350    {
    53505351                        Token fn; fn.str = new std::string( "?{}" ); // location undefined
     
    53565357
    53575358/* Line 1806 of yacc.c  */
    5358 #line 383 "parser.yy"
     5359#line 385 "parser.yy"
    53595360    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) )); }
    53605361    break;
     
    53635364
    53645365/* Line 1806 of yacc.c  */
    5365 #line 388 "parser.yy"
     5366#line 390 "parser.yy"
    53665367    { (yyval.en) = 0; }
    53675368    break;
     
    53705371
    53715372/* Line 1806 of yacc.c  */
    5372 #line 391 "parser.yy"
     5373#line 393 "parser.yy"
    53735374    { (yyval.en) = (yyvsp[(3) - (3)].en)->set_argName( (yyvsp[(1) - (3)].tok) ); }
    53745375    break;
     
    53775378
    53785379/* Line 1806 of yacc.c  */
    5379 #line 396 "parser.yy"
     5380#line 398 "parser.yy"
    53805381    { (yyval.en) = (yyvsp[(7) - (7)].en)->set_argName( (yyvsp[(3) - (7)].en) ); }
    53815382    break;
     
    53845385
    53855386/* Line 1806 of yacc.c  */
    5386 #line 398 "parser.yy"
     5387#line 400 "parser.yy"
    53875388    { (yyval.en) = (yyvsp[(9) - (9)].en)->set_argName( new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(yyvsp[(3) - (9)].en)->set_link( flattenCommas( (yyvsp[(5) - (9)].en) )))); }
    53885389    break;
     
    53915392
    53925393/* Line 1806 of yacc.c  */
    5393 #line 403 "parser.yy"
     5394#line 405 "parser.yy"
    53945395    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) ); }
    53955396    break;
     
    53985399
    53995400/* Line 1806 of yacc.c  */
    5400 #line 408 "parser.yy"
     5401#line 410 "parser.yy"
    54015402    { (yyval.en) = new VarRefNode( (yyvsp[(1) - (1)].tok) ); }
    54025403    break;
     
    54055406
    54065407/* Line 1806 of yacc.c  */
    5407 #line 412 "parser.yy"
    5408     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( (yyvsp[(1) - (3)].tok) ), (yyvsp[(3) - (3)].en) ); }
     5408#line 414 "parser.yy"
     5409    { (yyval.en) = new CompositeExprNode2( build_fieldSel( (yyvsp[(3) - (3)].en), new VarRefNode( (yyvsp[(1) - (3)].tok) ) ) ); }
    54095410    break;
    54105411
     
    54125413
    54135414/* Line 1806 of yacc.c  */
    5414 #line 414 "parser.yy"
    5415     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( (yyvsp[(1) - (7)].tok) ), (yyvsp[(5) - (7)].en) ); }
     5415#line 416 "parser.yy"
     5416    { (yyval.en) = new CompositeExprNode2( build_fieldSel( (yyvsp[(5) - (7)].en), new VarRefNode( (yyvsp[(1) - (7)].tok) ) ) ); }
    54165417    break;
    54175418
     
    54195420
    54205421/* Line 1806 of yacc.c  */
    5421 #line 416 "parser.yy"
    5422     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), new VarRefNode( (yyvsp[(1) - (3)].tok) ), (yyvsp[(3) - (3)].en) ); }
     5422#line 418 "parser.yy"
     5423    { (yyval.en) = new CompositeExprNode2( build_pfieldSel( (yyvsp[(3) - (3)].en), new VarRefNode( (yyvsp[(1) - (3)].tok) ) ) ); }
    54235424    break;
    54245425
     
    54265427
    54275428/* Line 1806 of yacc.c  */
    5428 #line 418 "parser.yy"
    5429     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), new VarRefNode( (yyvsp[(1) - (7)].tok) ), (yyvsp[(5) - (7)].en) ); }
     5429#line 420 "parser.yy"
     5430    { (yyval.en) = new CompositeExprNode2( build_pfieldSel( (yyvsp[(5) - (7)].en), new VarRefNode( (yyvsp[(1) - (7)].tok) ) ) ); }
    54305431    break;
    54315432
    54325433  case 48:
    5433 
    5434 /* Line 1806 of yacc.c  */
    5435 #line 426 "parser.yy"
    5436     { (yyval.en) = (yyvsp[(1) - (1)].constant); }
    5437     break;
    5438 
    5439   case 49:
    54405434
    54415435/* Line 1806 of yacc.c  */
     
    54445438    break;
    54455439
     5440  case 49:
     5441
     5442/* Line 1806 of yacc.c  */
     5443#line 430 "parser.yy"
     5444    { (yyval.en) = (yyvsp[(1) - (1)].constant); }
     5445    break;
     5446
    54465447  case 50:
    54475448
    54485449/* Line 1806 of yacc.c  */
    5449 #line 430 "parser.yy"
     5450#line 432 "parser.yy"
    54505451    { (yyval.en) = (yyvsp[(2) - (2)].en)->set_extension( true ); }
    54515452    break;
     
    54545455
    54555456/* Line 1806 of yacc.c  */
    5456 #line 432 "parser.yy"
     5457#line 437 "parser.yy"
     5458    { (yyval.en) = (yyvsp[(1) - (2)].op) == OperatorNode::AddressOf ? (ExpressionNode*) new CompositeExprNode2( build_addressOf( (yyvsp[(2) - (2)].en) ) )
     5459                                                                                        : (ExpressionNode*)new CompositeExprNode( new OperatorNode ( (yyvsp[(1) - (2)].op) ), (yyvsp[(2) - (2)].en) ); }
     5460    break;
     5461
     5462  case 52:
     5463
     5464/* Line 1806 of yacc.c  */
     5465#line 440 "parser.yy"
    54575466    { (yyval.en) = new CompositeExprNode( (yyvsp[(1) - (2)].en), (yyvsp[(2) - (2)].en) ); }
    54585467    break;
    54595468
    5460   case 52:
    5461 
    5462 /* Line 1806 of yacc.c  */
    5463 #line 437 "parser.yy"
    5464     { (yyval.en) = new CompositeExprNode( (yyvsp[(1) - (2)].en), (yyvsp[(2) - (2)].en) ); }
    5465     break;
    5466 
    54675469  case 53:
    54685470
    54695471/* Line 1806 of yacc.c  */
    5470 #line 439 "parser.yy"
    5471     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Incr ), (yyvsp[(2) - (2)].en) ); }
     5472#line 442 "parser.yy"
     5473    { (yyval.en) = new CompositeExprNode2( build_opr1( OperatorNode::Incr, (yyvsp[(2) - (2)].en) ) ); }
    54725474    break;
    54735475
     
    54755477
    54765478/* Line 1806 of yacc.c  */
    5477 #line 441 "parser.yy"
    5478     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Decr ), (yyvsp[(2) - (2)].en) ); }
     5479#line 444 "parser.yy"
     5480    { (yyval.en) = new CompositeExprNode2( build_opr1( OperatorNode::Decr, (yyvsp[(2) - (2)].en) ) ); }
    54795481    break;
    54805482
     
    54825484
    54835485/* Line 1806 of yacc.c  */
    5484 #line 443 "parser.yy"
    5485     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), (yyvsp[(2) - (2)].en) ); }
     5486#line 446 "parser.yy"
     5487    { (yyval.en) = new CompositeExprNode2( build_sizeOf( (yyvsp[(2) - (2)].en) ) ); }
    54865488    break;
    54875489
     
    54895491
    54905492/* Line 1806 of yacc.c  */
    5491 #line 445 "parser.yy"
    5492     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( (yyvsp[(3) - (4)].decl) )); }
     5493#line 448 "parser.yy"
     5494    { (yyval.en) = new CompositeExprNode2( build_sizeOf( new TypeValueNode( (yyvsp[(3) - (4)].decl) ) ) ); }
    54935495    break;
    54945496
     
    54965498
    54975499/* Line 1806 of yacc.c  */
    5498 #line 447 "parser.yy"
    5499     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( (yyvsp[(3) - (6)].decl) ), new VarRefNode( (yyvsp[(5) - (6)].tok) )); }
     5500#line 450 "parser.yy"
     5501    { (yyval.en) = new CompositeExprNode2( build_offsetOf( new TypeValueNode( (yyvsp[(3) - (6)].decl) ), new VarRefNode( (yyvsp[(5) - (6)].tok) ) ) ); }
    55005502    break;
    55015503
     
    55035505
    55045506/* Line 1806 of yacc.c  */
    5505 #line 449 "parser.yy"
    5506     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (1)].tok) )); }
     5507#line 452 "parser.yy"
     5508    { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (1)].tok) ) ); }
    55075509    break;
    55085510
     
    55105512
    55115513/* Line 1806 of yacc.c  */
    5512 #line 451 "parser.yy"
    5513     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (4)].tok) ), new TypeValueNode( (yyvsp[(3) - (4)].decl) )); }
     5514#line 454 "parser.yy"
     5515    { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (4)].tok) ), new TypeValueNode( (yyvsp[(3) - (4)].decl) ) ); }
    55145516    break;
    55155517
     
    55175519
    55185520/* Line 1806 of yacc.c  */
    5519 #line 453 "parser.yy"
     5521#line 456 "parser.yy"
    55205522    { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ); }
    55215523    break;
     
    55245526
    55255527/* Line 1806 of yacc.c  */
    5526 #line 455 "parser.yy"
    5527     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), (yyvsp[(2) - (2)].en) ); }
     5528#line 458 "parser.yy"
     5529    { (yyval.en) = new CompositeExprNode2( build_alignOf( (yyvsp[(2) - (2)].en) ) ); }
    55285530    break;
    55295531
     
    55315533
    55325534/* Line 1806 of yacc.c  */
    5533 #line 457 "parser.yy"
    5534     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( (yyvsp[(3) - (4)].decl) ) ); }
     5535#line 460 "parser.yy"
     5536    { (yyval.en) = new CompositeExprNode2( build_alignOf( new TypeValueNode( (yyvsp[(3) - (4)].decl) ) ) ); }
    55355537    break;
    55365538
     
    55385540
    55395541/* Line 1806 of yacc.c  */
    5540 #line 463 "parser.yy"
    5541     { (yyval.en) = new OperatorNode( OperatorNode::PointTo ); }
     5542#line 466 "parser.yy"
     5543    { (yyval.op) = OperatorNode::PointTo; }
    55425544    break;
    55435545
     
    55455547
    55465548/* Line 1806 of yacc.c  */
    5547 #line 464 "parser.yy"
    5548     { (yyval.en) = new OperatorNode( OperatorNode::AddressOf ); }
     5549#line 467 "parser.yy"
     5550    { (yyval.op) = OperatorNode::AddressOf; }
    55495551    break;
    55505552
     
    55525554
    55535555/* Line 1806 of yacc.c  */
    5554 #line 466 "parser.yy"
    5555     { (yyval.en) = new OperatorNode( OperatorNode::And ); }
     5556#line 469 "parser.yy"
     5557    { (yyval.op) = OperatorNode::And; }
    55565558    break;
    55575559
     
    55595561
    55605562/* Line 1806 of yacc.c  */
    5561 #line 470 "parser.yy"
     5563#line 473 "parser.yy"
    55625564    { (yyval.en) = new OperatorNode( OperatorNode::UnPlus ); }
    55635565    break;
     
    55665568
    55675569/* Line 1806 of yacc.c  */
    5568 #line 471 "parser.yy"
     5570#line 474 "parser.yy"
    55695571    { (yyval.en) = new OperatorNode( OperatorNode::UnMinus ); }
    55705572    break;
     
    55735575
    55745576/* Line 1806 of yacc.c  */
    5575 #line 472 "parser.yy"
     5577#line 475 "parser.yy"
    55765578    { (yyval.en) = new OperatorNode( OperatorNode::Neg ); }
    55775579    break;
     
    55805582
    55815583/* Line 1806 of yacc.c  */
    5582 #line 473 "parser.yy"
     5584#line 476 "parser.yy"
    55835585    { (yyval.en) = new OperatorNode( OperatorNode::BitNeg ); }
    55845586    break;
     
    55875589
    55885590/* Line 1806 of yacc.c  */
    5589 #line 479 "parser.yy"
    5590     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Cast ), new TypeValueNode( (yyvsp[(2) - (4)].decl) ), (yyvsp[(4) - (4)].en) ); }
     5591#line 482 "parser.yy"
     5592    { (yyval.en) = new CompositeExprNode2( build_cast( new TypeValueNode( (yyvsp[(2) - (4)].decl) ), (yyvsp[(4) - (4)].en) ) ); }
    55915593    break;
    55925594
     
    55945596
    55955597/* Line 1806 of yacc.c  */
    5596 #line 481 "parser.yy"
    5597     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Cast ), new TypeValueNode( (yyvsp[(2) - (4)].decl) ), (yyvsp[(4) - (4)].en) ); }
     5598#line 484 "parser.yy"
     5599    { (yyval.en) = new CompositeExprNode2( build_cast( new TypeValueNode( (yyvsp[(2) - (4)].decl) ), (yyvsp[(4) - (4)].en) ) ); }
    55985600    break;
    55995601
     
    56015603
    56025604/* Line 1806 of yacc.c  */
    5603 #line 487 "parser.yy"
    5604     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Mul ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5605#line 490 "parser.yy"
     5606    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Mul, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56055607    break;
    56065608
     
    56085610
    56095611/* Line 1806 of yacc.c  */
    5610 #line 489 "parser.yy"
    5611     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Div ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5612#line 492 "parser.yy"
     5613    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Div, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56125614    break;
    56135615
     
    56155617
    56165618/* Line 1806 of yacc.c  */
    5617 #line 491 "parser.yy"
    5618     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Mod ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5619#line 494 "parser.yy"
     5620    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Mod, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56195621    break;
    56205622
     
    56225624
    56235625/* Line 1806 of yacc.c  */
    5624 #line 497 "parser.yy"
    5625     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Plus ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5626#line 500 "parser.yy"
     5627    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Plus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56265628    break;
    56275629
     
    56295631
    56305632/* Line 1806 of yacc.c  */
    5631 #line 499 "parser.yy"
    5632     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Minus ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5633#line 502 "parser.yy"
     5634    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Minus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56335635    break;
    56345636
     
    56365638
    56375639/* Line 1806 of yacc.c  */
    5638 #line 505 "parser.yy"
    5639     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::LShift ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5640#line 508 "parser.yy"
     5641    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::LShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56405642    break;
    56415643
     
    56435645
    56445646/* Line 1806 of yacc.c  */
    5645 #line 507 "parser.yy"
    5646     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::RShift ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5647#line 510 "parser.yy"
     5648    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::RShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56475649    break;
    56485650
     
    56505652
    56515653/* Line 1806 of yacc.c  */
    5652 #line 513 "parser.yy"
    5653     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::LThan ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5654#line 516 "parser.yy"
     5655    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56545656    break;
    56555657
     
    56575659
    56585660/* Line 1806 of yacc.c  */
    5659 #line 515 "parser.yy"
    5660     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::GThan ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5661#line 518 "parser.yy"
     5662    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56615663    break;
    56625664
     
    56645666
    56655667/* Line 1806 of yacc.c  */
    5666 #line 517 "parser.yy"
    5667     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::LEThan ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5668#line 520 "parser.yy"
     5669    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56685670    break;
    56695671
     
    56715673
    56725674/* Line 1806 of yacc.c  */
    5673 #line 519 "parser.yy"
    5674     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::GEThan ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5675#line 522 "parser.yy"
     5676    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::GEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56755677    break;
    56765678
     
    56785680
    56795681/* Line 1806 of yacc.c  */
    5680 #line 525 "parser.yy"
    5681     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Eq ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5682#line 528 "parser.yy"
     5683    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Eq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56825684    break;
    56835685
     
    56855687
    56865688/* Line 1806 of yacc.c  */
    5687 #line 527 "parser.yy"
    5688     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Neq ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5689#line 530 "parser.yy"
     5690    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Neq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56895691    break;
    56905692
     
    56925694
    56935695/* Line 1806 of yacc.c  */
    5694 #line 533 "parser.yy"
    5695     { (yyval.en) =new CompositeExprNode( new OperatorNode( OperatorNode::BitAnd ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5696#line 536 "parser.yy"
     5697    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::BitAnd, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56965698    break;
    56975699
     
    56995701
    57005702/* Line 1806 of yacc.c  */
    5701 #line 539 "parser.yy"
    5702     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Xor ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5703#line 542 "parser.yy"
     5704    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Xor, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    57035705    break;
    57045706
     
    57065708
    57075709/* Line 1806 of yacc.c  */
    5708 #line 545 "parser.yy"
    5709     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::BitOr ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5710#line 548 "parser.yy"
     5711    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::BitOr, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    57105712    break;
    57115713
     
    57135715
    57145716/* Line 1806 of yacc.c  */
    5715 #line 551 "parser.yy"
    5716     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::And ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5717#line 554 "parser.yy"
     5718    { (yyval.en) = new CompositeExprNode2( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), true ) ); }
    57175719    break;
    57185720
     
    57205722
    57215723/* Line 1806 of yacc.c  */
    5722 #line 557 "parser.yy"
    5723     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Or ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5724#line 560 "parser.yy"
     5725    { (yyval.en) = new CompositeExprNode2( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), false ) ); }
    57245726    break;
    57255727
     
    57275729
    57285730/* Line 1806 of yacc.c  */
    5729 #line 563 "parser.yy"
    5730     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Cond ), (ExpressionNode *)mkList( (*(yyvsp[(1) - (5)].en), *(yyvsp[(3) - (5)].en), *(yyvsp[(5) - (5)].en) ) ) ); }
     5731#line 567 "parser.yy"
     5732    { (yyval.en) = new CompositeExprNode2( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); }
    57315733    break;
    57325734
     
    57345736
    57355737/* Line 1806 of yacc.c  */
    5736 #line 565 "parser.yy"
    5737     { (yyval.en)=new CompositeExprNode( new OperatorNode( OperatorNode::NCond ), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ); }
     5738#line 569 "parser.yy"
     5739    { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::NCond ), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ); }
    57385740    break;
    57395741
     
    57415743
    57425744/* Line 1806 of yacc.c  */
    5743 #line 567 "parser.yy"
    5744     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Cond ), (ExpressionNode *)mkList( (*(yyvsp[(1) - (5)].en), *(yyvsp[(3) - (5)].en), *(yyvsp[(5) - (5)].en) ) ) ); }
     5745#line 571 "parser.yy"
     5746    { (yyval.en) = new CompositeExprNode2( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); }
    57455747    break;
    57465748
     
    57485750
    57495751/* Line 1806 of yacc.c  */
    5750 #line 578 "parser.yy"
    5751     { (yyval.en) =new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5752#line 582 "parser.yy"
     5753    { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
    57525754    break;
    57535755
     
    57555757
    57565758/* Line 1806 of yacc.c  */
    5757 #line 580 "parser.yy"
    5758     { (yyval.en) =new CompositeExprNode( (yyvsp[(2) - (3)].en), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5759#line 584 "parser.yy"
     5760    { (yyval.en) = new CompositeExprNode( (yyvsp[(2) - (3)].en), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
    57595761    break;
    57605762
     
    57625764
    57635765/* Line 1806 of yacc.c  */
    5764 #line 582 "parser.yy"
     5766#line 586 "parser.yy"
    57655767    { (yyval.en) = ( (yyvsp[(2) - (2)].en) == 0 ) ? (yyvsp[(1) - (2)].en) : new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), (yyvsp[(1) - (2)].en), (yyvsp[(2) - (2)].en) ); }
    57665768    break;
     
    57695771
    57705772/* Line 1806 of yacc.c  */
    5771 #line 587 "parser.yy"
     5773#line 591 "parser.yy"
    57725774    { (yyval.en) = new NullExprNode; }
    57735775    break;
     
    57765778
    57775779/* Line 1806 of yacc.c  */
    5778 #line 595 "parser.yy"
     5780#line 599 "parser.yy"
    57795781    { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ) ); }
    57805782    break;
     
    57835785
    57845786/* Line 1806 of yacc.c  */
    5785 #line 597 "parser.yy"
     5787#line 601 "parser.yy"
    57865788    { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (yyvsp[(3) - (5)].en) ); }
    57875789    break;
     
    57905792
    57915793/* Line 1806 of yacc.c  */
    5792 #line 599 "parser.yy"
     5794#line 603 "parser.yy"
    57935795    { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(new NullExprNode)->set_link( (yyvsp[(4) - (6)].en) ) ); }
    57945796    break;
     
    57975799
    57985800/* Line 1806 of yacc.c  */
    5799 #line 601 "parser.yy"
     5801#line 605 "parser.yy"
    58005802    { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(yyvsp[(3) - (7)].en)->set_link( flattenCommas( (yyvsp[(5) - (7)].en) ) ) ); }
    58015803    break;
     
    58045806
    58055807/* Line 1806 of yacc.c  */
    5806 #line 607 "parser.yy"
     5808#line 611 "parser.yy"
    58075809    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) ); }
    58085810    break;
     
    58115813
    58125814/* Line 1806 of yacc.c  */
    5813 #line 611 "parser.yy"
     5815#line 615 "parser.yy"
    58145816    { (yyval.en) = new OperatorNode( OperatorNode::MulAssn ); }
    58155817    break;
     
    58185820
    58195821/* Line 1806 of yacc.c  */
    5820 #line 612 "parser.yy"
     5822#line 616 "parser.yy"
    58215823    { (yyval.en) = new OperatorNode( OperatorNode::DivAssn ); }
    58225824    break;
     
    58255827
    58265828/* Line 1806 of yacc.c  */
    5827 #line 613 "parser.yy"
     5829#line 617 "parser.yy"
    58285830    { (yyval.en) = new OperatorNode( OperatorNode::ModAssn ); }
    58295831    break;
     
    58325834
    58335835/* Line 1806 of yacc.c  */
    5834 #line 614 "parser.yy"
     5836#line 618 "parser.yy"
    58355837    { (yyval.en) = new OperatorNode( OperatorNode::PlusAssn ); }
    58365838    break;
     
    58395841
    58405842/* Line 1806 of yacc.c  */
    5841 #line 615 "parser.yy"
     5843#line 619 "parser.yy"
    58425844    { (yyval.en) = new OperatorNode( OperatorNode::MinusAssn ); }
    58435845    break;
     
    58465848
    58475849/* Line 1806 of yacc.c  */
    5848 #line 616 "parser.yy"
     5850#line 620 "parser.yy"
    58495851    { (yyval.en) = new OperatorNode( OperatorNode::LSAssn ); }
    58505852    break;
     
    58535855
    58545856/* Line 1806 of yacc.c  */
    5855 #line 617 "parser.yy"
     5857#line 621 "parser.yy"
    58565858    { (yyval.en) = new OperatorNode( OperatorNode::RSAssn ); }
    58575859    break;
     
    58605862
    58615863/* Line 1806 of yacc.c  */
    5862 #line 618 "parser.yy"
     5864#line 622 "parser.yy"
    58635865    { (yyval.en) = new OperatorNode( OperatorNode::AndAssn ); }
    58645866    break;
     
    58675869
    58685870/* Line 1806 of yacc.c  */
    5869 #line 619 "parser.yy"
     5871#line 623 "parser.yy"
    58705872    { (yyval.en) = new OperatorNode( OperatorNode::ERAssn ); }
    58715873    break;
     
    58745876
    58755877/* Line 1806 of yacc.c  */
    5876 #line 620 "parser.yy"
     5878#line 624 "parser.yy"
    58775879    { (yyval.en) = new OperatorNode( OperatorNode::OrAssn ); }
    58785880    break;
     
    58815883
    58825884/* Line 1806 of yacc.c  */
    5883 #line 626 "parser.yy"
    5884     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Comma ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     5885#line 631 "parser.yy"
     5886    { (yyval.en) = new CompositeExprNode2( build_comma( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    58855887    break;
    58865888
     
    58885890
    58895891/* Line 1806 of yacc.c  */
    5890 #line 631 "parser.yy"
     5892#line 636 "parser.yy"
    58915893    { (yyval.en) = 0; }
    58925894    break;
     
    58955897
    58965898/* Line 1806 of yacc.c  */
    5897 #line 640 "parser.yy"
     5899#line 645 "parser.yy"
    58985900    { (yyval.sn) = (yyvsp[(1) - (1)].sn); }
    58995901    break;
     
    59025904
    59035905/* Line 1806 of yacc.c  */
    5904 #line 647 "parser.yy"
     5906#line 652 "parser.yy"
    59055907    {
    59065908                        Token fn; fn.str = new std::string( "^?{}" ); // location undefined
     
    59135915
    59145916/* Line 1806 of yacc.c  */
    5915 #line 657 "parser.yy"
     5917#line 662 "parser.yy"
    59165918    {
    59175919                        (yyval.sn) = (yyvsp[(4) - (4)].sn)->add_label( (yyvsp[(1) - (4)].tok) );
     
    59225924
    59235925/* Line 1806 of yacc.c  */
    5924 #line 664 "parser.yy"
     5926#line 669 "parser.yy"
    59255927    { (yyval.sn) = new CompoundStmtNode( (StatementNode *)0 ); }
    59265928    break;
     
    59295931
    59305932/* Line 1806 of yacc.c  */
    5931 #line 671 "parser.yy"
     5933#line 676 "parser.yy"
    59325934    { (yyval.sn) = new CompoundStmtNode( (yyvsp[(5) - (7)].sn) ); }
    59335935    break;
     
    59365938
    59375939/* Line 1806 of yacc.c  */
    5938 #line 677 "parser.yy"
     5940#line 682 "parser.yy"
    59395941    { if ( (yyvsp[(1) - (3)].sn) != 0 ) { (yyvsp[(1) - (3)].sn)->set_link( (yyvsp[(3) - (3)].sn) ); (yyval.sn) = (yyvsp[(1) - (3)].sn); } }
    59405942    break;
     
    59435945
    59445946/* Line 1806 of yacc.c  */
    5945 #line 682 "parser.yy"
     5947#line 687 "parser.yy"
    59465948    { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }
    59475949    break;
     
    59505952
    59515953/* Line 1806 of yacc.c  */
    5952 #line 684 "parser.yy"
     5954#line 689 "parser.yy"
    59535955    {   // mark all fields in list
    59545956                        for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != NULL; iter = (DeclarationNode *)iter->get_link() )
     
    59615963
    59625964/* Line 1806 of yacc.c  */
    5963 #line 690 "parser.yy"
     5965#line 695 "parser.yy"
    59645966    { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }
    59655967    break;
     
    59685970
    59695971/* Line 1806 of yacc.c  */
    5970 #line 697 "parser.yy"
     5972#line 702 "parser.yy"
    59715973    { if ( (yyvsp[(1) - (2)].sn) != 0 ) { (yyvsp[(1) - (2)].sn)->set_link( (yyvsp[(2) - (2)].sn) ); (yyval.sn) = (yyvsp[(1) - (2)].sn); } }
    59725974    break;
     
    59755977
    59765978/* Line 1806 of yacc.c  */
    5977 #line 702 "parser.yy"
     5979#line 707 "parser.yy"
    59785980    { (yyval.sn) = new StatementNode( StatementNode::Exp, (yyvsp[(1) - (2)].en), 0 ); }
    59795981    break;
     
    59825984
    59835985/* Line 1806 of yacc.c  */
    5984 #line 708 "parser.yy"
     5986#line 713 "parser.yy"
    59855987    { (yyval.sn) = new StatementNode( StatementNode::If, (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ); }
    59865988    break;
     
    59895991
    59905992/* Line 1806 of yacc.c  */
    5991 #line 710 "parser.yy"
     5993#line 715 "parser.yy"
    59925994    { (yyval.sn) = new StatementNode( StatementNode::If, (yyvsp[(3) - (7)].en), (StatementNode *)mkList((*(yyvsp[(5) - (7)].sn), *(yyvsp[(7) - (7)].sn) )) ); }
    59935995    break;
     
    59965998
    59975999/* Line 1806 of yacc.c  */
    5998 #line 712 "parser.yy"
     6000#line 717 "parser.yy"
    59996001    { (yyval.sn) = new StatementNode( StatementNode::Switch, (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ); }
    60006002    break;
     
    60036005
    60046006/* Line 1806 of yacc.c  */
    6005 #line 714 "parser.yy"
     6007#line 719 "parser.yy"
    60066008    {
    60076009                        StatementNode *sw = new StatementNode( StatementNode::Switch, (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) );
     
    60096011                        // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound
    60106012                        // statement around the switch.  Statements after the initial declaration list can never be executed, and
    6011                         // therefore, are removed from the grammar even though C allows it. Change also applies to choose statement.
     6013                        // therefore, are removed from the grammar even though C allows it. The change also applies to choose
     6014                        // statement.
    60126015                        (yyval.sn) = (yyvsp[(7) - (9)].decl) != 0 ? new CompoundStmtNode( (StatementNode *)((new StatementNode( (yyvsp[(7) - (9)].decl) ))->set_link( sw )) ) : sw;
    60136016                }
     
    60176020
    60186021/* Line 1806 of yacc.c  */
    6019 #line 723 "parser.yy"
     6022#line 729 "parser.yy"
    60206023    { (yyval.sn) = new StatementNode( StatementNode::Switch, (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ); }
    60216024    break;
     
    60246027
    60256028/* Line 1806 of yacc.c  */
    6026 #line 725 "parser.yy"
     6029#line 731 "parser.yy"
    60276030    {
    60286031                        StatementNode *sw = new StatementNode( StatementNode::Switch, (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) );
     
    60346037
    60356038/* Line 1806 of yacc.c  */
    6036 #line 735 "parser.yy"
     6039#line 741 "parser.yy"
    60376040    { (yyval.en) = (yyvsp[(1) - (1)].en); }
    60386041    break;
     
    60416044
    60426045/* Line 1806 of yacc.c  */
    6043 #line 737 "parser.yy"
    6044     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Range ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     6046#line 743 "parser.yy"
     6047    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Range, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
     6048    break;
     6049
     6050  case 162:
     6051
     6052/* Line 1806 of yacc.c  */
     6053#line 748 "parser.yy"
     6054    { (yyval.sn) = new StatementNode( StatementNode::Case, (yyvsp[(1) - (1)].en), 0 ); }
    60456055    break;
    60466056
     
    60486058
    60496059/* Line 1806 of yacc.c  */
    6050 #line 744 "parser.yy"
    6051     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(tupleContents( (yyvsp[(1) - (3)].en) ))->set_link( (yyvsp[(3) - (3)].en) ) ); }
     6060#line 750 "parser.yy"
     6061    { (yyval.sn) = (StatementNode *)((yyvsp[(1) - (3)].sn)->set_link( new StatementNode( StatementNode::Case, (yyvsp[(3) - (3)].en), 0 ) ) ); }
    60526062    break;
    60536063
     
    60556065
    60566066/* Line 1806 of yacc.c  */
    6057 #line 748 "parser.yy"
    6058     { (yyval.sn) = new StatementNode( StatementNode::Case, (yyvsp[(2) - (3)].en), 0 ); }
     6067#line 754 "parser.yy"
     6068    { (yyval.sn) = (yyvsp[(2) - (3)].sn); }
    60596069    break;
    60606070
     
    60626072
    60636073/* Line 1806 of yacc.c  */
    6064 #line 749 "parser.yy"
     6074#line 755 "parser.yy"
    60656075    { (yyval.sn) = new StatementNode( StatementNode::Default ); }
    60666076    break;
     
    60696079
    60706080/* Line 1806 of yacc.c  */
    6071 #line 755 "parser.yy"
     6081#line 761 "parser.yy"
    60726082    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (2)].sn)->set_link( (yyvsp[(2) - (2)].sn) )); }
    60736083    break;
     
    60766086
    60776087/* Line 1806 of yacc.c  */
    6078 #line 759 "parser.yy"
     6088#line 765 "parser.yy"
    60796089    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new CompoundStmtNode( (yyvsp[(2) - (2)].sn) ) ); }
    60806090    break;
     
    60836093
    60846094/* Line 1806 of yacc.c  */
    6085 #line 764 "parser.yy"
     6095#line 770 "parser.yy"
    60866096    { (yyval.sn) = 0; }
    60876097    break;
     
    60906100
    60916101/* Line 1806 of yacc.c  */
    6092 #line 770 "parser.yy"
     6102#line 776 "parser.yy"
    60936103    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new CompoundStmtNode( (yyvsp[(2) - (2)].sn) ) ); }
    60946104    break;
     
    60976107
    60986108/* Line 1806 of yacc.c  */
    6099 #line 772 "parser.yy"
     6109#line 778 "parser.yy"
    61006110    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_link( (yyvsp[(2) - (3)].sn)->append_last_case( new CompoundStmtNode( (yyvsp[(3) - (3)].sn) ) ) ) ); }
    61016111    break;
     
    61046114
    61056115/* Line 1806 of yacc.c  */
    6106 #line 777 "parser.yy"
     6116#line 783 "parser.yy"
    61076117    { (yyval.sn) = 0; }
    61086118    break;
     
    61116121
    61126122/* Line 1806 of yacc.c  */
    6113 #line 783 "parser.yy"
     6123#line 789 "parser.yy"
    61146124    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); }
    61156125    break;
     
    61186128
    61196129/* Line 1806 of yacc.c  */
    6120 #line 785 "parser.yy"
     6130#line 791 "parser.yy"
    61216131    { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new CompoundStmtNode( (StatementNode *)mkList( (*(yyvsp[(2) - (3)].sn), *(yyvsp[(3) - (3)].sn) ) ) ) ); }
    61226132    break;
     
    61256135
    61266136/* Line 1806 of yacc.c  */
    6127 #line 787 "parser.yy"
     6137#line 793 "parser.yy"
    61286138    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_link( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); }
    61296139    break;
     
    61326142
    61336143/* Line 1806 of yacc.c  */
    6134 #line 789 "parser.yy"
     6144#line 795 "parser.yy"
    61356145    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (4)].sn)->set_link( (yyvsp[(2) - (4)].sn)->append_last_case( new CompoundStmtNode( (StatementNode *)mkList( (*(yyvsp[(3) - (4)].sn), *(yyvsp[(4) - (4)].sn) ) ) ) ) ) ); }
    61366146    break;
     
    61396149
    61406150/* Line 1806 of yacc.c  */
    6141 #line 794 "parser.yy"
     6151#line 800 "parser.yy"
    61426152    { (yyval.sn) = new StatementNode( StatementNode::Break ); }
    61436153    break;
     
    61466156
    61476157/* Line 1806 of yacc.c  */
    6148 #line 800 "parser.yy"
     6158#line 806 "parser.yy"
    61496159    { (yyval.sn) = 0; }
    61506160    break;
     
    61536163
    61546164/* Line 1806 of yacc.c  */
    6155 #line 802 "parser.yy"
     6165#line 808 "parser.yy"
    61566166    { (yyval.sn) = 0; }
    61576167    break;
     
    61606170
    61616171/* Line 1806 of yacc.c  */
    6162 #line 807 "parser.yy"
     6172#line 813 "parser.yy"
    61636173    { (yyval.sn) = new StatementNode( StatementNode::While, (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ); }
    61646174    break;
     
    61676177
    61686178/* Line 1806 of yacc.c  */
    6169 #line 809 "parser.yy"
     6179#line 815 "parser.yy"
    61706180    { (yyval.sn) = new StatementNode( StatementNode::Do, (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn) ); }
    61716181    break;
     
    61746184
    61756185/* Line 1806 of yacc.c  */
    6176 #line 811 "parser.yy"
     6186#line 817 "parser.yy"
    61776187    { (yyval.sn) = new StatementNode( StatementNode::For, (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].sn) ); }
    61786188    break;
     
    61816191
    61826192/* Line 1806 of yacc.c  */
    6183 #line 816 "parser.yy"
     6193#line 822 "parser.yy"
    61846194    { (yyval.en) = new ForCtlExprNode( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); }
    61856195    break;
     
    61886198
    61896199/* Line 1806 of yacc.c  */
    6190 #line 818 "parser.yy"
     6200#line 824 "parser.yy"
    61916201    { (yyval.en) = new ForCtlExprNode( (yyvsp[(1) - (4)].decl), (yyvsp[(2) - (4)].en), (yyvsp[(4) - (4)].en) ); }
    61926202    break;
     
    61956205
    61966206/* Line 1806 of yacc.c  */
    6197 #line 823 "parser.yy"
     6207#line 829 "parser.yy"
    61986208    { (yyval.sn) = new StatementNode( StatementNode::Goto, (yyvsp[(2) - (3)].tok) ); }
    61996209    break;
     
    62026212
    62036213/* Line 1806 of yacc.c  */
    6204 #line 827 "parser.yy"
     6214#line 833 "parser.yy"
    62056215    { (yyval.sn) = new StatementNode( StatementNode::Goto, (yyvsp[(3) - (4)].en) ); }
    62066216    break;
     
    62096219
    62106220/* Line 1806 of yacc.c  */
    6211 #line 830 "parser.yy"
     6221#line 836 "parser.yy"
    62126222    { (yyval.sn) = new StatementNode( StatementNode::Continue ); }
    62136223    break;
     
    62166226
    62176227/* Line 1806 of yacc.c  */
    6218 #line 834 "parser.yy"
     6228#line 840 "parser.yy"
    62196229    { (yyval.sn) = new StatementNode( StatementNode::Continue, (yyvsp[(2) - (3)].tok) ); }
    62206230    break;
     
    62236233
    62246234/* Line 1806 of yacc.c  */
    6225 #line 837 "parser.yy"
     6235#line 843 "parser.yy"
    62266236    { (yyval.sn) = new StatementNode( StatementNode::Break ); }
    62276237    break;
     
    62306240
    62316241/* Line 1806 of yacc.c  */
    6232 #line 841 "parser.yy"
     6242#line 847 "parser.yy"
    62336243    { (yyval.sn) = new StatementNode( StatementNode::Break, (yyvsp[(2) - (3)].tok) ); }
    62346244    break;
     
    62376247
    62386248/* Line 1806 of yacc.c  */
    6239 #line 843 "parser.yy"
     6249#line 849 "parser.yy"
    62406250    { (yyval.sn) = new StatementNode( StatementNode::Return, (yyvsp[(2) - (3)].en), 0 ); }
    62416251    break;
     
    62446254
    62456255/* Line 1806 of yacc.c  */
    6246 #line 845 "parser.yy"
     6256#line 851 "parser.yy"
    62476257    { (yyval.sn) = new StatementNode( StatementNode::Throw, (yyvsp[(2) - (3)].en), 0 ); }
    62486258    break;
     
    62516261
    62526262/* Line 1806 of yacc.c  */
    6253 #line 849 "parser.yy"
     6263#line 855 "parser.yy"
    62546264    { (yyval.sn) = new StatementNode( StatementNode::Throw, (yyvsp[(2) - (3)].en), 0 ); }
    62556265    break;
     
    62586268
    62596269/* Line 1806 of yacc.c  */
    6260 #line 851 "parser.yy"
     6270#line 857 "parser.yy"
    62616271    { (yyval.sn) = new StatementNode( StatementNode::Throw, (yyvsp[(2) - (5)].en), 0 ); }
    62626272    break;
     
    62656275
    62666276/* Line 1806 of yacc.c  */
    6267 #line 858 "parser.yy"
     6277#line 864 "parser.yy"
    62686278    { (yyval.sn) = new StatementNode( StatementNode::Try, 0,(StatementNode *)(mkList((*(yyvsp[(2) - (3)].sn),*(yyvsp[(3) - (3)].pn) )))); }
    62696279    break;
     
    62726282
    62736283/* Line 1806 of yacc.c  */
    6274 #line 860 "parser.yy"
     6284#line 866 "parser.yy"
    62756285    { (yyval.sn) = new StatementNode( StatementNode::Try, 0,(StatementNode *)(mkList((*(yyvsp[(2) - (3)].sn),*(yyvsp[(3) - (3)].pn) )))); }
    62766286    break;
     
    62796289
    62806290/* Line 1806 of yacc.c  */
    6281 #line 862 "parser.yy"
     6291#line 868 "parser.yy"
    62826292    {
    62836293                        (yyvsp[(3) - (4)].pn)->set_link( (yyvsp[(4) - (4)].pn) );
     
    62896299
    62906300/* Line 1806 of yacc.c  */
    6291 #line 873 "parser.yy"
     6301#line 879 "parser.yy"
    62926302    { (yyval.pn) = StatementNode::newCatchStmt( 0, (yyvsp[(5) - (5)].sn), true ); }
    62936303    break;
     
    62966306
    62976307/* Line 1806 of yacc.c  */
    6298 #line 875 "parser.yy"
     6308#line 881 "parser.yy"
    62996309    { (yyval.pn) = (yyvsp[(1) - (6)].pn)->set_link( StatementNode::newCatchStmt( 0, (yyvsp[(6) - (6)].sn), true ) ); }
    63006310    break;
     
    63036313
    63046314/* Line 1806 of yacc.c  */
    6305 #line 877 "parser.yy"
     6315#line 883 "parser.yy"
    63066316    { (yyval.pn) = StatementNode::newCatchStmt( 0, (yyvsp[(5) - (5)].sn), true ); }
    63076317    break;
     
    63106320
    63116321/* Line 1806 of yacc.c  */
    6312 #line 879 "parser.yy"
     6322#line 885 "parser.yy"
    63136323    { (yyval.pn) = (yyvsp[(1) - (6)].pn)->set_link( StatementNode::newCatchStmt( 0, (yyvsp[(6) - (6)].sn), true ) ); }
    63146324    break;
     
    63176327
    63186328/* Line 1806 of yacc.c  */
    6319 #line 884 "parser.yy"
     6329#line 890 "parser.yy"
    63206330    { (yyval.pn) = StatementNode::newCatchStmt( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ); }
    63216331    break;
     
    63246334
    63256335/* Line 1806 of yacc.c  */
    6326 #line 886 "parser.yy"
     6336#line 892 "parser.yy"
    63276337    { (yyval.pn) = (yyvsp[(1) - (10)].pn)->set_link( StatementNode::newCatchStmt( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ); }
    63286338    break;
     
    63316341
    63326342/* Line 1806 of yacc.c  */
    6333 #line 888 "parser.yy"
     6343#line 894 "parser.yy"
    63346344    { (yyval.pn) = StatementNode::newCatchStmt( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ); }
    63356345    break;
     
    63386348
    63396349/* Line 1806 of yacc.c  */
    6340 #line 890 "parser.yy"
     6350#line 896 "parser.yy"
    63416351    { (yyval.pn) = (yyvsp[(1) - (10)].pn)->set_link( StatementNode::newCatchStmt( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ); }
    63426352    break;
     
    63456355
    63466356/* Line 1806 of yacc.c  */
    6347 #line 895 "parser.yy"
     6357#line 901 "parser.yy"
    63486358    {
    63496359                        (yyval.pn) = new StatementNode( StatementNode::Finally, 0, (yyvsp[(2) - (2)].sn) );
     
    63556365
    63566366/* Line 1806 of yacc.c  */
    6357 #line 909 "parser.yy"
     6367#line 915 "parser.yy"
    63586368    {
    63596369                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    63656375
    63666376/* Line 1806 of yacc.c  */
    6367 #line 914 "parser.yy"
     6377#line 920 "parser.yy"
    63686378    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    63696379    break;
     
    63726382
    63736383/* Line 1806 of yacc.c  */
    6374 #line 916 "parser.yy"
     6384#line 922 "parser.yy"
    63756385    {
    63766386                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    63826392
    63836393/* Line 1806 of yacc.c  */
    6384 #line 925 "parser.yy"
     6394#line 931 "parser.yy"
    63856395    { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (6)].flag), (yyvsp[(4) - (6)].constant), 0 ); }
    63866396    break;
     
    63896399
    63906400/* Line 1806 of yacc.c  */
    6391 #line 927 "parser.yy"
     6401#line 933 "parser.yy"
    63926402    { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ); }
    63936403    break;
     
    63966406
    63976407/* Line 1806 of yacc.c  */
    6398 #line 929 "parser.yy"
     6408#line 935 "parser.yy"
    63996409    { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ); }
    64006410    break;
     
    64036413
    64046414/* Line 1806 of yacc.c  */
    6405 #line 931 "parser.yy"
     6415#line 937 "parser.yy"
    64066416    { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].constant) ); }
    64076417    break;
     
    64106420
    64116421/* Line 1806 of yacc.c  */
    6412 #line 933 "parser.yy"
     6422#line 939 "parser.yy"
    64136423    { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (14)].flag), (yyvsp[(5) - (14)].constant), 0, (yyvsp[(8) - (14)].en), (yyvsp[(10) - (14)].constant), (yyvsp[(12) - (14)].label) ); }
    64146424    break;
     
    64176427
    64186428/* Line 1806 of yacc.c  */
    6419 #line 938 "parser.yy"
     6429#line 944 "parser.yy"
    64206430    { (yyval.flag) = false; }
    64216431    break;
     
    64246434
    64256435/* Line 1806 of yacc.c  */
    6426 #line 940 "parser.yy"
     6436#line 946 "parser.yy"
    64276437    { (yyval.flag) = true; }
    64286438    break;
     
    64316441
    64326442/* Line 1806 of yacc.c  */
    6433 #line 945 "parser.yy"
     6443#line 951 "parser.yy"
    64346444    { (yyval.en) = 0; }
    64356445    break;
     
    64386448
    64396449/* Line 1806 of yacc.c  */
    6440 #line 952 "parser.yy"
     6450#line 958 "parser.yy"
    64416451    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) ); }
    64426452    break;
     
    64456455
    64466456/* Line 1806 of yacc.c  */
    6447 #line 957 "parser.yy"
     6457#line 963 "parser.yy"
    64486458    { (yyval.en) = new AsmExprNode( 0, (yyvsp[(1) - (4)].constant), (yyvsp[(3) - (4)].en) ); }
    64496459    break;
     
    64526462
    64536463/* Line 1806 of yacc.c  */
    6454 #line 959 "parser.yy"
     6464#line 965 "parser.yy"
    64556465    { (yyval.en) = new AsmExprNode( (yyvsp[(2) - (7)].en), (yyvsp[(4) - (7)].constant), (yyvsp[(6) - (7)].en) ); }
    64566466    break;
     
    64596469
    64606470/* Line 1806 of yacc.c  */
    6461 #line 964 "parser.yy"
     6471#line 970 "parser.yy"
    64626472    { (yyval.constant) = 0; }
    64636473    break;
     
    64666476
    64676477/* Line 1806 of yacc.c  */
    6468 #line 966 "parser.yy"
     6478#line 972 "parser.yy"
    64696479    { (yyval.constant) = (yyvsp[(1) - (1)].constant); }
    64706480    break;
     
    64736483
    64746484/* Line 1806 of yacc.c  */
    6475 #line 968 "parser.yy"
     6485#line 974 "parser.yy"
    64766486    { (yyval.constant) = (ConstantNode *)(yyvsp[(1) - (3)].constant)->set_link( (yyvsp[(3) - (3)].constant) ); }
    64776487    break;
     
    64806490
    64816491/* Line 1806 of yacc.c  */
    6482 #line 973 "parser.yy"
     6492#line 979 "parser.yy"
    64836493    { (yyval.label) = new LabelNode(); (yyval.label)->append_label( (yyvsp[(1) - (1)].tok) ); }
    64846494    break;
     
    64876497
    64886498/* Line 1806 of yacc.c  */
    6489 #line 975 "parser.yy"
     6499#line 981 "parser.yy"
    64906500    { (yyval.label) = (yyvsp[(1) - (3)].label); (yyvsp[(1) - (3)].label)->append_label( (yyvsp[(3) - (3)].tok) ); }
    64916501    break;
     
    64946504
    64956505/* Line 1806 of yacc.c  */
    6496 #line 982 "parser.yy"
     6506#line 988 "parser.yy"
    64976507    { (yyval.decl) = 0; }
    64986508    break;
     
    65016511
    65026512/* Line 1806 of yacc.c  */
    6503 #line 989 "parser.yy"
     6513#line 995 "parser.yy"
    65046514    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    65056515    break;
     
    65086518
    65096519/* Line 1806 of yacc.c  */
    6510 #line 994 "parser.yy"
     6520#line 1000 "parser.yy"
    65116521    { (yyval.decl) = 0; }
    65126522    break;
     
    65156525
    65166526/* Line 1806 of yacc.c  */
    6517 #line 1001 "parser.yy"
     6527#line 1007 "parser.yy"
    65186528    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    65196529    break;
     
    65226532
    65236533/* Line 1806 of yacc.c  */
    6524 #line 1015 "parser.yy"
     6534#line 1021 "parser.yy"
    65256535    {}
    65266536    break;
     
    65296539
    65306540/* Line 1806 of yacc.c  */
    6531 #line 1016 "parser.yy"
     6541#line 1022 "parser.yy"
    65326542    {}
    65336543    break;
     
    65366546
    65376547/* Line 1806 of yacc.c  */
    6538 #line 1045 "parser.yy"
     6548#line 1051 "parser.yy"
    65396549    {
    65406550                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    65466556
    65476557/* Line 1806 of yacc.c  */
    6548 #line 1052 "parser.yy"
     6558#line 1058 "parser.yy"
    65496559    {
    65506560                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    65566566
    65576567/* Line 1806 of yacc.c  */
    6558 #line 1057 "parser.yy"
     6568#line 1063 "parser.yy"
    65596569    {
    65606570                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (6)].tok), TypedefTable::ID );
     
    65666576
    65676577/* Line 1806 of yacc.c  */
    6568 #line 1067 "parser.yy"
     6578#line 1073 "parser.yy"
    65696579    {
    65706580                        typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) );
     
    65766586
    65776587/* Line 1806 of yacc.c  */
    6578 #line 1072 "parser.yy"
     6588#line 1078 "parser.yy"
    65796589    {
    65806590                        typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) );
     
    65866596
    65876597/* Line 1806 of yacc.c  */
    6588 #line 1077 "parser.yy"
     6598#line 1083 "parser.yy"
    65896599    {
    65906600                        typedefTable.setNextIdentifier( *(yyvsp[(3) - (4)].tok) );
     
    65966606
    65976607/* Line 1806 of yacc.c  */
    6598 #line 1085 "parser.yy"
     6608#line 1091 "parser.yy"
    65996609    {
    66006610                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    66066616
    66076617/* Line 1806 of yacc.c  */
    6608 #line 1090 "parser.yy"
     6618#line 1096 "parser.yy"
    66096619    {
    66106620                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    66166626
    66176627/* Line 1806 of yacc.c  */
    6618 #line 1095 "parser.yy"
     6628#line 1101 "parser.yy"
    66196629    {
    66206630                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    66266636
    66276637/* Line 1806 of yacc.c  */
    6628 #line 1100 "parser.yy"
     6638#line 1106 "parser.yy"
    66296639    {
    66306640                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    66366646
    66376647/* Line 1806 of yacc.c  */
    6638 #line 1105 "parser.yy"
     6648#line 1111 "parser.yy"
    66396649    {
    66406650                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::ID );
     
    66466656
    66476657/* Line 1806 of yacc.c  */
    6648 #line 1113 "parser.yy"
     6658#line 1119 "parser.yy"
    66496659    {
    66506660                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(3) - (8)].tok), DeclarationNode::newTuple( 0 ), (yyvsp[(6) - (8)].decl), 0, true );
     
    66556665
    66566666/* Line 1806 of yacc.c  */
    6657 #line 1136 "parser.yy"
     6667#line 1142 "parser.yy"
    66586668    {
    66596669                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true );
     
    66646674
    66656675/* Line 1806 of yacc.c  */
    6666 #line 1140 "parser.yy"
     6676#line 1146 "parser.yy"
    66676677    {
    66686678                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true );
     
    66736683
    66746684/* Line 1806 of yacc.c  */
    6675 #line 1147 "parser.yy"
     6685#line 1153 "parser.yy"
    66766686    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); }
    66776687    break;
     
    66806690
    66816691/* Line 1806 of yacc.c  */
    6682 #line 1151 "parser.yy"
     6692#line 1157 "parser.yy"
    66836693    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (9)].decl)->appendList( (yyvsp[(7) - (9)].decl) ) ); }
    66846694    break;
     
    66876697
    66886698/* Line 1806 of yacc.c  */
    6689 #line 1156 "parser.yy"
     6699#line 1162 "parser.yy"
    66906700    {
    66916701                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    66976707
    66986708/* Line 1806 of yacc.c  */
    6699 #line 1161 "parser.yy"
     6709#line 1167 "parser.yy"
    67006710    {
    67016711                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    67076717
    67086718/* Line 1806 of yacc.c  */
    6709 #line 1166 "parser.yy"
     6719#line 1172 "parser.yy"
    67106720    {
    67116721                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::TD );
     
    67176727
    67186728/* Line 1806 of yacc.c  */
    6719 #line 1177 "parser.yy"
     6729#line 1183 "parser.yy"
    67206730    {
    67216731                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    67276737
    67286738/* Line 1806 of yacc.c  */
    6729 #line 1182 "parser.yy"
     6739#line 1188 "parser.yy"
    67306740    {
    67316741                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    67376747
    67386748/* Line 1806 of yacc.c  */
    6739 #line 1187 "parser.yy"
     6749#line 1193 "parser.yy"
    67406750    {
    67416751                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    67476757
    67486758/* Line 1806 of yacc.c  */
    6749 #line 1192 "parser.yy"
     6759#line 1198 "parser.yy"
    67506760    {
    67516761                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    67576767
    67586768/* Line 1806 of yacc.c  */
    6759 #line 1197 "parser.yy"
     6769#line 1203 "parser.yy"
    67606770    {
    67616771                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    67676777
    67686778/* Line 1806 of yacc.c  */
    6769 #line 1206 "parser.yy"
     6779#line 1212 "parser.yy"
    67706780    {
    67716781                        typedefTable.addToEnclosingScope( *(yyvsp[(2) - (4)].tok), TypedefTable::TD );
     
    67776787
    67786788/* Line 1806 of yacc.c  */
    6779 #line 1211 "parser.yy"
     6789#line 1217 "parser.yy"
    67806790    {
    67816791                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (7)].tok), TypedefTable::TD );
     
    67876797
    67886798/* Line 1806 of yacc.c  */
    6789 #line 1228 "parser.yy"
     6799#line 1234 "parser.yy"
    67906800    {
    67916801                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    67976807
    67986808/* Line 1806 of yacc.c  */
    6799 #line 1233 "parser.yy"
     6809#line 1239 "parser.yy"
    68006810    {
    68016811                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    68076817
    68086818/* Line 1806 of yacc.c  */
    6809 #line 1255 "parser.yy"
     6819#line 1261 "parser.yy"
    68106820    { (yyval.decl) = 0; }
    68116821    break;
     
    68146824
    68156825/* Line 1806 of yacc.c  */
    6816 #line 1267 "parser.yy"
     6826#line 1273 "parser.yy"
    68176827    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68186828    break;
     
    68216831
    68226832/* Line 1806 of yacc.c  */
    6823 #line 1278 "parser.yy"
     6833#line 1284 "parser.yy"
    68246834    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Const ); }
    68256835    break;
     
    68286838
    68296839/* Line 1806 of yacc.c  */
    6830 #line 1280 "parser.yy"
     6840#line 1286 "parser.yy"
    68316841    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Restrict ); }
    68326842    break;
     
    68356845
    68366846/* Line 1806 of yacc.c  */
    6837 #line 1282 "parser.yy"
     6847#line 1288 "parser.yy"
    68386848    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); }
    68396849    break;
     
    68426852
    68436853/* Line 1806 of yacc.c  */
    6844 #line 1284 "parser.yy"
     6854#line 1290 "parser.yy"
    68456855    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); }
    68466856    break;
     
    68496859
    68506860/* Line 1806 of yacc.c  */
    6851 #line 1286 "parser.yy"
     6861#line 1292 "parser.yy"
    68526862    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); }
    68536863    break;
     
    68566866
    68576867/* Line 1806 of yacc.c  */
    6858 #line 1288 "parser.yy"
     6868#line 1294 "parser.yy"
    68596869    {
    68606870                        typedefTable.enterScope();
     
    68656875
    68666876/* Line 1806 of yacc.c  */
    6867 #line 1292 "parser.yy"
     6877#line 1298 "parser.yy"
    68686878    {
    68696879                        typedefTable.leaveScope();
     
    68756885
    68766886/* Line 1806 of yacc.c  */
    6877 #line 1301 "parser.yy"
     6887#line 1307 "parser.yy"
    68786888    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68796889    break;
     
    68826892
    68836893/* Line 1806 of yacc.c  */
    6884 #line 1303 "parser.yy"
     6894#line 1309 "parser.yy"
    68856895    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    68866896    break;
     
    68896899
    68906900/* Line 1806 of yacc.c  */
    6891 #line 1314 "parser.yy"
     6901#line 1320 "parser.yy"
    68926902    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68936903    break;
     
    68966906
    68976907/* Line 1806 of yacc.c  */
    6898 #line 1323 "parser.yy"
     6908#line 1329 "parser.yy"
    68996909    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); }
    69006910    break;
     
    69036913
    69046914/* Line 1806 of yacc.c  */
    6905 #line 1325 "parser.yy"
     6915#line 1331 "parser.yy"
    69066916    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); }
    69076917    break;
     
    69106920
    69116921/* Line 1806 of yacc.c  */
    6912 #line 1327 "parser.yy"
     6922#line 1333 "parser.yy"
    69136923    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); }
    69146924    break;
     
    69176927
    69186928/* Line 1806 of yacc.c  */
    6919 #line 1329 "parser.yy"
     6929#line 1335 "parser.yy"
    69206930    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Register ); }
    69216931    break;
     
    69246934
    69256935/* Line 1806 of yacc.c  */
    6926 #line 1331 "parser.yy"
     6936#line 1337 "parser.yy"
    69276937    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Inline ); }
    69286938    break;
     
    69316941
    69326942/* Line 1806 of yacc.c  */
    6933 #line 1333 "parser.yy"
     6943#line 1339 "parser.yy"
    69346944    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); }
    69356945    break;
     
    69386948
    69396949/* Line 1806 of yacc.c  */
    6940 #line 1335 "parser.yy"
     6950#line 1341 "parser.yy"
    69416951    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Noreturn ); }
    69426952    break;
     
    69456955
    69466956/* Line 1806 of yacc.c  */
    6947 #line 1337 "parser.yy"
     6957#line 1343 "parser.yy"
    69486958    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); }
    69496959    break;
     
    69526962
    69536963/* Line 1806 of yacc.c  */
    6954 #line 1342 "parser.yy"
     6964#line 1348 "parser.yy"
    69556965    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); }
    69566966    break;
     
    69596969
    69606970/* Line 1806 of yacc.c  */
    6961 #line 1344 "parser.yy"
     6971#line 1350 "parser.yy"
    69626972    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); }
    69636973    break;
     
    69666976
    69676977/* Line 1806 of yacc.c  */
    6968 #line 1346 "parser.yy"
     6978#line 1352 "parser.yy"
    69696979    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); }
    69706980    break;
     
    69736983
    69746984/* Line 1806 of yacc.c  */
    6975 #line 1348 "parser.yy"
     6985#line 1354 "parser.yy"
    69766986    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); }
    69776987    break;
     
    69806990
    69816991/* Line 1806 of yacc.c  */
    6982 #line 1350 "parser.yy"
     6992#line 1356 "parser.yy"
    69836993    { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Long ); }
    69846994    break;
     
    69876997
    69886998/* Line 1806 of yacc.c  */
    6989 #line 1352 "parser.yy"
     6999#line 1358 "parser.yy"
    69907000    { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Short ); }
    69917001    break;
     
    69947004
    69957005/* Line 1806 of yacc.c  */
    6996 #line 1354 "parser.yy"
     7006#line 1360 "parser.yy"
    69977007    { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Signed ); }
    69987008    break;
     
    70017011
    70027012/* Line 1806 of yacc.c  */
    7003 #line 1356 "parser.yy"
     7013#line 1362 "parser.yy"
    70047014    { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Unsigned ); }
    70057015    break;
     
    70087018
    70097019/* Line 1806 of yacc.c  */
    7010 #line 1358 "parser.yy"
     7020#line 1364 "parser.yy"
    70117021    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); }
    70127022    break;
     
    70157025
    70167026/* Line 1806 of yacc.c  */
    7017 #line 1360 "parser.yy"
     7027#line 1366 "parser.yy"
    70187028    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
    70197029    break;
     
    70227032
    70237033/* Line 1806 of yacc.c  */
    7024 #line 1362 "parser.yy"
     7034#line 1368 "parser.yy"
    70257035    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Complex ); }
    70267036    break;
     
    70297039
    70307040/* Line 1806 of yacc.c  */
    7031 #line 1364 "parser.yy"
     7041#line 1370 "parser.yy"
    70327042    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); }
    70337043    break;
     
    70367046
    70377047/* Line 1806 of yacc.c  */
    7038 #line 1366 "parser.yy"
     7048#line 1372 "parser.yy"
    70397049    { (yyval.decl) = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    70407050    break;
     
    70437053
    70447054/* Line 1806 of yacc.c  */
    7045 #line 1373 "parser.yy"
     7055#line 1379 "parser.yy"
    70467056    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    70477057    break;
     
    70507060
    70517061/* Line 1806 of yacc.c  */
    7052 #line 1375 "parser.yy"
     7062#line 1381 "parser.yy"
    70537063    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    70547064    break;
     
    70577067
    70587068/* Line 1806 of yacc.c  */
    7059 #line 1377 "parser.yy"
     7069#line 1383 "parser.yy"
    70607070    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    70617071    break;
     
    70647074
    70657075/* Line 1806 of yacc.c  */
    7066 #line 1379 "parser.yy"
     7076#line 1385 "parser.yy"
    70677077    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); }
    70687078    break;
     
    70717081
    70727082/* Line 1806 of yacc.c  */
    7073 #line 1385 "parser.yy"
     7083#line 1391 "parser.yy"
    70747084    { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    70757085    break;
     
    70787088
    70797089/* Line 1806 of yacc.c  */
    7080 #line 1392 "parser.yy"
     7090#line 1398 "parser.yy"
    70817091    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    70827092    break;
     
    70857095
    70867096/* Line 1806 of yacc.c  */
    7087 #line 1394 "parser.yy"
     7097#line 1400 "parser.yy"
    70887098    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    70897099    break;
     
    70927102
    70937103/* Line 1806 of yacc.c  */
    7094 #line 1396 "parser.yy"
     7104#line 1402 "parser.yy"
    70957105    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); }
    70967106    break;
     
    70997109
    71007110/* Line 1806 of yacc.c  */
    7101 #line 1401 "parser.yy"
     7111#line 1407 "parser.yy"
    71027112    { (yyval.decl) = (yyvsp[(3) - (4)].decl); }
    71037113    break;
     
    71067116
    71077117/* Line 1806 of yacc.c  */
    7108 #line 1403 "parser.yy"
     7118#line 1409 "parser.yy"
    71097119    { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); }
    71107120    break;
     
    71137123
    71147124/* Line 1806 of yacc.c  */
    7115 #line 1405 "parser.yy"
     7125#line 1411 "parser.yy"
    71167126    { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); }
    71177127    break;
     
    71207130
    71217131/* Line 1806 of yacc.c  */
    7122 #line 1407 "parser.yy"
     7132#line 1413 "parser.yy"
    71237133    { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
    71247134    break;
     
    71277137
    71287138/* Line 1806 of yacc.c  */
    7129 #line 1413 "parser.yy"
     7139#line 1419 "parser.yy"
    71307140    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    71317141    break;
     
    71347144
    71357145/* Line 1806 of yacc.c  */
    7136 #line 1415 "parser.yy"
     7146#line 1421 "parser.yy"
    71377147    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    71387148    break;
     
    71417151
    71427152/* Line 1806 of yacc.c  */
    7143 #line 1417 "parser.yy"
     7153#line 1423 "parser.yy"
    71447154    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    71457155    break;
     
    71487158
    71497159/* Line 1806 of yacc.c  */
    7150 #line 1423 "parser.yy"
     7160#line 1429 "parser.yy"
    71517161    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    71527162    break;
     
    71557165
    71567166/* Line 1806 of yacc.c  */
    7157 #line 1425 "parser.yy"
     7167#line 1431 "parser.yy"
    71587168    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    71597169    break;
     
    71627172
    71637173/* Line 1806 of yacc.c  */
    7164 #line 1431 "parser.yy"
     7174#line 1437 "parser.yy"
    71657175    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    71667176    break;
     
    71697179
    71707180/* Line 1806 of yacc.c  */
    7171 #line 1433 "parser.yy"
     7181#line 1439 "parser.yy"
    71727182    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    71737183    break;
     
    71767186
    71777187/* Line 1806 of yacc.c  */
    7178 #line 1435 "parser.yy"
     7188#line 1441 "parser.yy"
    71797189    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    71807190    break;
     
    71837193
    71847194/* Line 1806 of yacc.c  */
    7185 #line 1440 "parser.yy"
     7195#line 1446 "parser.yy"
    71867196    { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); }
    71877197    break;
     
    71907200
    71917201/* Line 1806 of yacc.c  */
    7192 #line 1442 "parser.yy"
     7202#line 1448 "parser.yy"
    71937203    { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    71947204    break;
     
    71977207
    71987208/* Line 1806 of yacc.c  */
    7199 #line 1444 "parser.yy"
     7209#line 1450 "parser.yy"
    72007210    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    72017211    break;
     
    72047214
    72057215/* Line 1806 of yacc.c  */
    7206 #line 1454 "parser.yy"
     7216#line 1460 "parser.yy"
    72077217    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), 0, 0, (yyvsp[(3) - (4)].decl), true ); }
    72087218    break;
     
    72117221
    72127222/* Line 1806 of yacc.c  */
    7213 #line 1456 "parser.yy"
     7223#line 1462 "parser.yy"
    72147224    {
    72157225                        typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) );
     
    72217231
    72227232/* Line 1806 of yacc.c  */
    7223 #line 1461 "parser.yy"
     7233#line 1467 "parser.yy"
    72247234    { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
    72257235    break;
     
    72287238
    72297239/* Line 1806 of yacc.c  */
    7230 #line 1463 "parser.yy"
     7240#line 1469 "parser.yy"
    72317241    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), 0, (yyvsp[(5) - (6)].decl), true ); }
    72327242    break;
     
    72357245
    72367246/* Line 1806 of yacc.c  */
    7237 #line 1465 "parser.yy"
     7247#line 1471 "parser.yy"
    72387248    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), 0, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); }
    72397249    break;
     
    72427252
    72437253/* Line 1806 of yacc.c  */
    7244 #line 1467 "parser.yy"
     7254#line 1473 "parser.yy"
    72457255    { (yyval.decl) = (yyvsp[(2) - (2)].decl); }
    72467256    break;
     
    72497259
    72507260/* Line 1806 of yacc.c  */
    7251 #line 1472 "parser.yy"
     7261#line 1478 "parser.yy"
    72527262    { (yyval.aggKey) = DeclarationNode::Struct; }
    72537263    break;
     
    72567266
    72577267/* Line 1806 of yacc.c  */
    7258 #line 1474 "parser.yy"
     7268#line 1480 "parser.yy"
    72597269    { (yyval.aggKey) = DeclarationNode::Union; }
    72607270    break;
     
    72637273
    72647274/* Line 1806 of yacc.c  */
    7265 #line 1479 "parser.yy"
     7275#line 1485 "parser.yy"
    72667276    { (yyval.decl) = 0; }
    72677277    break;
     
    72707280
    72717281/* Line 1806 of yacc.c  */
    7272 #line 1481 "parser.yy"
     7282#line 1487 "parser.yy"
    72737283    { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }
    72747284    break;
     
    72777287
    72787288/* Line 1806 of yacc.c  */
    7279 #line 1487 "parser.yy"
     7289#line 1493 "parser.yy"
    72807290    { (yyval.decl) = (yyvsp[(2) - (3)].decl)->set_extension( true ); }
    72817291    break;
     
    72847294
    72857295/* Line 1806 of yacc.c  */
    7286 #line 1490 "parser.yy"
     7296#line 1496 "parser.yy"
    72877297    {   // mark all fields in list
    72887298                        for ( DeclarationNode *iter = (yyvsp[(2) - (3)].decl); iter != NULL; iter = (DeclarationNode *)iter->get_link() )
     
    72957305
    72967306/* Line 1806 of yacc.c  */
    7297 #line 1500 "parser.yy"
     7307#line 1506 "parser.yy"
    72987308    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addName( (yyvsp[(2) - (2)].tok) ); }
    72997309    break;
     
    73027312
    73037313/* Line 1806 of yacc.c  */
    7304 #line 1502 "parser.yy"
     7314#line 1508 "parser.yy"
    73057315    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(1) - (3)].decl)->cloneType( (yyvsp[(3) - (3)].tok) ) ); }
    73067316    break;
     
    73097319
    73107320/* Line 1806 of yacc.c  */
    7311 #line 1504 "parser.yy"
     7321#line 1510 "parser.yy"
    73127322    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(1) - (2)].decl)->cloneType( 0 ) ); }
    73137323    break;
     
    73167326
    73177327/* Line 1806 of yacc.c  */
    7318 #line 1509 "parser.yy"
     7328#line 1515 "parser.yy"
    73197329    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    73207330    break;
     
    73237333
    73247334/* Line 1806 of yacc.c  */
    7325 #line 1511 "parser.yy"
     7335#line 1517 "parser.yy"
    73267336    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(1) - (4)].decl)->cloneBaseType( (yyvsp[(4) - (4)].decl) ) ); }
    73277337    break;
     
    73307340
    73317341/* Line 1806 of yacc.c  */
    7332 #line 1516 "parser.yy"
     7342#line 1522 "parser.yy"
    73337343    { (yyval.decl) = DeclarationNode::newName( 0 ); /* XXX */ }
    73347344    break;
     
    73377347
    73387348/* Line 1806 of yacc.c  */
    7339 #line 1518 "parser.yy"
     7349#line 1524 "parser.yy"
    73407350    { (yyval.decl) = DeclarationNode::newBitfield( (yyvsp[(1) - (1)].en) ); }
    73417351    break;
     
    73447354
    73457355/* Line 1806 of yacc.c  */
    7346 #line 1521 "parser.yy"
     7356#line 1527 "parser.yy"
    73477357    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }
    73487358    break;
     
    73517361
    73527362/* Line 1806 of yacc.c  */
    7353 #line 1524 "parser.yy"
     7363#line 1530 "parser.yy"
    73547364    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }
    73557365    break;
     
    73587368
    73597369/* Line 1806 of yacc.c  */
    7360 #line 1530 "parser.yy"
     7370#line 1536 "parser.yy"
    73617371    { (yyval.en) = 0; }
    73627372    break;
     
    73657375
    73667376/* Line 1806 of yacc.c  */
    7367 #line 1532 "parser.yy"
     7377#line 1538 "parser.yy"
    73687378    { (yyval.en) = (yyvsp[(1) - (1)].en); }
    73697379    break;
     
    73727382
    73737383/* Line 1806 of yacc.c  */
    7374 #line 1537 "parser.yy"
     7384#line 1543 "parser.yy"
    73757385    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    73767386    break;
     
    73797389
    73807390/* Line 1806 of yacc.c  */
    7381 #line 1546 "parser.yy"
     7391#line 1552 "parser.yy"
    73827392    { (yyval.decl) = DeclarationNode::newEnum( 0, (yyvsp[(3) - (5)].decl) ); }
    73837393    break;
     
    73867396
    73877397/* Line 1806 of yacc.c  */
    7388 #line 1548 "parser.yy"
     7398#line 1554 "parser.yy"
    73897399    {
    73907400                        typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) );
     
    73967406
    73977407/* Line 1806 of yacc.c  */
    7398 #line 1553 "parser.yy"
     7408#line 1559 "parser.yy"
    73997409    { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
    74007410    break;
     
    74037413
    74047414/* Line 1806 of yacc.c  */
    7405 #line 1555 "parser.yy"
     7415#line 1561 "parser.yy"
    74067416    { (yyval.decl) = DeclarationNode::newEnum( (yyvsp[(2) - (7)].tok), (yyvsp[(5) - (7)].decl) ); }
    74077417    break;
     
    74107420
    74117421/* Line 1806 of yacc.c  */
    7412 #line 1560 "parser.yy"
     7422#line 1566 "parser.yy"
    74137423    { (yyval.decl) = DeclarationNode::newEnumConstant( (yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].en) ); }
    74147424    break;
     
    74177427
    74187428/* Line 1806 of yacc.c  */
    7419 #line 1562 "parser.yy"
     7429#line 1568 "parser.yy"
    74207430    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( DeclarationNode::newEnumConstant( (yyvsp[(3) - (4)].tok), (yyvsp[(4) - (4)].en) ) ); }
    74217431    break;
     
    74247434
    74257435/* Line 1806 of yacc.c  */
    7426 #line 1567 "parser.yy"
     7436#line 1573 "parser.yy"
    74277437    { (yyval.en) = 0; }
    74287438    break;
     
    74317441
    74327442/* Line 1806 of yacc.c  */
    7433 #line 1569 "parser.yy"
     7443#line 1575 "parser.yy"
    74347444    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    74357445    break;
     
    74387448
    74397449/* Line 1806 of yacc.c  */
    7440 #line 1576 "parser.yy"
     7450#line 1582 "parser.yy"
    74417451    { (yyval.decl) = 0; }
    74427452    break;
     
    74457455
    74467456/* Line 1806 of yacc.c  */
    7447 #line 1584 "parser.yy"
     7457#line 1590 "parser.yy"
    74487458    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    74497459    break;
     
    74527462
    74537463/* Line 1806 of yacc.c  */
    7454 #line 1586 "parser.yy"
     7464#line 1592 "parser.yy"
    74557465    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    74567466    break;
     
    74597469
    74607470/* Line 1806 of yacc.c  */
    7461 #line 1588 "parser.yy"
     7471#line 1594 "parser.yy"
    74627472    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    74637473    break;
     
    74667476
    74677477/* Line 1806 of yacc.c  */
    7468 #line 1596 "parser.yy"
     7478#line 1602 "parser.yy"
    74697479    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    74707480    break;
     
    74737483
    74747484/* Line 1806 of yacc.c  */
    7475 #line 1598 "parser.yy"
     7485#line 1604 "parser.yy"
    74767486    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    74777487    break;
     
    74807490
    74817491/* Line 1806 of yacc.c  */
    7482 #line 1600 "parser.yy"
     7492#line 1606 "parser.yy"
    74837493    { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); }
    74847494    break;
     
    74877497
    74887498/* Line 1806 of yacc.c  */
    7489 #line 1606 "parser.yy"
     7499#line 1612 "parser.yy"
    74907500    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    74917501    break;
     
    74947504
    74957505/* Line 1806 of yacc.c  */
    7496 #line 1611 "parser.yy"
     7506#line 1617 "parser.yy"
    74977507    { (yyval.decl) = 0; }
    74987508    break;
     
    75017511
    75027512/* Line 1806 of yacc.c  */
    7503 #line 1618 "parser.yy"
     7513#line 1624 "parser.yy"
    75047514    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    75057515    break;
     
    75087518
    75097519/* Line 1806 of yacc.c  */
    7510 #line 1625 "parser.yy"
     7520#line 1631 "parser.yy"
    75117521    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    75127522    break;
     
    75157525
    75167526/* Line 1806 of yacc.c  */
    7517 #line 1627 "parser.yy"
     7527#line 1633 "parser.yy"
    75187528    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    75197529    break;
     
    75227532
    75237533/* Line 1806 of yacc.c  */
    7524 #line 1636 "parser.yy"
     7534#line 1642 "parser.yy"
    75257535    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }
    75267536    break;
     
    75297539
    75307540/* Line 1806 of yacc.c  */
    7531 #line 1639 "parser.yy"
     7541#line 1645 "parser.yy"
    75327542    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }
    75337543    break;
     
    75367546
    75377547/* Line 1806 of yacc.c  */
    7538 #line 1641 "parser.yy"
     7548#line 1647 "parser.yy"
    75397549    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addName( (yyvsp[(3) - (4)].tok) )->addQualifiers( (yyvsp[(1) - (4)].decl) ); }
    75407550    break;
     
    75437553
    75447554/* Line 1806 of yacc.c  */
    7545 #line 1651 "parser.yy"
     7555#line 1657 "parser.yy"
    75467556    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    75477557    break;
     
    75507560
    75517561/* Line 1806 of yacc.c  */
    7552 #line 1657 "parser.yy"
     7562#line 1663 "parser.yy"
    75537563    {
    75547564                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    75607570
    75617571/* Line 1806 of yacc.c  */
    7562 #line 1662 "parser.yy"
     7572#line 1668 "parser.yy"
    75637573    {
    75647574                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    75707580
    75717581/* Line 1806 of yacc.c  */
    7572 #line 1671 "parser.yy"
     7582#line 1677 "parser.yy"
    75737583    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    75747584    break;
     
    75777587
    75787588/* Line 1806 of yacc.c  */
    7579 #line 1680 "parser.yy"
     7589#line 1686 "parser.yy"
    75807590    { (yyval.decl) = DeclarationNode::newName( (yyvsp[(1) - (1)].tok) ); }
    75817591    break;
     
    75847594
    75857595/* Line 1806 of yacc.c  */
    7586 #line 1682 "parser.yy"
     7596#line 1688 "parser.yy"
    75877597    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( DeclarationNode::newName( (yyvsp[(3) - (3)].tok) ) ); }
    75887598    break;
     
    75917601
    75927602/* Line 1806 of yacc.c  */
    7593 #line 1707 "parser.yy"
     7603#line 1713 "parser.yy"
    75947604    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    75957605    break;
     
    75987608
    75997609/* Line 1806 of yacc.c  */
    7600 #line 1715 "parser.yy"
     7610#line 1721 "parser.yy"
    76017611    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    76027612    break;
     
    76057615
    76067616/* Line 1806 of yacc.c  */
    7607 #line 1720 "parser.yy"
     7617#line 1726 "parser.yy"
    76087618    { (yyval.in) = 0; }
    76097619    break;
     
    76127622
    76137623/* Line 1806 of yacc.c  */
    7614 #line 1722 "parser.yy"
     7624#line 1728 "parser.yy"
    76157625    { (yyval.in) = (yyvsp[(2) - (2)].in); }
    76167626    break;
     
    76197629
    76207630/* Line 1806 of yacc.c  */
    7621 #line 1724 "parser.yy"
     7631#line 1730 "parser.yy"
    76227632    { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); }
    76237633    break;
     
    76267636
    76277637/* Line 1806 of yacc.c  */
    7628 #line 1728 "parser.yy"
     7638#line 1734 "parser.yy"
    76297639    { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); }
    76307640    break;
     
    76337643
    76347644/* Line 1806 of yacc.c  */
    7635 #line 1729 "parser.yy"
     7645#line 1735 "parser.yy"
    76367646    { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); }
    76377647    break;
     
    76407650
    76417651/* Line 1806 of yacc.c  */
    7642 #line 1734 "parser.yy"
     7652#line 1740 "parser.yy"
    76437653    { (yyval.in) = 0; }
    76447654    break;
     
    76477657
    76487658/* Line 1806 of yacc.c  */
    7649 #line 1736 "parser.yy"
     7659#line 1742 "parser.yy"
    76507660    { (yyval.in) = (yyvsp[(2) - (2)].in)->set_designators( (yyvsp[(1) - (2)].en) ); }
    76517661    break;
     
    76547664
    76557665/* Line 1806 of yacc.c  */
    7656 #line 1737 "parser.yy"
     7666#line 1743 "parser.yy"
    76577667    { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (3)].in)->set_link( (yyvsp[(3) - (3)].in) ) ); }
    76587668    break;
     
    76617671
    76627672/* Line 1806 of yacc.c  */
    7663 #line 1739 "parser.yy"
     7673#line 1745 "parser.yy"
    76647674    { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (4)].in)->set_link( (yyvsp[(4) - (4)].in)->set_designators( (yyvsp[(3) - (4)].en) ) ) ); }
    76657675    break;
     
    76687678
    76697679/* Line 1806 of yacc.c  */
    7670 #line 1755 "parser.yy"
     7680#line 1761 "parser.yy"
    76717681    { (yyval.en) = new VarRefNode( (yyvsp[(1) - (2)].tok) ); }
    76727682    break;
     
    76757685
    76767686/* Line 1806 of yacc.c  */
    7677 #line 1761 "parser.yy"
     7687#line 1767 "parser.yy"
    76787688    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (2)].en)->set_link( (yyvsp[(2) - (2)].en) )); }
    76797689    break;
     
    76827692
    76837693/* Line 1806 of yacc.c  */
    7684 #line 1769 "parser.yy"
     7694#line 1775 "parser.yy"
    76857695    { (yyval.en) = new DesignatorNode( new VarRefNode( (yyvsp[(1) - (1)].tok) ) ); }
    76867696    break;
     
    76897699
    76907700/* Line 1806 of yacc.c  */
    7691 #line 1771 "parser.yy"
     7701#line 1777 "parser.yy"
    76927702    { (yyval.en) = new DesignatorNode( new VarRefNode( (yyvsp[(2) - (2)].tok) ) ); }
    76937703    break;
     
    76967706
    76977707/* Line 1806 of yacc.c  */
    7698 #line 1774 "parser.yy"
     7708#line 1780 "parser.yy"
    76997709    { (yyval.en) = new DesignatorNode( (yyvsp[(3) - (5)].en), true ); }
    77007710    break;
     
    77037713
    77047714/* Line 1806 of yacc.c  */
    7705 #line 1776 "parser.yy"
     7715#line 1782 "parser.yy"
    77067716    { (yyval.en) = new DesignatorNode( (yyvsp[(3) - (5)].en), true ); }
    77077717    break;
     
    77107720
    77117721/* Line 1806 of yacc.c  */
    7712 #line 1778 "parser.yy"
    7713     { (yyval.en) = new DesignatorNode( new CompositeExprNode( new OperatorNode( OperatorNode::Range ), (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ), true ); }
     7722#line 1784 "parser.yy"
     7723    { (yyval.en) = new DesignatorNode( new CompositeExprNode2( build_opr2( OperatorNode::Range, (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ), true ); }
    77147724    break;
    77157725
     
    77177727
    77187728/* Line 1806 of yacc.c  */
    7719 #line 1780 "parser.yy"
     7729#line 1786 "parser.yy"
    77207730    { (yyval.en) = new DesignatorNode( (yyvsp[(4) - (6)].en) ); }
    77217731    break;
     
    77247734
    77257735/* Line 1806 of yacc.c  */
    7726 #line 1804 "parser.yy"
     7736#line 1810 "parser.yy"
    77277737    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    77287738    break;
     
    77317741
    77327742/* Line 1806 of yacc.c  */
    7733 #line 1806 "parser.yy"
     7743#line 1812 "parser.yy"
    77347744    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    77357745    break;
     
    77387748
    77397749/* Line 1806 of yacc.c  */
    7740 #line 1808 "parser.yy"
     7750#line 1814 "parser.yy"
    77417751    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    77427752    break;
     
    77457755
    77467756/* Line 1806 of yacc.c  */
    7747 #line 1814 "parser.yy"
     7757#line 1820 "parser.yy"
    77487758    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    77497759    break;
     
    77527762
    77537763/* Line 1806 of yacc.c  */
    7754 #line 1816 "parser.yy"
     7764#line 1822 "parser.yy"
    77557765    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    77567766    break;
     
    77597769
    77607770/* Line 1806 of yacc.c  */
    7761 #line 1821 "parser.yy"
     7771#line 1827 "parser.yy"
    77627772    { (yyval.decl) = DeclarationNode::newFromTypeGen( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
    77637773    break;
     
    77667776
    77677777/* Line 1806 of yacc.c  */
    7768 #line 1827 "parser.yy"
     7778#line 1833 "parser.yy"
    77697779    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(3) - (4)].decl) ); }
    77707780    break;
     
    77737783
    77747784/* Line 1806 of yacc.c  */
    7775 #line 1832 "parser.yy"
     7785#line 1838 "parser.yy"
    77767786    { typedefTable.addToEnclosingScope( *(yyvsp[(2) - (2)].tok), TypedefTable::TD ); }
    77777787    break;
     
    77807790
    77817791/* Line 1806 of yacc.c  */
    7782 #line 1834 "parser.yy"
     7792#line 1840 "parser.yy"
    77837793    { (yyval.decl) = DeclarationNode::newTypeParam( (yyvsp[(1) - (4)].tclass), (yyvsp[(2) - (4)].tok) )->addAssertions( (yyvsp[(4) - (4)].decl) ); }
    77847794    break;
     
    77877797
    77887798/* Line 1806 of yacc.c  */
    7789 #line 1840 "parser.yy"
     7799#line 1846 "parser.yy"
    77907800    { (yyval.tclass) = DeclarationNode::Type; }
    77917801    break;
     
    77947804
    77957805/* Line 1806 of yacc.c  */
    7796 #line 1842 "parser.yy"
     7806#line 1848 "parser.yy"
    77977807    { (yyval.tclass) = DeclarationNode::Ftype; }
    77987808    break;
     
    78017811
    78027812/* Line 1806 of yacc.c  */
    7803 #line 1844 "parser.yy"
     7813#line 1850 "parser.yy"
    78047814    { (yyval.tclass) = DeclarationNode::Dtype; }
    78057815    break;
     
    78087818
    78097819/* Line 1806 of yacc.c  */
    7810 #line 1849 "parser.yy"
     7820#line 1855 "parser.yy"
    78117821    { (yyval.decl) = 0; }
    78127822    break;
     
    78157825
    78167826/* Line 1806 of yacc.c  */
    7817 #line 1851 "parser.yy"
     7827#line 1857 "parser.yy"
    78187828    { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }
    78197829    break;
     
    78227832
    78237833/* Line 1806 of yacc.c  */
    7824 #line 1856 "parser.yy"
     7834#line 1862 "parser.yy"
    78257835    {
    78267836                        typedefTable.openTrait( *(yyvsp[(2) - (5)].tok) );
     
    78327842
    78337843/* Line 1806 of yacc.c  */
    7834 #line 1861 "parser.yy"
     7844#line 1867 "parser.yy"
    78357845    { (yyval.decl) = (yyvsp[(4) - (5)].decl); }
    78367846    break;
     
    78397849
    78407850/* Line 1806 of yacc.c  */
    7841 #line 1863 "parser.yy"
     7851#line 1869 "parser.yy"
    78427852    { (yyval.decl) = 0; }
    78437853    break;
     
    78467856
    78477857/* Line 1806 of yacc.c  */
    7848 #line 1868 "parser.yy"
     7858#line 1874 "parser.yy"
    78497859    { (yyval.en) = new TypeValueNode( (yyvsp[(1) - (1)].decl) ); }
    78507860    break;
     
    78537863
    78547864/* Line 1806 of yacc.c  */
    7855 #line 1871 "parser.yy"
     7865#line 1877 "parser.yy"
    78567866    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_link( new TypeValueNode( (yyvsp[(3) - (3)].decl) ))); }
    78577867    break;
     
    78607870
    78617871/* Line 1806 of yacc.c  */
    7862 #line 1873 "parser.yy"
     7872#line 1879 "parser.yy"
    78637873    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) )); }
    78647874    break;
     
    78677877
    78687878/* Line 1806 of yacc.c  */
    7869 #line 1878 "parser.yy"
     7879#line 1884 "parser.yy"
    78707880    { (yyval.decl) = (yyvsp[(2) - (2)].decl); }
    78717881    break;
     
    78747884
    78757885/* Line 1806 of yacc.c  */
    7876 #line 1880 "parser.yy"
     7886#line 1886 "parser.yy"
    78777887    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) ); }
    78787888    break;
     
    78817891
    78827892/* Line 1806 of yacc.c  */
    7883 #line 1882 "parser.yy"
     7893#line 1888 "parser.yy"
    78847894    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl)->copyStorageClasses( (yyvsp[(1) - (3)].decl) ) ); }
    78857895    break;
     
    78887898
    78897899/* Line 1806 of yacc.c  */
    7890 #line 1887 "parser.yy"
     7900#line 1893 "parser.yy"
    78917901    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addAssertions( (yyvsp[(2) - (2)].decl) ); }
    78927902    break;
     
    78957905
    78967906/* Line 1806 of yacc.c  */
    7897 #line 1889 "parser.yy"
     7907#line 1895 "parser.yy"
    78987908    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addAssertions( (yyvsp[(2) - (4)].decl) )->addType( (yyvsp[(4) - (4)].decl) ); }
    78997909    break;
     
    79027912
    79037913/* Line 1806 of yacc.c  */
    7904 #line 1894 "parser.yy"
     7914#line 1900 "parser.yy"
    79057915    {
    79067916                        typedefTable.addToEnclosingScope( *(yyvsp[(1) - (1)].tok), TypedefTable::TD );
     
    79127922
    79137923/* Line 1806 of yacc.c  */
    7914 #line 1899 "parser.yy"
     7924#line 1905 "parser.yy"
    79157925    {
    79167926                        typedefTable.addToEnclosingScope( *(yyvsp[(1) - (6)].tok), TypedefTable::TG );
     
    79227932
    79237933/* Line 1806 of yacc.c  */
    7924 #line 1907 "parser.yy"
     7934#line 1913 "parser.yy"
    79257935    {
    79267936                        typedefTable.addToEnclosingScope( *(yyvsp[(2) - (9)].tok), TypedefTable::ID );
     
    79327942
    79337943/* Line 1806 of yacc.c  */
    7934 #line 1912 "parser.yy"
     7944#line 1918 "parser.yy"
    79357945    {
    79367946                        typedefTable.enterTrait( *(yyvsp[(2) - (8)].tok) );
     
    79427952
    79437953/* Line 1806 of yacc.c  */
    7944 #line 1917 "parser.yy"
     7954#line 1923 "parser.yy"
    79457955    {
    79467956                        typedefTable.leaveTrait();
     
    79537963
    79547964/* Line 1806 of yacc.c  */
    7955 #line 1927 "parser.yy"
     7965#line 1933 "parser.yy"
    79567966    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    79577967    break;
     
    79607970
    79617971/* Line 1806 of yacc.c  */
    7962 #line 1937 "parser.yy"
     7972#line 1943 "parser.yy"
    79637973    {
    79647974                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    79707980
    79717981/* Line 1806 of yacc.c  */
    7972 #line 1942 "parser.yy"
     7982#line 1948 "parser.yy"
    79737983    {
    79747984                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    79807990
    79817991/* Line 1806 of yacc.c  */
    7982 #line 1947 "parser.yy"
     7992#line 1953 "parser.yy"
    79837993    {
    79847994                        typedefTable.addToEnclosingScope2( *(yyvsp[(5) - (5)].tok), TypedefTable::ID );
     
    79908000
    79918001/* Line 1806 of yacc.c  */
    7992 #line 1955 "parser.yy"
     8002#line 1961 "parser.yy"
    79938003    {
    79948004                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    80008010
    80018011/* Line 1806 of yacc.c  */
    8002 #line 1960 "parser.yy"
     8012#line 1966 "parser.yy"
    80038013    {
    80048014                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    80108020
    80118021/* Line 1806 of yacc.c  */
    8012 #line 1970 "parser.yy"
     8022#line 1976 "parser.yy"
    80138023    {}
    80148024    break;
     
    80178027
    80188028/* Line 1806 of yacc.c  */
    8019 #line 1972 "parser.yy"
     8029#line 1978 "parser.yy"
    80208030    {
    80218031                        if ( theTree ) {
     
    80308040
    80318041/* Line 1806 of yacc.c  */
    8032 #line 1984 "parser.yy"
     8042#line 1990 "parser.yy"
    80338043    { (yyval.decl) = ( (yyvsp[(1) - (3)].decl) != NULL ) ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); }
    80348044    break;
     
    80378047
    80388048/* Line 1806 of yacc.c  */
    8039 #line 1989 "parser.yy"
     8049#line 1995 "parser.yy"
    80408050    { (yyval.decl) = 0; }
    80418051    break;
     
    80448054
    80458055/* Line 1806 of yacc.c  */
    8046 #line 1997 "parser.yy"
     8056#line 2003 "parser.yy"
    80478057    {}
    80488058    break;
     
    80518061
    80528062/* Line 1806 of yacc.c  */
    8053 #line 1999 "parser.yy"
     8063#line 2005 "parser.yy"
    80548064    {
    80558065                        linkageStack.push( linkage );
     
    80618071
    80628072/* Line 1806 of yacc.c  */
    8063 #line 2004 "parser.yy"
     8073#line 2010 "parser.yy"
    80648074    {
    80658075                        linkage = linkageStack.top();
     
    80728082
    80738083/* Line 1806 of yacc.c  */
    8074 #line 2010 "parser.yy"
     8084#line 2016 "parser.yy"
    80758085    {   // mark all fields in list
    80768086                        for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != NULL; iter = (DeclarationNode *)iter->get_link() )
     
    80838093
    80848094/* Line 1806 of yacc.c  */
    8085 #line 2025 "parser.yy"
     8095#line 2031 "parser.yy"
    80868096    {
    80878097                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    80948104
    80958105/* Line 1806 of yacc.c  */
    8096 #line 2031 "parser.yy"
     8106#line 2037 "parser.yy"
    80978107    {
    80988108                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    81058115
    81068116/* Line 1806 of yacc.c  */
    8107 #line 2040 "parser.yy"
     8117#line 2046 "parser.yy"
    81088118    {
    81098119                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    81168126
    81178127/* Line 1806 of yacc.c  */
    8118 #line 2046 "parser.yy"
     8128#line 2052 "parser.yy"
    81198129    {
    81208130                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    81258135
    81268136  case 537:
    8127 
    8128 /* Line 1806 of yacc.c  */
    8129 #line 2052 "parser.yy"
    8130     {
    8131                         typedefTable.addToEnclosingScope( TypedefTable::ID );
    8132                         typedefTable.leaveScope();
    8133                         (yyval.decl) = (yyvsp[(2) - (3)].decl)->addFunctionBody( (yyvsp[(3) - (3)].sn) )->addQualifiers( (yyvsp[(1) - (3)].decl) );
    8134                 }
    8135     break;
    8136 
    8137   case 538:
    81388137
    81398138/* Line 1806 of yacc.c  */
     
    81468145    break;
    81478146
     8147  case 538:
     8148
     8149/* Line 1806 of yacc.c  */
     8150#line 2064 "parser.yy"
     8151    {
     8152                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     8153                        typedefTable.leaveScope();
     8154                        (yyval.decl) = (yyvsp[(2) - (3)].decl)->addFunctionBody( (yyvsp[(3) - (3)].sn) )->addQualifiers( (yyvsp[(1) - (3)].decl) );
     8155                }
     8156    break;
     8157
    81488158  case 539:
    81498159
    81508160/* Line 1806 of yacc.c  */
    8151 #line 2064 "parser.yy"
     8161#line 2070 "parser.yy"
    81528162    {
    81538163                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    81608170
    81618171/* Line 1806 of yacc.c  */
    8162 #line 2072 "parser.yy"
     8172#line 2078 "parser.yy"
    81638173    {
    81648174                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    81718181
    81728182/* Line 1806 of yacc.c  */
    8173 #line 2078 "parser.yy"
     8183#line 2084 "parser.yy"
    81748184    {
    81758185                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    81828192
    81838193/* Line 1806 of yacc.c  */
    8184 #line 2086 "parser.yy"
     8194#line 2092 "parser.yy"
    81858195    {
    81868196                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    81938203
    81948204/* Line 1806 of yacc.c  */
    8195 #line 2092 "parser.yy"
     8205#line 2098 "parser.yy"
    81968206    {
    81978207                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    82048214
    82058215/* Line 1806 of yacc.c  */
    8206 #line 2107 "parser.yy"
    8207     { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Range ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }
     8216#line 2113 "parser.yy"
     8217    { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Range, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    82088218    break;
    82098219
     
    82118221
    82128222/* Line 1806 of yacc.c  */
    8213 #line 2117 "parser.yy"
     8223#line 2123 "parser.yy"
    82148224    { (yyval.decl) = 0; }
    82158225    break;
     
    82188228
    82198229/* Line 1806 of yacc.c  */
    8220 #line 2124 "parser.yy"
     8230#line 2130 "parser.yy"
    82218231    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    82228232    break;
     
    82258235
    82268236/* Line 1806 of yacc.c  */
    8227 #line 2130 "parser.yy"
     8237#line 2136 "parser.yy"
    82288238    { (yyval.decl) = 0; }
    82298239    break;
     
    82328242
    82338243/* Line 1806 of yacc.c  */
    8234 #line 2145 "parser.yy"
     8244#line 2151 "parser.yy"
    82358245    {}
    82368246    break;
     
    82398249
    82408250/* Line 1806 of yacc.c  */
    8241 #line 2146 "parser.yy"
     8251#line 2152 "parser.yy"
    82428252    {}
    82438253    break;
     
    82468256
    82478257/* Line 1806 of yacc.c  */
    8248 #line 2147 "parser.yy"
     8258#line 2153 "parser.yy"
    82498259    {}
    82508260    break;
     
    82538263
    82548264/* Line 1806 of yacc.c  */
    8255 #line 2148 "parser.yy"
     8265#line 2154 "parser.yy"
    82568266    {}
    82578267    break;
     
    82608270
    82618271/* Line 1806 of yacc.c  */
    8262 #line 2183 "parser.yy"
     8272#line 2189 "parser.yy"
    82638273    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    82648274    break;
     
    82678277
    82688278/* Line 1806 of yacc.c  */
    8269 #line 2186 "parser.yy"
     8279#line 2192 "parser.yy"
    82708280    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    82718281    break;
     
    82748284
    82758285/* Line 1806 of yacc.c  */
    8276 #line 2188 "parser.yy"
     8286#line 2194 "parser.yy"
    82778287    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    82788288    break;
     
    82818291
    82828292/* Line 1806 of yacc.c  */
    8283 #line 2193 "parser.yy"
     8293#line 2199 "parser.yy"
    82848294    {
    82858295                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    82918301
    82928302/* Line 1806 of yacc.c  */
    8293 #line 2198 "parser.yy"
     8303#line 2204 "parser.yy"
    82948304    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    82958305    break;
     
    82988308
    82998309/* Line 1806 of yacc.c  */
    8300 #line 2203 "parser.yy"
     8310#line 2209 "parser.yy"
    83018311    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    83028312    break;
     
    83058315
    83068316/* Line 1806 of yacc.c  */
    8307 #line 2205 "parser.yy"
     8317#line 2211 "parser.yy"
    83088318    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    83098319    break;
     
    83128322
    83138323/* Line 1806 of yacc.c  */
    8314 #line 2207 "parser.yy"
     8324#line 2213 "parser.yy"
    83158325    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83168326    break;
     
    83198329
    83208330/* Line 1806 of yacc.c  */
    8321 #line 2212 "parser.yy"
     8331#line 2218 "parser.yy"
    83228332    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    83238333    break;
     
    83268336
    83278337/* Line 1806 of yacc.c  */
    8328 #line 2214 "parser.yy"
     8338#line 2220 "parser.yy"
    83298339    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    83308340    break;
     
    83338343
    83348344/* Line 1806 of yacc.c  */
    8335 #line 2216 "parser.yy"
     8345#line 2222 "parser.yy"
    83368346    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    83378347    break;
     
    83408350
    83418351/* Line 1806 of yacc.c  */
    8342 #line 2218 "parser.yy"
     8352#line 2224 "parser.yy"
    83438353    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83448354    break;
     
    83478357
    83488358/* Line 1806 of yacc.c  */
    8349 #line 2223 "parser.yy"
     8359#line 2229 "parser.yy"
    83508360    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    83518361    break;
     
    83548364
    83558365/* Line 1806 of yacc.c  */
    8356 #line 2225 "parser.yy"
     8366#line 2231 "parser.yy"
    83578367    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83588368    break;
     
    83618371
    83628372/* Line 1806 of yacc.c  */
    8363 #line 2234 "parser.yy"
     8373#line 2240 "parser.yy"
    83648374    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    83658375    break;
     
    83688378
    83698379/* Line 1806 of yacc.c  */
    8370 #line 2237 "parser.yy"
     8380#line 2243 "parser.yy"
    83718381    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    83728382    break;
     
    83758385
    83768386/* Line 1806 of yacc.c  */
    8377 #line 2242 "parser.yy"
     8387#line 2248 "parser.yy"
    83788388    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    83798389    break;
     
    83828392
    83838393/* Line 1806 of yacc.c  */
    8384 #line 2244 "parser.yy"
     8394#line 2250 "parser.yy"
    83858395    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    83868396    break;
     
    83898399
    83908400/* Line 1806 of yacc.c  */
    8391 #line 2246 "parser.yy"
     8401#line 2252 "parser.yy"
    83928402    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83938403    break;
     
    83968406
    83978407/* Line 1806 of yacc.c  */
    8398 #line 2251 "parser.yy"
     8408#line 2257 "parser.yy"
    83998409    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    84008410    break;
     
    84038413
    84048414/* Line 1806 of yacc.c  */
    8405 #line 2253 "parser.yy"
     8415#line 2259 "parser.yy"
    84068416    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    84078417    break;
     
    84108420
    84118421/* Line 1806 of yacc.c  */
    8412 #line 2255 "parser.yy"
     8422#line 2261 "parser.yy"
    84138423    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84148424    break;
     
    84178427
    84188428/* Line 1806 of yacc.c  */
    8419 #line 2260 "parser.yy"
     8429#line 2266 "parser.yy"
    84208430    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    84218431    break;
     
    84248434
    84258435/* Line 1806 of yacc.c  */
    8426 #line 2262 "parser.yy"
     8436#line 2268 "parser.yy"
    84278437    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    84288438    break;
     
    84318441
    84328442/* Line 1806 of yacc.c  */
    8433 #line 2264 "parser.yy"
     8443#line 2270 "parser.yy"
    84348444    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84358445    break;
     
    84388448
    84398449/* Line 1806 of yacc.c  */
    8440 #line 2279 "parser.yy"
     8450#line 2285 "parser.yy"
    84418451    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); }
    84428452    break;
     
    84458455
    84468456/* Line 1806 of yacc.c  */
    8447 #line 2281 "parser.yy"
     8457#line 2287 "parser.yy"
    84488458    { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); }
    84498459    break;
     
    84528462
    84538463/* Line 1806 of yacc.c  */
    8454 #line 2283 "parser.yy"
     8464#line 2289 "parser.yy"
    84558465    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84568466    break;
     
    84598469
    84608470/* Line 1806 of yacc.c  */
    8461 #line 2288 "parser.yy"
     8471#line 2294 "parser.yy"
    84628472    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    84638473    break;
     
    84668476
    84678477/* Line 1806 of yacc.c  */
    8468 #line 2290 "parser.yy"
     8478#line 2296 "parser.yy"
    84698479    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    84708480    break;
     
    84738483
    84748484/* Line 1806 of yacc.c  */
    8475 #line 2292 "parser.yy"
     8485#line 2298 "parser.yy"
    84768486    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84778487    break;
     
    84808490
    84818491/* Line 1806 of yacc.c  */
    8482 #line 2297 "parser.yy"
     8492#line 2303 "parser.yy"
    84838493    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    84848494    break;
     
    84878497
    84888498/* Line 1806 of yacc.c  */
    8489 #line 2299 "parser.yy"
     8499#line 2305 "parser.yy"
    84908500    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    84918501    break;
     
    84948504
    84958505/* Line 1806 of yacc.c  */
    8496 #line 2301 "parser.yy"
     8506#line 2307 "parser.yy"
    84978507    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84988508    break;
     
    85018511
    85028512/* Line 1806 of yacc.c  */
    8503 #line 2316 "parser.yy"
     8513#line 2322 "parser.yy"
    85048514    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    85058515    break;
     
    85088518
    85098519/* Line 1806 of yacc.c  */
    8510 #line 2319 "parser.yy"
     8520#line 2325 "parser.yy"
    85118521    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    85128522    break;
     
    85158525
    85168526/* Line 1806 of yacc.c  */
    8517 #line 2321 "parser.yy"
     8527#line 2327 "parser.yy"
    85188528    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    85198529    break;
     
    85228532
    85238533/* Line 1806 of yacc.c  */
    8524 #line 2327 "parser.yy"
     8534#line 2333 "parser.yy"
    85258535    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    85268536    break;
     
    85298539
    85308540/* Line 1806 of yacc.c  */
    8531 #line 2332 "parser.yy"
     8541#line 2338 "parser.yy"
    85328542    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    85338543    break;
     
    85368546
    85378547/* Line 1806 of yacc.c  */
    8538 #line 2334 "parser.yy"
     8548#line 2340 "parser.yy"
    85398549    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    85408550    break;
     
    85438553
    85448554/* Line 1806 of yacc.c  */
    8545 #line 2336 "parser.yy"
     8555#line 2342 "parser.yy"
    85468556    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    85478557    break;
     
    85508560
    85518561/* Line 1806 of yacc.c  */
    8552 #line 2341 "parser.yy"
     8562#line 2347 "parser.yy"
    85538563    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    85548564    break;
     
    85578567
    85588568/* Line 1806 of yacc.c  */
    8559 #line 2343 "parser.yy"
     8569#line 2349 "parser.yy"
    85608570    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    85618571    break;
     
    85648574
    85658575/* Line 1806 of yacc.c  */
    8566 #line 2345 "parser.yy"
     8576#line 2351 "parser.yy"
    85678577    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    85688578    break;
     
    85718581
    85728582/* Line 1806 of yacc.c  */
    8573 #line 2347 "parser.yy"
     8583#line 2353 "parser.yy"
    85748584    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    85758585    break;
     
    85788588
    85798589/* Line 1806 of yacc.c  */
    8580 #line 2352 "parser.yy"
     8590#line 2358 "parser.yy"
    85818591    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    85828592    break;
     
    85858595
    85868596/* Line 1806 of yacc.c  */
    8587 #line 2354 "parser.yy"
     8597#line 2360 "parser.yy"
    85888598    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    85898599    break;
     
    85928602
    85938603/* Line 1806 of yacc.c  */
    8594 #line 2356 "parser.yy"
     8604#line 2362 "parser.yy"
    85958605    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    85968606    break;
     
    85998609
    86008610/* Line 1806 of yacc.c  */
    8601 #line 2366 "parser.yy"
     8611#line 2372 "parser.yy"
    86028612    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    86038613    break;
     
    86068616
    86078617/* Line 1806 of yacc.c  */
    8608 #line 2369 "parser.yy"
     8618#line 2375 "parser.yy"
    86098619    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    86108620    break;
     
    86138623
    86148624/* Line 1806 of yacc.c  */
    8615 #line 2371 "parser.yy"
     8625#line 2377 "parser.yy"
    86168626    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    86178627    break;
     
    86208630
    86218631/* Line 1806 of yacc.c  */
    8622 #line 2376 "parser.yy"
     8632#line 2382 "parser.yy"
    86238633    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    86248634    break;
     
    86278637
    86288638/* Line 1806 of yacc.c  */
    8629 #line 2378 "parser.yy"
     8639#line 2384 "parser.yy"
    86308640    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    86318641    break;
     
    86348644
    86358645/* Line 1806 of yacc.c  */
    8636 #line 2380 "parser.yy"
     8646#line 2386 "parser.yy"
    86378647    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86388648    break;
     
    86418651
    86428652/* Line 1806 of yacc.c  */
    8643 #line 2385 "parser.yy"
     8653#line 2391 "parser.yy"
    86448654    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    86458655    break;
     
    86488658
    86498659/* Line 1806 of yacc.c  */
    8650 #line 2387 "parser.yy"
     8660#line 2393 "parser.yy"
    86518661    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    86528662    break;
     
    86558665
    86568666/* Line 1806 of yacc.c  */
    8657 #line 2389 "parser.yy"
     8667#line 2395 "parser.yy"
    86588668    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    86598669    break;
     
    86628672
    86638673/* Line 1806 of yacc.c  */
    8664 #line 2391 "parser.yy"
     8674#line 2397 "parser.yy"
    86658675    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86668676    break;
     
    86698679
    86708680/* Line 1806 of yacc.c  */
    8671 #line 2396 "parser.yy"
     8681#line 2402 "parser.yy"
    86728682    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    86738683    break;
     
    86768686
    86778687/* Line 1806 of yacc.c  */
    8678 #line 2398 "parser.yy"
     8688#line 2404 "parser.yy"
    86798689    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    86808690    break;
     
    86838693
    86848694/* Line 1806 of yacc.c  */
    8685 #line 2400 "parser.yy"
     8695#line 2406 "parser.yy"
    86868696    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86878697    break;
     
    86908700
    86918701/* Line 1806 of yacc.c  */
    8692 #line 2431 "parser.yy"
     8702#line 2437 "parser.yy"
    86938703    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    86948704    break;
     
    86978707
    86988708/* Line 1806 of yacc.c  */
    8699 #line 2434 "parser.yy"
     8709#line 2440 "parser.yy"
    87008710    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    87018711    break;
     
    87048714
    87058715/* Line 1806 of yacc.c  */
    8706 #line 2436 "parser.yy"
     8716#line 2442 "parser.yy"
    87078717    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    87088718    break;
     
    87118721
    87128722/* Line 1806 of yacc.c  */
    8713 #line 2441 "parser.yy"
     8723#line 2447 "parser.yy"
    87148724    {
    87158725                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    87218731
    87228732/* Line 1806 of yacc.c  */
    8723 #line 2446 "parser.yy"
     8733#line 2452 "parser.yy"
    87248734    {
    87258735                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    87318741
    87328742/* Line 1806 of yacc.c  */
    8733 #line 2454 "parser.yy"
     8743#line 2460 "parser.yy"
    87348744    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    87358745    break;
     
    87388748
    87398749/* Line 1806 of yacc.c  */
    8740 #line 2456 "parser.yy"
     8750#line 2462 "parser.yy"
    87418751    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    87428752    break;
     
    87458755
    87468756/* Line 1806 of yacc.c  */
    8747 #line 2458 "parser.yy"
     8757#line 2464 "parser.yy"
    87488758    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    87498759    break;
     
    87528762
    87538763/* Line 1806 of yacc.c  */
    8754 #line 2463 "parser.yy"
     8764#line 2469 "parser.yy"
    87558765    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    87568766    break;
     
    87598769
    87608770/* Line 1806 of yacc.c  */
    8761 #line 2465 "parser.yy"
     8771#line 2471 "parser.yy"
    87628772    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    87638773    break;
     
    87668776
    87678777/* Line 1806 of yacc.c  */
    8768 #line 2470 "parser.yy"
     8778#line 2476 "parser.yy"
    87698779    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    87708780    break;
     
    87738783
    87748784/* Line 1806 of yacc.c  */
    8775 #line 2472 "parser.yy"
     8785#line 2478 "parser.yy"
    87768786    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    87778787    break;
     
    87808790
    87818791/* Line 1806 of yacc.c  */
    8782 #line 2487 "parser.yy"
     8792#line 2493 "parser.yy"
    87838793    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    87848794    break;
     
    87878797
    87888798/* Line 1806 of yacc.c  */
    8789 #line 2489 "parser.yy"
     8799#line 2495 "parser.yy"
    87908800    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    87918801    break;
     
    87948804
    87958805/* Line 1806 of yacc.c  */
    8796 #line 2494 "parser.yy"
     8806#line 2500 "parser.yy"
    87978807    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    87988808    break;
     
    88018811
    88028812/* Line 1806 of yacc.c  */
    8803 #line 2496 "parser.yy"
     8813#line 2502 "parser.yy"
    88048814    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    88058815    break;
     
    88088818
    88098819/* Line 1806 of yacc.c  */
    8810 #line 2498 "parser.yy"
     8820#line 2504 "parser.yy"
    88118821    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    88128822    break;
     
    88158825
    88168826/* Line 1806 of yacc.c  */
    8817 #line 2500 "parser.yy"
     8827#line 2506 "parser.yy"
    88188828    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    88198829    break;
     
    88228832
    88238833/* Line 1806 of yacc.c  */
    8824 #line 2502 "parser.yy"
     8834#line 2508 "parser.yy"
    88258835    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    88268836    break;
     
    88298839
    88308840/* Line 1806 of yacc.c  */
    8831 #line 2508 "parser.yy"
     8841#line 2514 "parser.yy"
    88328842    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    88338843    break;
     
    88368846
    88378847/* Line 1806 of yacc.c  */
    8838 #line 2510 "parser.yy"
     8848#line 2516 "parser.yy"
    88398849    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    88408850    break;
     
    88438853
    88448854/* Line 1806 of yacc.c  */
    8845 #line 2512 "parser.yy"
     8855#line 2518 "parser.yy"
    88468856    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    88478857    break;
     
    88508860
    88518861/* Line 1806 of yacc.c  */
    8852 #line 2517 "parser.yy"
     8862#line 2523 "parser.yy"
    88538863    { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); }
    88548864    break;
     
    88578867
    88588868/* Line 1806 of yacc.c  */
    8859 #line 2519 "parser.yy"
     8869#line 2525 "parser.yy"
    88608870    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    88618871    break;
     
    88648874
    88658875/* Line 1806 of yacc.c  */
    8866 #line 2521 "parser.yy"
     8876#line 2527 "parser.yy"
    88678877    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    88688878    break;
     
    88718881
    88728882/* Line 1806 of yacc.c  */
    8873 #line 2527 "parser.yy"
     8883#line 2533 "parser.yy"
    88748884    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
    88758885    break;
     
    88788888
    88798889/* Line 1806 of yacc.c  */
    8880 #line 2529 "parser.yy"
     8890#line 2535 "parser.yy"
    88818891    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[(3) - (3)].decl) ); }
    88828892    break;
     
    88858895
    88868896/* Line 1806 of yacc.c  */
    8887 #line 2535 "parser.yy"
     8897#line 2541 "parser.yy"
    88888898    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); }
    88898899    break;
     
    88928902
    88938903/* Line 1806 of yacc.c  */
    8894 #line 2537 "parser.yy"
     8904#line 2543 "parser.yy"
    88958905    { (yyval.decl) = DeclarationNode::newVarArray( 0 ); }
    88968906    break;
     
    88998909
    89008910/* Line 1806 of yacc.c  */
    8901 #line 2539 "parser.yy"
     8911#line 2545 "parser.yy"
    89028912    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); }
    89038913    break;
     
    89068916
    89078917/* Line 1806 of yacc.c  */
    8908 #line 2541 "parser.yy"
     8918#line 2547 "parser.yy"
    89098919    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); }
    89108920    break;
     
    89138923
    89148924/* Line 1806 of yacc.c  */
    8915 #line 2556 "parser.yy"
     8925#line 2562 "parser.yy"
    89168926    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    89178927    break;
     
    89208930
    89218931/* Line 1806 of yacc.c  */
    8922 #line 2558 "parser.yy"
     8932#line 2564 "parser.yy"
    89238933    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    89248934    break;
     
    89278937
    89288938/* Line 1806 of yacc.c  */
    8929 #line 2563 "parser.yy"
     8939#line 2569 "parser.yy"
    89308940    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    89318941    break;
     
    89348944
    89358945/* Line 1806 of yacc.c  */
    8936 #line 2565 "parser.yy"
     8946#line 2571 "parser.yy"
    89378947    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    89388948    break;
     
    89418951
    89428952/* Line 1806 of yacc.c  */
    8943 #line 2567 "parser.yy"
     8953#line 2573 "parser.yy"
    89448954    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    89458955    break;
     
    89488958
    89498959/* Line 1806 of yacc.c  */
    8950 #line 2569 "parser.yy"
     8960#line 2575 "parser.yy"
    89518961    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    89528962    break;
     
    89558965
    89568966/* Line 1806 of yacc.c  */
    8957 #line 2571 "parser.yy"
     8967#line 2577 "parser.yy"
    89588968    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    89598969    break;
     
    89628972
    89638973/* Line 1806 of yacc.c  */
    8964 #line 2577 "parser.yy"
     8974#line 2583 "parser.yy"
    89658975    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    89668976    break;
     
    89698979
    89708980/* Line 1806 of yacc.c  */
    8971 #line 2579 "parser.yy"
     8981#line 2585 "parser.yy"
    89728982    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    89738983    break;
     
    89768986
    89778987/* Line 1806 of yacc.c  */
    8978 #line 2581 "parser.yy"
     8988#line 2587 "parser.yy"
    89798989    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    89808990    break;
     
    89838993
    89848994/* Line 1806 of yacc.c  */
    8985 #line 2586 "parser.yy"
     8995#line 2592 "parser.yy"
    89868996    { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); }
    89878997    break;
     
    89909000
    89919001/* Line 1806 of yacc.c  */
    8992 #line 2588 "parser.yy"
     9002#line 2594 "parser.yy"
    89939003    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    89949004    break;
     
    89979007
    89989008/* Line 1806 of yacc.c  */
    8999 #line 2590 "parser.yy"
     9009#line 2596 "parser.yy"
    90009010    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    90019011    break;
     
    90049014
    90059015/* Line 1806 of yacc.c  */
    9006 #line 2597 "parser.yy"
     9016#line 2603 "parser.yy"
    90079017    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    90089018    break;
     
    90119021
    90129022/* Line 1806 of yacc.c  */
    9013 #line 2608 "parser.yy"
     9023#line 2614 "parser.yy"
    90149024    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
    90159025    break;
     
    90189028
    90199029/* Line 1806 of yacc.c  */
    9020 #line 2611 "parser.yy"
     9030#line 2617 "parser.yy"
    90219031    { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
    90229032    break;
     
    90259035
    90269036/* Line 1806 of yacc.c  */
    9027 #line 2613 "parser.yy"
     9037#line 2619 "parser.yy"
    90289038    { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[(3) - (5)].decl), false ); }
    90299039    break;
     
    90329042
    90339043/* Line 1806 of yacc.c  */
    9034 #line 2616 "parser.yy"
     9044#line 2622 "parser.yy"
    90359045    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
    90369046    break;
     
    90399049
    90409050/* Line 1806 of yacc.c  */
    9041 #line 2618 "parser.yy"
     9051#line 2624 "parser.yy"
    90429052    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); }
    90439053    break;
     
    90469056
    90479057/* Line 1806 of yacc.c  */
    9048 #line 2620 "parser.yy"
     9058#line 2626 "parser.yy"
    90499059    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(3) - (7)].decl), true ); }
    90509060    break;
     
    90539063
    90549064/* Line 1806 of yacc.c  */
    9055 #line 2634 "parser.yy"
     9065#line 2640 "parser.yy"
    90569066    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    90579067    break;
     
    90609070
    90619071/* Line 1806 of yacc.c  */
    9062 #line 2636 "parser.yy"
     9072#line 2642 "parser.yy"
    90639073    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    90649074    break;
     
    90679077
    90689078/* Line 1806 of yacc.c  */
    9069 #line 2641 "parser.yy"
     9079#line 2647 "parser.yy"
    90709080    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    90719081    break;
     
    90749084
    90759085/* Line 1806 of yacc.c  */
    9076 #line 2643 "parser.yy"
     9086#line 2649 "parser.yy"
    90779087    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    90789088    break;
     
    90819091
    90829092/* Line 1806 of yacc.c  */
    9083 #line 2645 "parser.yy"
     9093#line 2651 "parser.yy"
    90849094    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    90859095    break;
     
    90889098
    90899099/* Line 1806 of yacc.c  */
    9090 #line 2647 "parser.yy"
     9100#line 2653 "parser.yy"
    90919101    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    90929102    break;
     
    90959105
    90969106/* Line 1806 of yacc.c  */
    9097 #line 2649 "parser.yy"
     9107#line 2655 "parser.yy"
    90989108    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    90999109    break;
     
    91029112
    91039113/* Line 1806 of yacc.c  */
    9104 #line 2655 "parser.yy"
     9114#line 2661 "parser.yy"
    91059115    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    91069116    break;
     
    91099119
    91109120/* Line 1806 of yacc.c  */
    9111 #line 2657 "parser.yy"
     9121#line 2663 "parser.yy"
    91129122    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    91139123    break;
     
    91169126
    91179127/* Line 1806 of yacc.c  */
    9118 #line 2659 "parser.yy"
     9128#line 2665 "parser.yy"
    91199129    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    91209130    break;
     
    91239133
    91249134/* Line 1806 of yacc.c  */
    9125 #line 2664 "parser.yy"
     9135#line 2670 "parser.yy"
    91269136    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    91279137    break;
     
    91309140
    91319141/* Line 1806 of yacc.c  */
    9132 #line 2666 "parser.yy"
     9142#line 2672 "parser.yy"
    91339143    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    91349144    break;
     
    91379147
    91389148/* Line 1806 of yacc.c  */
    9139 #line 2676 "parser.yy"
     9149#line 2682 "parser.yy"
    91409150    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    91419151    break;
     
    91449154
    91459155/* Line 1806 of yacc.c  */
    9146 #line 2686 "parser.yy"
     9156#line 2692 "parser.yy"
    91479157    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    91489158    break;
     
    91519161
    91529162/* Line 1806 of yacc.c  */
    9153 #line 2688 "parser.yy"
     9163#line 2694 "parser.yy"
    91549164    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    91559165    break;
     
    91589168
    91599169/* Line 1806 of yacc.c  */
    9160 #line 2690 "parser.yy"
     9170#line 2696 "parser.yy"
    91619171    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    91629172    break;
     
    91659175
    91669176/* Line 1806 of yacc.c  */
    9167 #line 2692 "parser.yy"
     9177#line 2698 "parser.yy"
    91689178    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    91699179    break;
     
    91729182
    91739183/* Line 1806 of yacc.c  */
    9174 #line 2694 "parser.yy"
     9184#line 2700 "parser.yy"
    91759185    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    91769186    break;
     
    91799189
    91809190/* Line 1806 of yacc.c  */
    9181 #line 2696 "parser.yy"
     9191#line 2702 "parser.yy"
    91829192    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    91839193    break;
     
    91869196
    91879197/* Line 1806 of yacc.c  */
    9188 #line 2703 "parser.yy"
     9198#line 2709 "parser.yy"
    91899199    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    91909200    break;
    91919201
    91929202  case 718:
    9193 
    9194 /* Line 1806 of yacc.c  */
    9195 #line 2705 "parser.yy"
    9196     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    9197     break;
    9198 
    9199   case 719:
    9200 
    9201 /* Line 1806 of yacc.c  */
    9202 #line 2707 "parser.yy"
    9203     { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9204     break;
    9205 
    9206   case 720:
    9207 
    9208 /* Line 1806 of yacc.c  */
    9209 #line 2709 "parser.yy"
    9210     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
    9211     break;
    9212 
    9213   case 721:
    92149203
    92159204/* Line 1806 of yacc.c  */
     
    92189207    break;
    92199208
     9209  case 719:
     9210
     9211/* Line 1806 of yacc.c  */
     9212#line 2713 "parser.yy"
     9213    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     9214    break;
     9215
     9216  case 720:
     9217
     9218/* Line 1806 of yacc.c  */
     9219#line 2715 "parser.yy"
     9220    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
     9221    break;
     9222
     9223  case 721:
     9224
     9225/* Line 1806 of yacc.c  */
     9226#line 2717 "parser.yy"
     9227    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
     9228    break;
     9229
    92209230  case 722:
    92219231
    92229232/* Line 1806 of yacc.c  */
    9223 #line 2713 "parser.yy"
     9233#line 2719 "parser.yy"
    92249234    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    92259235    break;
    92269236
    92279237  case 723:
    9228 
    9229 /* Line 1806 of yacc.c  */
    9230 #line 2715 "parser.yy"
    9231     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    9232     break;
    9233 
    9234   case 724:
    9235 
    9236 /* Line 1806 of yacc.c  */
    9237 #line 2717 "parser.yy"
    9238     { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9239     break;
    9240 
    9241   case 725:
    9242 
    9243 /* Line 1806 of yacc.c  */
    9244 #line 2719 "parser.yy"
    9245     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
    9246     break;
    9247 
    9248   case 726:
    92499238
    92509239/* Line 1806 of yacc.c  */
     
    92539242    break;
    92549243
     9244  case 724:
     9245
     9246/* Line 1806 of yacc.c  */
     9247#line 2723 "parser.yy"
     9248    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     9249    break;
     9250
     9251  case 725:
     9252
     9253/* Line 1806 of yacc.c  */
     9254#line 2725 "parser.yy"
     9255    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
     9256    break;
     9257
     9258  case 726:
     9259
     9260/* Line 1806 of yacc.c  */
     9261#line 2727 "parser.yy"
     9262    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
     9263    break;
     9264
    92559265  case 727:
    92569266
    92579267/* Line 1806 of yacc.c  */
    9258 #line 2726 "parser.yy"
     9268#line 2732 "parser.yy"
    92599269    { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
    92609270    break;
     
    92639273
    92649274/* Line 1806 of yacc.c  */
    9265 #line 2728 "parser.yy"
     9275#line 2734 "parser.yy"
    92669276    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
    92679277    break;
     
    92709280
    92719281/* Line 1806 of yacc.c  */
    9272 #line 2733 "parser.yy"
     9282#line 2739 "parser.yy"
    92739283    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); }
    92749284    break;
     
    92779287
    92789288/* Line 1806 of yacc.c  */
    9279 #line 2735 "parser.yy"
     9289#line 2741 "parser.yy"
    92809290    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); }
    92819291    break;
     
    92849294
    92859295/* Line 1806 of yacc.c  */
    9286 #line 2762 "parser.yy"
     9296#line 2768 "parser.yy"
    92879297    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    92889298    break;
     
    92919301
    92929302/* Line 1806 of yacc.c  */
    9293 #line 2773 "parser.yy"
     9303#line 2779 "parser.yy"
    92949304    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    92959305    break;
     
    92989308
    92999309/* Line 1806 of yacc.c  */
    9300 #line 2775 "parser.yy"
     9310#line 2781 "parser.yy"
    93019311    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    93029312    break;
     
    93059315
    93069316/* Line 1806 of yacc.c  */
    9307 #line 2777 "parser.yy"
     9317#line 2783 "parser.yy"
    93089318    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    93099319    break;
     
    93129322
    93139323/* Line 1806 of yacc.c  */
    9314 #line 2779 "parser.yy"
     9324#line 2785 "parser.yy"
    93159325    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    93169326    break;
     
    93199329
    93209330/* Line 1806 of yacc.c  */
    9321 #line 2781 "parser.yy"
     9331#line 2787 "parser.yy"
    93229332    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    93239333    break;
     
    93269336
    93279337/* Line 1806 of yacc.c  */
    9328 #line 2783 "parser.yy"
     9338#line 2789 "parser.yy"
    93299339    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    93309340    break;
    93319341
    93329342  case 742:
    9333 
    9334 /* Line 1806 of yacc.c  */
    9335 #line 2790 "parser.yy"
    9336     { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9337     break;
    9338 
    9339   case 743:
    9340 
    9341 /* Line 1806 of yacc.c  */
    9342 #line 2792 "parser.yy"
    9343     { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    9344     break;
    9345 
    9346   case 744:
    9347 
    9348 /* Line 1806 of yacc.c  */
    9349 #line 2794 "parser.yy"
    9350     { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    9351     break;
    9352 
    9353   case 745:
    93549343
    93559344/* Line 1806 of yacc.c  */
     
    93589347    break;
    93599348
    9360   case 746:
     9349  case 743:
    93619350
    93629351/* Line 1806 of yacc.c  */
     
    93659354    break;
    93669355
    9367   case 747:
     9356  case 744:
    93689357
    93699358/* Line 1806 of yacc.c  */
     
    93729361    break;
    93739362
     9363  case 745:
     9364
     9365/* Line 1806 of yacc.c  */
     9366#line 2802 "parser.yy"
     9367    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     9368    break;
     9369
     9370  case 746:
     9371
     9372/* Line 1806 of yacc.c  */
     9373#line 2804 "parser.yy"
     9374    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
     9375    break;
     9376
     9377  case 747:
     9378
     9379/* Line 1806 of yacc.c  */
     9380#line 2806 "parser.yy"
     9381    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
     9382    break;
     9383
    93749384  case 748:
    93759385
    93769386/* Line 1806 of yacc.c  */
    9377 #line 2805 "parser.yy"
     9387#line 2811 "parser.yy"
    93789388    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); }
    93799389    break;
     
    93829392
    93839393/* Line 1806 of yacc.c  */
    9384 #line 2810 "parser.yy"
     9394#line 2816 "parser.yy"
    93859395    { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[(4) - (5)].decl), 0 ); }
    93869396    break;
     
    93899399
    93909400/* Line 1806 of yacc.c  */
    9391 #line 2812 "parser.yy"
     9401#line 2818 "parser.yy"
    93929402    { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0 ); }
    93939403    break;
     
    93969406
    93979407/* Line 1806 of yacc.c  */
    9398 #line 2814 "parser.yy"
     9408#line 2820 "parser.yy"
    93999409    { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0 ); }
    94009410    break;
     
    94039413
    94049414/* Line 1806 of yacc.c  */
    9405 #line 2838 "parser.yy"
     9415#line 2844 "parser.yy"
    94069416    { (yyval.en) = 0; }
    94079417    break;
     
    94109420
    94119421/* Line 1806 of yacc.c  */
    9412 #line 2840 "parser.yy"
     9422#line 2846 "parser.yy"
    94139423    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    94149424    break;
     
    94179427
    94189428/* Line 1806 of yacc.c  */
    9419 #line 9420 "Parser/parser.cc"
     9429#line 9430 "Parser/parser.cc"
    94209430      default: break;
    94219431    }
     
    96489658
    96499659/* Line 2067 of yacc.c  */
    9650 #line 2843 "parser.yy"
     9660#line 2849 "parser.yy"
    96519661
    96529662// ----end of grammar----
  • src/Parser/parser.h

    r5070fe4 rc331406  
    274274        LabelNode *label;
    275275        InitializerNode *in;
     276        OperatorNode::Type op;
    276277        bool flag;
    277278
     
    279280
    280281/* Line 2068 of yacc.c  */
    281 #line 282 "Parser/parser.h"
     282#line 283 "Parser/parser.h"
    282283} YYSTYPE;
    283284# define YYSTYPE_IS_TRIVIAL 1
  • src/Parser/parser.yy

    r5070fe4 rc331406  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 23 17:01:30 2016
    13 // Update Count     : 1668
     12// Last Modified On : Fri Aug  5 08:15:57 2016
     13// Update Count     : 1721
    1414//
    1515
     
    119119        LabelNode *label;
    120120        InitializerNode *in;
     121        OperatorNode::Type op;
    121122        bool flag;
    122123}
     
    129130%type<constant> constant
    130131%type<en> tuple                                                 tuple_expression_list
    131 %type<en> ptrref_operator                               unary_operator                          assignment_operator
     132%type<op> ptrref_operator
     133%type<en> unary_operator                                assignment_operator
    132134%type<en> primary_expression                    postfix_expression                      unary_expression
    133135%type<en> cast_expression                               multiplicative_expression       additive_expression                     shift_expression
     
    150152%type<sn> block_item_list                               block_item
    151153%type<sn> case_clause
    152 %type<en> case_value                                    case_value_list
    153 %type<sn> case_label                                    case_label_list
     154%type<en> case_value
     155%type<sn> case_value_list                               case_label                                      case_label_list
    154156%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
    155157%type<pn> handler_list                                  handler_clause                          finally_clause
     
    354356                // little advantage to this feature and many disadvantages. It is possible to write x[(i,j)] in CFA, which is
    355357                // equivalent to the old x[i,j].
    356                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Index ), $1, $4 ); }
     358                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Index, $1, $4 ) ); }
    357359        | postfix_expression '(' argument_expression_list ')'
    358360                { $$ = new CompositeExprNode( $1, $3 ); }
     
    360362                //   struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1;
    361363        | postfix_expression '.' no_attr_identifier
    362                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), $1, new VarRefNode( $3 )); }
     364                { $$ = new CompositeExprNode2( build_fieldSel( $1, new VarRefNode( $3 ) ) ); }
    363365        | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
    364366        | postfix_expression ARROW no_attr_identifier
    365                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), $1, new VarRefNode( $3 )); }
     367                { $$ = new CompositeExprNode2( build_pfieldSel( $1, new VarRefNode( $3 ) ) ); }
    366368        | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
    367369        | postfix_expression ICR
    368                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::IncrPost ), $1 ); }
     370                { $$ = new CompositeExprNode2( build_opr1( OperatorNode::IncrPost, $1 ) ); }
    369371        | postfix_expression DECR
    370                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::DecrPost ), $1 ); }
     372                { $$ = new CompositeExprNode2( build_opr1( OperatorNode::DecrPost, $1 ) ); }
    371373        | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99
    372374                { $$ = new CompoundLiteralNode( $2, new InitializerNode( $5, true ) ); }
     
    410412                //   struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1;
    411413        | no_attr_identifier '.' field
    412                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( $1 ), $3 ); }
     414                { $$ = new CompositeExprNode2( build_fieldSel( $3, new VarRefNode( $1 ) ) ); }
    413415        | no_attr_identifier '.' '[' push field_list pop ']'
    414                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( $1 ), $5 ); }
     416                { $$ = new CompositeExprNode2( build_fieldSel( $5, new VarRefNode( $1 ) ) ); }
    415417        | no_attr_identifier ARROW field
    416                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), new VarRefNode( $1 ), $3 ); }
     418                { $$ = new CompositeExprNode2( build_pfieldSel( $3, new VarRefNode( $1 ) ) ); }
    417419        | no_attr_identifier ARROW '[' push field_list pop ']'
    418                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), new VarRefNode( $1 ), $5 ); }
     420                { $$ = new CompositeExprNode2( build_pfieldSel( $5, new VarRefNode( $1 ) ) ); }
    419421        ;
    420422
     
    429431        | EXTENSION cast_expression                                                     // GCC
    430432                { $$ = $2->set_extension( true ); }
    431         | ptrref_operator cast_expression                                       // CFA
    432                 { $$ = new CompositeExprNode( $1, $2 ); }
    433433                // '*' ('&') is separated from unary_operator because of shift/reduce conflict in:
    434434                //              { * X; }         // dereference X
    435435                //              { * int X; } // CFA declaration of pointer to int
     436        | ptrref_operator cast_expression                                       // CFA
     437                { $$ = $1 == OperatorNode::AddressOf ? (ExpressionNode*) new CompositeExprNode2( build_addressOf( $2 ) )
     438                                                                                        : (ExpressionNode*)new CompositeExprNode( new OperatorNode ( $1 ), $2 ); }
    436439        | unary_operator cast_expression
    437440                { $$ = new CompositeExprNode( $1, $2 ); }
    438441        | ICR unary_expression
    439                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Incr ), $2 ); }
     442                { $$ = new CompositeExprNode2( build_opr1( OperatorNode::Incr, $2 ) ); }
    440443        | DECR unary_expression
    441                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Decr ), $2 ); }
     444                { $$ = new CompositeExprNode2( build_opr1( OperatorNode::Decr, $2 ) ); }
    442445        | SIZEOF unary_expression
    443                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), $2 ); }
     446                { $$ = new CompositeExprNode2( build_sizeOf( $2 ) ); }
    444447        | SIZEOF '(' type_name_no_function ')'
    445                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( $3 )); }
     448                { $$ = new CompositeExprNode2( build_sizeOf( new TypeValueNode( $3 ) ) ); }
    446449        | OFFSETOF '(' type_name_no_function ',' no_attr_identifier ')'
    447                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); }
     450                { $$ = new CompositeExprNode2( build_offsetOf( new TypeValueNode( $3 ), new VarRefNode( $5 ) ) ); }
    448451        | ATTR_IDENTIFIER
    449                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 )); }
     452                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 ) ); }
    450453        | ATTR_IDENTIFIER '(' type_name ')'
    451                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 ), new TypeValueNode( $3 )); }
     454                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 ), new TypeValueNode( $3 ) ); }
    452455        | ATTR_IDENTIFIER '(' argument_expression ')'
    453456                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 ), $3 ); }
    454457        | ALIGNOF unary_expression                                                      // GCC, variable alignment
    455                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), $2 ); }
     458                { $$ = new CompositeExprNode2( build_alignOf( $2 ) ); }
    456459        | ALIGNOF '(' type_name_no_function ')'                         // GCC, type alignment
    457                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); }
     460                { $$ = new CompositeExprNode2( build_alignOf( new TypeValueNode( $3 ) ) ); }
    458461//      | ANDAND IDENTIFIER                                                                     // GCC, address of label
    459462//              { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); }
     
    461464
    462465ptrref_operator:
    463         '*'                                                                                     { $$ = new OperatorNode( OperatorNode::PointTo ); }
    464         | '&'                                                                           { $$ = new OperatorNode( OperatorNode::AddressOf ); }
     466        '*'                                                                                     { $$ = OperatorNode::PointTo; }
     467        | '&'                                                                           { $$ = OperatorNode::AddressOf; }
    465468                // GCC, address of label must be handled by semantic check for ref,ref,label
    466         | ANDAND                                                                        { $$ = new OperatorNode( OperatorNode::And ); }
     469        | ANDAND                                                                        { $$ = OperatorNode::And; }
    467470        ;
    468471
     
    477480        unary_expression
    478481        | '(' type_name_no_function ')' cast_expression
    479                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Cast ), new TypeValueNode( $2 ), $4 ); }
     482                { $$ = new CompositeExprNode2( build_cast( new TypeValueNode( $2 ), $4 ) ); }
    480483        | '(' type_name_no_function ')' tuple
    481                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Cast ), new TypeValueNode( $2 ), $4 ); }
     484                { $$ = new CompositeExprNode2( build_cast( new TypeValueNode( $2 ), $4 ) ); }
    482485        ;
    483486
     
    485488        cast_expression
    486489        | multiplicative_expression '*' cast_expression
    487                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Mul ), $1, $3 ); }
     490                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Mul, $1, $3 ) ); }
    488491        | multiplicative_expression '/' cast_expression
    489                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Div ), $1, $3 ); }
     492                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Div, $1, $3 ) ); }
    490493        | multiplicative_expression '%' cast_expression
    491                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Mod ), $1, $3 ); }
     494                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Mod, $1, $3 ) ); }
    492495        ;
    493496
     
    495498        multiplicative_expression
    496499        | additive_expression '+' multiplicative_expression
    497                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Plus ), $1, $3 ); }
     500                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Plus, $1, $3 ) ); }
    498501        | additive_expression '-' multiplicative_expression
    499                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Minus ), $1, $3 ); }
     502                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Minus, $1, $3 ) ); }
    500503        ;
    501504
     
    503506        additive_expression
    504507        | shift_expression LS additive_expression
    505                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LShift ), $1, $3 ); }
     508                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::LShift, $1, $3 ) ); }
    506509        | shift_expression RS additive_expression
    507                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::RShift ), $1, $3 ); }
     510                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::RShift, $1, $3 ) ); }
    508511        ;
    509512
     
    511514        shift_expression
    512515        | relational_expression '<' shift_expression
    513                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LThan ), $1, $3 ); }
     516                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::LThan, $1, $3 ) ); }
    514517        | relational_expression '>' shift_expression
    515                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::GThan ), $1, $3 ); }
     518                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::GThan, $1, $3 ) ); }
    516519        | relational_expression LE shift_expression
    517                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LEThan ), $1, $3 ); }
     520                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::LEThan, $1, $3 ) ); }
    518521        | relational_expression GE shift_expression
    519                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::GEThan ), $1, $3 ); }
     522                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::GEThan, $1, $3 ) ); }
    520523        ;
    521524
     
    523526        relational_expression
    524527        | equality_expression EQ relational_expression
    525                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Eq ), $1, $3 ); }
     528                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Eq, $1, $3 ) ); }
    526529        | equality_expression NE relational_expression
    527                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Neq ), $1, $3 ); }
     530                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Neq, $1, $3 ) ); }
    528531        ;
    529532
     
    531534        equality_expression
    532535        | AND_expression '&' equality_expression
    533                 { $$ =new CompositeExprNode( new OperatorNode( OperatorNode::BitAnd ), $1, $3 ); }
     536                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::BitAnd, $1, $3 ) ); }
    534537        ;
    535538
     
    537540        AND_expression
    538541        | exclusive_OR_expression '^' AND_expression
    539                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Xor ), $1, $3 ); }
     542                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Xor, $1, $3 ) ); }
    540543        ;
    541544
     
    543546        exclusive_OR_expression
    544547        | inclusive_OR_expression '|' exclusive_OR_expression
    545                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::BitOr ), $1, $3 ); }
     548                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::BitOr, $1, $3 ) ); }
    546549        ;
    547550
     
    549552        inclusive_OR_expression
    550553        | logical_AND_expression ANDAND inclusive_OR_expression
    551                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::And ), $1, $3 ); }
     554                { $$ = new CompositeExprNode2( build_and_or( $1, $3, true ) ); }
    552555        ;
    553556
     
    555558        logical_AND_expression
    556559        | logical_OR_expression OROR logical_AND_expression
    557                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Or ), $1, $3 ); }
     560                { $$ = new CompositeExprNode2( build_and_or( $1, $3, false ) ); }
    558561        ;
    559562
     
    561564        logical_OR_expression
    562565        | logical_OR_expression '?' comma_expression ':' conditional_expression
    563                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Cond ), (ExpressionNode *)mkList( (*$1, *$3, *$5 ) ) ); }
     566                { $$ = new CompositeExprNode2( build_cond( $1, $3, $5 ) ); }
    564567        | logical_OR_expression '?' /* empty */ ':' conditional_expression // GCC, omitted first operand
    565                 { $$=new CompositeExprNode( new OperatorNode( OperatorNode::NCond ), $1, $4 ); }
     568                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::NCond ), $1, $4 ); }
    566569        | logical_OR_expression '?' comma_expression ':' tuple // CFA, tuple expression
    567                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Cond ), (ExpressionNode *)mkList( (*$1, *$3, *$5 ) ) ); }
     570                { $$ = new CompositeExprNode2( build_cond( $1, $3, $5 ) ); }
    568571        ;
    569572
     
    576579        conditional_expression
    577580        | unary_expression '=' assignment_expression
    578                 { $$ =new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), $1, $3 ); }
     581                { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), $1, $3 ); }
    579582        | unary_expression assignment_operator assignment_expression
    580                 { $$ =new CompositeExprNode( $2, $1, $3 ); }
     583                { $$ = new CompositeExprNode( $2, $1, $3 ); }
    581584        | tuple assignment_opt                                                          // CFA, tuple expression
    582585                { $$ = ( $2 == 0 ) ? $1 : new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), $1, $2 ); }
     
    624627        assignment_expression
    625628        | comma_expression ',' assignment_expression    // { $$ = (ExpressionNode *)$1->add_to_list( $3 ); }
    626                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Comma ), $1, $3 ); }
     629        //{ $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Comma ), $1, $3 ); }
     630                { $$ = new CompositeExprNode2( build_comma( $1, $3 ) ); }
    627631        ;
    628632
     
    717721                        // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound
    718722                        // statement around the switch.  Statements after the initial declaration list can never be executed, and
    719                         // therefore, are removed from the grammar even though C allows it. Change also applies to choose statement.
     723                        // therefore, are removed from the grammar even though C allows it. The change also applies to choose
     724                        // statement.
    720725                        $$ = $7 != 0 ? new CompoundStmtNode( (StatementNode *)((new StatementNode( $7 ))->set_link( sw )) ) : sw;
    721726                }
     
    735740        constant_expression                                                     { $$ = $1; }
    736741        | constant_expression ELLIPSIS constant_expression      // GCC, subrange
    737                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Range ), $1, $3 ); }
     742                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Range, $1, $3 ) ); }
    738743        | subrange                                                                                      // CFA, subrange
    739744        ;
    740745
    741746case_value_list:                                                                                // CFA
    742         case_value
    743         | case_value_list ',' case_value
    744                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(tupleContents( $1 ))->set_link( $3 ) ); }
     747        case_value                                                                      { $$ = new StatementNode( StatementNode::Case, $1, 0 ); }
     748                // convert case list, e.g., "case 1, 3, 5:" into "case 1: case 3: case 5"
     749        | case_value_list ',' case_value                        { $$ = (StatementNode *)($1->set_link( new StatementNode( StatementNode::Case, $3, 0 ) ) ); }
    745750        ;
    746751
    747752case_label:                                                                                             // CFA
    748         CASE case_value_list ':'                                        { $$ = new StatementNode( StatementNode::Case, $2, 0 ); }
     753        CASE case_value_list ':'                                        { $$ = $2; }
    749754        | DEFAULT ':'                                                           { $$ = new StatementNode( StatementNode::Default ); }
    750755                // A semantic check is required to ensure only one default clause per switch/choose statement.
     
    17761781                { $$ = new DesignatorNode( $3, true ); }
    17771782        | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements
    1778                 { $$ = new DesignatorNode( new CompositeExprNode( new OperatorNode( OperatorNode::Range ), $3, $5 ), true ); }
     1783                { $$ = new DesignatorNode( new CompositeExprNode2( build_opr2( OperatorNode::Range, $3, $5 ) ), true ); }
    17791784        | '.' '[' push field_list pop ']'                                       // CFA, tuple field selector
    17801785                { $$ = new DesignatorNode( $4 ); }
     
    21052110subrange:
    21062111        constant_expression '~' constant_expression                     // CFA, integer subrange
    2107                 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Range ), $1, $3 ); }
     2112                { $$ = new CompositeExprNode2( build_opr2( OperatorNode::Range, $1, $3 ) ); }
    21082113        ;
    21092114
  • src/ResolvExpr/Resolver.cc

    r5070fe4 rc331406  
    2424#include "SynTree/Initializer.h"
    2525#include "SymTab/Indexer.h"
     26#include "SymTab/Autogen.h"
    2627#include "Common/utility.h"
    2728#include "InitTweak/InitTweak.h"
     
    4142
    4243                virtual void visit( ArrayType * at );
     44                virtual void visit( PointerType * at );
    4345
    4446                virtual void visit( ExprStmt *exprStmt );
     
    5254                virtual void visit( BranchStmt *branchStmt );
    5355                virtual void visit( ReturnStmt *returnStmt );
    54                 virtual void visit( ImplicitCtorDtorStmt * impCtorDtorStmt );
    5556
    5657                virtual void visit( SingleInit *singleInit );
     
    5960          private:
    6061        typedef std::list< Initializer * >::iterator InitIterator;
     62
     63                template< typename PtrType >
     64                void handlePtrType( PtrType * type );
    6165
    6266          void resolveAggrInit( AggregateDecl *, InitIterator &, InitIterator & );
     
    192196        }
    193197
     198        template< typename PtrType >
     199        void Resolver::handlePtrType( PtrType * type ) {
     200                if ( type->get_dimension() ) {
     201                        CastExpr *castExpr = new CastExpr( type->get_dimension(), SymTab::SizeType->clone() );
     202                        Expression *newExpr = findSingleExpression( castExpr, *this );
     203                        delete type->get_dimension();
     204                        type->set_dimension( newExpr );
     205                }
     206        }
     207
    194208        void Resolver::visit( ArrayType * at ) {
    195                 if ( at->get_dimension() ) {
    196                         BasicType arrayLenType = BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
    197                         CastExpr *castExpr = new CastExpr( at->get_dimension(), arrayLenType.clone() );
    198                         Expression *newExpr = findSingleExpression( castExpr, *this );
    199                         delete at->get_dimension();
    200                         at->set_dimension( newExpr );
    201                 }
     209                handlePtrType( at );
    202210                Visitor::visit( at );
     211        }
     212
     213        void Resolver::visit( PointerType * pt ) {
     214                handlePtrType( pt );
     215                Visitor::visit( pt );
    203216        }
    204217
     
    422435
    423436        void Resolver::visit( ListInit * listInit ) {
    424                 InitIterator iter = listInit->begin_initializers();
    425                 InitIterator end = listInit->end_initializers();
     437                InitIterator iter = listInit->begin();
     438                InitIterator end = listInit->end();
    426439
    427440                if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) {
     
    521534                // implicitly generated, there's no way for it to have side effects, so get rid of it
    522535                // to clean up generated code.
    523                 if ( InitTweak::isInstrinsicSingleArgCallStmt( ctorInit->get_ctor() ) ) {
     536                if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->get_ctor() ) ) {
    524537                        delete ctorInit->get_ctor();
    525538                        ctorInit->set_ctor( NULL );
    526539                }
    527                 if ( InitTweak::isInstrinsicSingleArgCallStmt( ctorInit->get_ctor() ) ) {
     540
     541                // xxx - todo
     542                // if ( InitTweak::isIntrinsicCallStmt( ctorInit->get_ctor() ) ) {
     543                //      // can reduce the constructor down to a SingleInit using the
     544                //      // second argument from the ctor call
     545                // }
     546
     547                if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->get_dtor() ) ) {
    528548                        delete ctorInit->get_dtor();
    529549                        ctorInit->set_dtor( NULL );
    530550                }
    531         }
    532 
    533         void Resolver::visit( ImplicitCtorDtorStmt * impCtorDtorStmt ) {
    534                 // before resolving ctor/dtor, need to remove type qualifiers from the first argument (the object being constructed).
    535                 // Do this through a cast expression to greatly simplify the code.
    536                 Expression * callExpr = InitTweak::getCtorDtorCall( impCtorDtorStmt );
    537                 assert( callExpr );
    538                 Expression *& constructee = InitTweak::getCallArg( callExpr, 0 );
    539                 Type * type = 0;
    540 
    541                 // need to find the type of the first argument, which is unfortunately not uniform since array construction
    542                 // includes an untyped '+' expression.
    543                 if ( UntypedExpr * plusExpr = dynamic_cast< UntypedExpr * >( constructee ) ) {
    544                         // constructee is <array>+<index>
    545                         // get Variable <array>, then get the base type of the VariableExpr - this is the type that needs to be fixed
    546                         Expression * arr = InitTweak::getCallArg( plusExpr, 0 );
    547                         assert( dynamic_cast< VariableExpr * >( arr ) || dynamic_cast< MemberExpr *>( arr ) );
    548                         assert( arr && arr->get_results().size() == 1 );
    549                         type = arr->get_results().front()->clone();
    550                 } else {
    551                         // otherwise, constructing a plain object, which means the object's address is being taken.
    552                         // Need to get the type of the VariableExpr object, because the AddressExpr is rebuilt and uses the
    553                         // type of the VariableExpr to do so.
    554                         assert( constructee->get_results().size() == 1 );
    555                         AddressExpr * addrExpr = dynamic_cast< AddressExpr * > ( constructee );
    556                         assert( addrExpr && addrExpr->get_results().size() == 1 );
    557                         type = addrExpr->get_results().front()->clone();
    558                 }
    559                 // cast to T* with qualifiers removed.
    560                 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument
    561                 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever
    562                 // remove lvalue as a qualifier, this can change to
    563                 //   type->get_qualifiers() = Type::Qualifiers();
    564                 Type * base = InitTweak::getPointerBase( type );
    565                 assert( base );
    566                 base->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true, true);
    567                 // if pointer has lvalue qualifier, cast won't appear in output
    568                 type->set_isLvalue( false );
    569                 constructee = new CastExpr( constructee, type );
    570 
    571                 // finally, resolve the ctor/dtor
    572                 impCtorDtorStmt->get_callStmt()->accept( *this );
    573551        }
    574552} // namespace ResolvExpr
  • src/SymTab/AddVisit.h

    r5070fe4 rc331406  
    1010// Created On       : Sun May 17 16:14:32 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:46:33 2016
    13 // Update Count     : 6
     12// Last Modified On : Thu Aug  4 11:22:01 2016
     13// Update Count     : 9
    1414//
    1515
     
    3333        template< typename Visitor >
    3434        inline void addVisit(SwitchStmt *switchStmt, Visitor &visitor) {
    35                 addVisitStatementList( switchStmt->get_branches(), visitor );
     35                addVisitStatementList( switchStmt->get_statements(), visitor );
    3636                maybeAccept( switchStmt->get_condition(), visitor );
    3737        }
  • src/SymTab/Autogen.cc

    r5070fe4 rc331406  
    2626
    2727namespace SymTab {
     28        Type * SizeType = 0;
     29
    2830        class AutogenerateRoutines : public Visitor {
    2931                public:
     
    5961        bool isUnnamedBitfield( ObjectDecl * obj ) {
    6062                return obj != NULL && obj->get_name() == "" && obj->get_bitfieldWidth() != NULL;
    61         }
    62 
    63         template< typename OutputIterator >
    64         void makeScalarFunction( Expression *src, ObjectDecl *dstParam, DeclarationWithType *member, std::string fname, OutputIterator out ) {
    65                 ObjectDecl *obj = dynamic_cast<ObjectDecl *>( member );
    66                 // unnamed bit fields are not copied as they cannot be accessed
    67                 if ( isUnnamedBitfield( obj ) ) return;
    68 
    69                 // want to be able to generate assignment, ctor, and dtor generically,
    70                 // so fname is either ?=?, ?{}, or ^?{}
    71                 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );
    72 
    73                 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) );
    74                 derefExpr->get_args().push_back( new VariableExpr( dstParam ) );
    75 
    76                 // do something special for unnamed members
    77                 Expression *dstselect = new AddressExpr( new MemberExpr( member, derefExpr ) );
    78                 fExpr->get_args().push_back( dstselect );
    79 
    80                 if ( src ) {
    81                         fExpr->get_args().push_back( src );
    82                 }
    83 
    84                 Statement * callStmt = new ExprStmt( noLabels, fExpr );
    85                 if ( (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) ) ) {
    86                         // implicitly generated ctor/dtor calls should be wrapped
    87                         // so that later passes are aware they were generated.
    88                         // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield,
    89                         // because this causes the address to be taken at codegen, which is illegal in C.
    90                         callStmt = new ImplicitCtorDtorStmt( callStmt );
    91                 }
    92                 *out++ = callStmt;
    9363        }
    9464
     
    219189                }
    220190
     191                InitTweak::InitExpander srcParam( src );
     192
    221193                // assign to destination (and return value if generic)
    222                 if ( ArrayType *array = dynamic_cast< ArrayType * >( field->get_type() ) ) {
    223                         UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) );
    224                         derefExpr->get_args().push_back( new VariableExpr( dstParam ) );
    225                         Expression *dstselect = new MemberExpr( field, derefExpr );
    226 
    227                         makeArrayFunction( src, dstselect, array, func->get_name(), back_inserter( func->get_statements()->get_kids() ), forward );
    228                         if ( isDynamicLayout && returnVal ) {
    229                                 UntypedExpr *derefRet = new UntypedExpr( new NameExpr( "*?" ) );
    230                                 derefRet->get_args().push_back( new VariableExpr( returnVal ) );
    231                                 Expression *retselect = new MemberExpr( field, derefRet );
    232 
    233                                 makeArrayFunction( src, retselect, array, func->get_name(), back_inserter( func->get_statements()->get_kids() ), forward );
    234                         }
    235                 } else {
    236                         makeScalarFunction( src, dstParam, field, func->get_name(), back_inserter( func->get_statements()->get_kids() ) );
    237                         if ( isDynamicLayout && returnVal ) makeScalarFunction( src, returnVal, field, func->get_name(), back_inserter( func->get_statements()->get_kids() ) );
     194                UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) );
     195                derefExpr->get_args().push_back( new VariableExpr( dstParam ) );
     196                Expression *dstselect = new MemberExpr( field, derefExpr );
     197                genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward );
     198
     199                if ( isDynamicLayout && returnVal ) {
     200                        UntypedExpr *derefRet = new UntypedExpr( new NameExpr( "*?" ) );
     201                        derefRet->get_args().push_back( new VariableExpr( returnVal ) );
     202                        Expression *retselect = new MemberExpr( field, derefRet );
     203                        genImplicitCall( srcParam, retselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward );
    238204                } // if
    239205        }
  • src/SymTab/Autogen.h

    r5070fe4 rc331406  
    2222#include "SynTree/Declaration.h"
    2323#include "SynTree/Initializer.h"
     24#include "InitTweak/InitTweak.h"
    2425
    2526namespace SymTab {
    26   /// Generates assignment operators, constructors, and destructor for aggregate types as required
    27   void autogenerateRoutines( std::list< Declaration * > &translationUnit );
     27        /// Generates assignment operators, constructors, and destructor for aggregate types as required
     28        void autogenerateRoutines( std::list< Declaration * > &translationUnit );
    2829
    29   // originally makeArrayAssignment - changed to Function because it is now used for ctors and dtors as well
    30   // admittedly not a great name change. This used to live in Validate.cc, but has been moved so it can be reused elsewhere
     30        /// returns true if obj's name is the empty string and it has a bitfield width
     31        bool isUnnamedBitfield( ObjectDecl * obj );
    3132
    32   /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments.
    33   /// If forward is true, loop goes from 0 to N-1, else N-1 to 0
    34   template< typename OutputIterator >
    35   void makeArrayFunction( Expression *srcParam, Expression *dstParam, ArrayType *array, std::string fname, OutputIterator out, bool forward = true ) {
    36     static UniqueName indexName( "_index" );
     33        /// size_t type - set when size_t typedef is seen. Useful in a few places,
     34        /// such as in determining array dimension type
     35        extern Type * SizeType;
    3736
    38     // for a flexible array member nothing is done -- user must define own assignment
    39     if ( ! array->get_dimension() ) return;
     37        /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls.
     38        template< typename OutputIterator >
     39        Statement * genCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false, bool forward = true );
    4040
    41     Expression * begin, * end, * update, * cmp;
    42     if ( forward ) {
    43       // generate: for ( int i = 0; i < 0; ++i )
    44       begin = new NameExpr( "0" );
    45       end = array->get_dimension()->clone();
    46       cmp = new NameExpr( "?<?" );
    47       update = new NameExpr( "++?" );
    48     } else {
    49       // generate: for ( int i = N-1; i >= 0; --i )
    50       begin = new UntypedExpr( new NameExpr( "?-?" ) );
    51       ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() );
    52       ((UntypedExpr*)begin)->get_args().push_back( new NameExpr( "1" ) );
    53       end = new NameExpr( "0" );
    54       cmp = new NameExpr( "?>=?" );
    55       update = new NameExpr( "--?" );
    56     }
     41        /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Should only be called with non-array types.
     42        /// optionally returns a statement which must be inserted prior to the containing loop, if there is one
     43        template< typename OutputIterator >
     44        Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) {
     45                // want to be able to generate assignment, ctor, and dtor generically,
     46                // so fname is either ?=?, ?{}, or ^?{}
     47                UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );
    5748
    58     ObjectDecl *index = new ObjectDecl( indexName.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), NULL );
     49                // do something special for unnamed members
     50                dstParam = new AddressExpr( dstParam );
     51                if ( addCast ) {
     52                        // cast to T* with qualifiers removed, so that qualified objects can be constructed
     53                        // and destructed with the same functions as non-qualified objects.
     54                        // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument
     55                        // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever
     56                        // remove lvalue as a qualifier, this can change to
     57                        //   type->get_qualifiers() = Type::Qualifiers();
     58                        assert( type );
     59                        Type * castType = type->clone();
     60                        castType->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true, true);
     61                        castType->set_isLvalue( true ); // xxx - might not need this
     62                        dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) );
     63                }
     64                fExpr->get_args().push_back( dstParam );
    5965
    60     UntypedExpr *init = new UntypedExpr( new NameExpr( "?=?" ) );
    61     init->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) );
    62     init->get_args().push_back( begin );
    63     index->set_init( new SingleInit( init, std::list<Expression*>() ) );
     66                Statement * listInit = srcParam.buildListInit( fExpr );
    6467
    65     UntypedExpr *cond = new UntypedExpr( cmp );
    66     cond->get_args().push_back( new VariableExpr( index ) );
    67     cond->get_args().push_back( end );
     68                std::list< Expression * > args = *++srcParam;
     69                fExpr->get_args().splice( fExpr->get_args().end(), args );
    6870
    69     UntypedExpr *inc = new UntypedExpr( update );
    70     inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) );
     71                *out++ = new ExprStmt( noLabels, fExpr );
    7172
    72     // want to be able to generate assignment, ctor, and dtor generically,
    73     // so fname is either ?=?, ?{}, or ^?{}
    74     UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) );
     73                srcParam.clearArrayIndices();
    7574
    76     UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?+?" ) );
    77     dstIndex->get_args().push_back( dstParam );
    78     dstIndex->get_args().push_back( new VariableExpr( index ) );
    79     fExpr->get_args().push_back( dstIndex );
     75                return listInit;
     76        }
    8077
    81     // srcParam is NULL for default ctor/dtor
    82     if ( srcParam ) {
    83       UntypedExpr *srcIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
    84       srcIndex->get_args().push_back( srcParam );
    85       srcIndex->get_args().push_back( new VariableExpr( index ) );
    86       fExpr->get_args().push_back( srcIndex );
    87     }
     78        /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments.
     79        /// If forward is true, loop goes from 0 to N-1, else N-1 to 0
     80        template< typename OutputIterator >
     81        void genArrayCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, ArrayType *array, bool addCast = false, bool forward = true ) {
     82                static UniqueName indexName( "_index" );
    8883
    89     std::list<Statement *> initList;
    90     CompoundStmt * block = new CompoundStmt( noLabels );
    91     block->get_kids().push_back( new DeclStmt( noLabels, index ) );
    92     block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, new ExprStmt( noLabels, fExpr ) ) );
     84                // for a flexible array member nothing is done -- user must define own assignment
     85                if ( ! array->get_dimension() ) return ;
    9386
    94     Statement * stmt = block;
    95     if ( fname == "?{}" || fname == "^?{}" ) {
    96       // implicitly generated ctor/dtor calls should be wrapped
    97       // so that later passes are aware they were generated
    98       stmt = new ImplicitCtorDtorStmt( stmt );
    99     }
    100     *out++ = stmt;
    101   }
     87                Expression * begin, * end, * update, * cmp;
     88                if ( forward ) {
     89                        // generate: for ( int i = 0; i < 0; ++i )
     90                        begin = new NameExpr( "0" );
     91                        end = array->get_dimension()->clone();
     92                        cmp = new NameExpr( "?<?" );
     93                        update = new NameExpr( "++?" );
     94                } else {
     95                        // generate: for ( int i = N-1; i >= 0; --i )
     96                        begin = new UntypedExpr( new NameExpr( "?-?" ) );
     97                        ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() );
     98                        ((UntypedExpr*)begin)->get_args().push_back( new NameExpr( "1" ) );
     99                        end = new NameExpr( "0" );
     100                        cmp = new NameExpr( "?>=?" );
     101                        update = new NameExpr( "--?" );
     102                }
     103
     104                ObjectDecl *index = new ObjectDecl( indexName.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), NULL );
     105
     106                UntypedExpr *init = new UntypedExpr( new NameExpr( "?=?" ) );
     107                init->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) );
     108                init->get_args().push_back( begin );
     109                index->set_init( new SingleInit( init, std::list<Expression*>() ) );
     110
     111                UntypedExpr *cond = new UntypedExpr( cmp );
     112                cond->get_args().push_back( new VariableExpr( index ) );
     113                cond->get_args().push_back( end );
     114
     115                UntypedExpr *inc = new UntypedExpr( update );
     116                inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) );
     117
     118                UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) );
     119                dstIndex->get_args().push_back( dstParam );
     120                dstIndex->get_args().push_back( new VariableExpr( index ) );
     121                dstParam = dstIndex;
     122
     123                // srcParam must keep track of the array indices to build the
     124                // source parameter and/or array list initializer
     125                srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone() );
     126
     127                // for stmt's body, eventually containing call
     128                CompoundStmt * body = new CompoundStmt( noLabels );
     129                Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward );
     130
     131                // block containing for stmt and index variable
     132                std::list<Statement *> initList;
     133                CompoundStmt * block = new CompoundStmt( noLabels );
     134                block->get_kids().push_back( new DeclStmt( noLabels, index ) );
     135                if ( listInit ) block->get_kids().push_back( listInit );
     136                block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) );
     137
     138                *out++ = block;
     139        }
     140
     141        template< typename OutputIterator >
     142        Statement * genCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) {
     143                if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) {
     144                        genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward );
     145                        return 0;
     146                } else {
     147                        return genScalarCall( srcParam, dstParam, fname, out, type, addCast );
     148                }
     149        }
     150
     151        /// inserts into out a generated call expression to function fname with arguments dstParam
     152        /// and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. decl is the
     153        /// object being constructed. The function wraps constructor and destructor calls in an
     154        /// ImplicitCtorDtorStmt node.
     155        template< typename OutputIterator >
     156        void genImplicitCall( InitTweak::InitExpander &  srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) {
     157                ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl );
     158                assert( obj );
     159                // unnamed bit fields are not copied as they cannot be accessed
     160                if ( isUnnamedBitfield( obj ) ) return;
     161
     162                bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) );
     163                std::list< Statement * > stmts;
     164                genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward );
     165
     166                // currently genCall should produce at most one element, but if that changes then the next line needs to be updated to grab the statement which contains the call
     167                assert( stmts.size() <= 1 );
     168                if ( stmts.size() == 1 ) {
     169                        Statement * callStmt = stmts.front();
     170                        if ( addCast ) {
     171                                // implicitly generated ctor/dtor calls should be wrapped
     172                                // so that later passes are aware they were generated.
     173                                // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield,
     174                                // because this causes the address to be taken at codegen, which is illegal in C.
     175                                callStmt = new ImplicitCtorDtorStmt( callStmt );
     176                        }
     177                        *out++ = callStmt;
     178                }
     179        }
    102180} // namespace SymTab
    103181#endif // AUTOGEN_H
  • src/SymTab/FixFunction.cc

    r5070fe4 rc331406  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FixFunction.cc -- 
     7// FixFunction.cc --
    88//
    99// Author           : Richard C. Bilson
     
    4444
    4545        Type * FixFunction::mutate(ArrayType *arrayType) {
    46                 PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), maybeClone( arrayType->get_base()->clone() ), maybeClone( arrayType->get_dimension() ), arrayType->get_isVarLen(), arrayType->get_isStatic() );
     46                // need to recursively mutate the base type in order for multi-dimensional arrays to work.
     47                PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->get_base()->clone()->acceptMutator( *this ), maybeClone( arrayType->get_dimension() ), arrayType->get_isVarLen(), arrayType->get_isStatic() );
    4748                delete arrayType;
    4849                return pointerType;
  • src/SymTab/Validate.cc

    r5070fe4 rc331406  
    174174
    175175                virtual void visit( FunctionDecl *funcDecl );
    176 };
     176        };
    177177
    178178        class CompoundLiteral : public GenPoly::DeclMutator {
     
    191191                EliminateTypedef::eliminateTypedef( translationUnit );
    192192                HoistStruct::hoistStruct( translationUnit );
     193                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs Pass1
    193194                acceptAll( translationUnit, pass1 );
    194195                acceptAll( translationUnit, pass2 );
    195196                ReturnChecker::checkFunctionReturns( translationUnit );
    196                 mutateAll( translationUnit, compoundliteral );
    197                 autogenerateRoutines( translationUnit );
     197                compoundliteral.mutateDeclarationList( translationUnit );
    198198                acceptAll( translationUnit, pass3 );
    199199                VerifyCtorDtor::verify( translationUnit );
     
    490490                EliminateTypedef eliminator;
    491491                mutateAll( translationUnit, eliminator );
     492                if ( eliminator.typedefNames.count( "size_t" ) ) {
     493                        // grab and remember declaration of size_t
     494                        SizeType = eliminator.typedefNames["size_t"].first->get_base()->clone();
     495                } else {
     496                        // xxx - missing global typedef for size_t - default to long unsigned int, even though that may be wrong
     497                        // eventually should have a warning for this case.
     498                        SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );
     499                }
    492500                filter( translationUnit, isTypedef, true );
     501
    493502        }
    494503
     
    518527        Declaration *EliminateTypedef::mutate( TypedefDecl * tyDecl ) {
    519528                Declaration *ret = Mutator::mutate( tyDecl );
     529
    520530                if ( typedefNames.count( tyDecl->get_name() ) == 1 && typedefNames[ tyDecl->get_name() ].second == scopeLevel ) {
    521531                        // typedef to the same name from the same scope
  • src/SynTree/AddStmtVisitor.cc

    r5070fe4 rc331406  
    1010// Created On       : Wed Jun 22 12:11:17 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:49:59 2016
    13 // Update Count     : 12
     12// Last Modified On : Thu Aug  4 11:23:47 2016
     13// Update Count     : 16
    1414//
    1515
     
    7171
    7272void AddStmtVisitor::visit(SwitchStmt *switchStmt) {
    73         visitStatementList( switchStmt->get_branches() );
     73        visitStatementList( switchStmt->get_statements() );
    7474        maybeAccept( switchStmt->get_condition(), *this );
    7575}
  • src/SynTree/Declaration.cc

    r5070fe4 rc331406  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Declaration.cc -- 
     7// Declaration.cc --
    88//
    99// Author           : Richard C. Bilson
     
    2020#include "Initializer.h"
    2121#include "Type.h"
     22#include "Attribute.h"
    2223#include "Common/utility.h"
    2324
  • src/SynTree/Declaration.h

    r5070fe4 rc331406  
    6464class DeclarationWithType : public Declaration {
    6565  public:
    66         DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage );
     66        DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, const std::list< Attribute * > & attributes );
    6767        DeclarationWithType( const DeclarationWithType &other );
    6868        virtual ~DeclarationWithType();
     
    7575        int get_scopeLevel() const { return scopeLevel; }
    7676        void set_scopeLevel( int newValue ) { scopeLevel = newValue; }
     77
     78        std::list< Attribute * >& get_attributes() { return attributes; }
     79        const std::list< Attribute * >& get_attributes() const { return attributes; }
    7780
    7881        virtual DeclarationWithType *clone() const = 0;
     
    8790        // shadowed identifiers can be accessed
    8891        int scopeLevel = 0;
     92
     93        std::list< Attribute * > attributes;
    8994};
    9095
     
    9297        typedef DeclarationWithType Parent;
    9398  public:
    94         ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline = false, bool isNoreturn = false );
     99        ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes = std::list< Attribute * >(), bool isInline = false, bool isNoreturn = false );
    95100        ObjectDecl( const ObjectDecl &other );
    96101        virtual ~ObjectDecl();
     
    131136        std::list< std::string >& get_oldIdents() { return oldIdents; }
    132137        std::list< Declaration* >& get_oldDecls() { return oldDecls; }
    133         std::list< Attribute * >& get_attributes() { return attributes; }
    134138
    135139        virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); }
     
    143147        std::list< std::string > oldIdents;
    144148        std::list< Declaration* > oldDecls;
    145         std::list< Attribute * > attributes;
    146149};
    147150
  • src/SynTree/DeclarationWithType.cc

    r5070fe4 rc331406  
    1616#include "Declaration.h"
    1717#include "Type.h"
     18#include "Attribute.h"
    1819#include "Common/utility.h"
    1920
    20 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage )
    21                 : Declaration( name, sc, linkage ) {
     21DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, const std::list< Attribute * > & attributes )
     22                : Declaration( name, sc, linkage ), attributes( attributes ) {
    2223}
    2324
    2425DeclarationWithType::DeclarationWithType( const DeclarationWithType &other )
    2526                : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ) {
     27        cloneAll( other.attributes, attributes );
    2628}
    2729
    2830DeclarationWithType::~DeclarationWithType() {
     31        deleteAll( attributes );
    2932}
    3033
  • src/SynTree/Expression.cc

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun 13 16:03:39 2016
    13 // Update Count     : 42
     12// Last Modified On : Wed Aug  3 17:06:51 2016
     13// Update Count     : 45
    1414//
    1515
     
    344344}
    345345
     346//// is this right? It's cloning the member, but the member is a declaration so probably shouldn't be cloned...
    346347MemberExpr::MemberExpr( const MemberExpr &other ) :
    347                 Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) {
     348                Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) {
    348349}
    349350
    350351MemberExpr::~MemberExpr() {
    351         delete member;
     352        // delete member;
    352353        delete aggregate;
    353354}
     
    528529}
    529530
     531RangeExpr::RangeExpr( ConstantExpr *low, ConstantExpr *high ) : low( low ), high( high ) {}
     532RangeExpr::RangeExpr( const RangeExpr &other ) : low( other.low->clone() ), high( other.high->clone() ) {}
     533void RangeExpr::print( std::ostream &os, int indent ) const {
     534        os << std::string( indent, ' ' ) << "Range Expression: ";
     535        low->print( os, indent );
     536        os << " ... ";
     537        high->print( os, indent );
     538}
    530539
    531540std::ostream & operator<<( std::ostream & out, Expression * expr ) {
  • src/SynTree/Expression.h

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jul  4 14:45:32 2016
    13 // Update Count     : 23
     12// Last Modified On : Wed Aug  3 17:08:44 2016
     13// Update Count     : 27
    1414//
    1515
     
    1818
    1919#include <map>
     20#include <memory>
    2021#include "SynTree.h"
    2122#include "Visitor.h"
     
    634635};
    635636
     637class RangeExpr : public Expression {
     638  public:
     639        RangeExpr( ConstantExpr *low, ConstantExpr *high );
     640        RangeExpr( const RangeExpr &other );
     641
     642        ConstantExpr * get_low() const { return low.get(); }
     643        ConstantExpr * get_high() const { return high.get(); }
     644        RangeExpr * set_low( ConstantExpr *low ) { RangeExpr::low.reset( low ); return this; }
     645        RangeExpr * set_high( ConstantExpr *high ) { RangeExpr::high.reset( high ); return this; }
     646
     647        virtual RangeExpr *clone() const { return new RangeExpr( *this ); }
     648        virtual void accept( Visitor &v ) { v.visit( this ); }
     649        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     650        virtual void print( std::ostream &os, int indent = 0 ) const;
     651  private:
     652        std::unique_ptr<ConstantExpr> low, high;
     653};
     654
    636655std::ostream & operator<<( std::ostream & out, Expression * expr );
    637656
  • src/SynTree/FunctionDecl.cc

    r5070fe4 rc331406  
    2323
    2424FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes )
    25                 : Parent( name, sc, linkage ), type( type ), statements( statements ), attributes( attributes ) {
     25                : Parent( name, sc, linkage, attributes ), type( type ), statements( statements ) {
    2626        set_isInline( isInline );
    2727        set_isNoreturn( isNoreturn );
     
    3434FunctionDecl::FunctionDecl( const FunctionDecl &other )
    3535        : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) {
    36                 cloneAll( other.attributes, attributes );
    3736}
    3837
     
    4039        delete type;
    4140        delete statements;
    42         deleteAll( attributes );
    4341}
    4442
     
    6967        } // if
    7068
    71         printAll( attributes, os, indent );
     69        printAll( get_attributes(), os, indent );
    7270
    7371        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
  • src/SynTree/Initializer.h

    r5070fe4 rc331406  
    9393        std::list<Initializer*> &get_initializers() { return initializers; }
    9494
    95         std::list<Initializer*>::iterator begin_initializers() { return initializers.begin(); }
    96         std::list<Initializer*>::iterator end_initializers() { return initializers.end(); }
     95        typedef std::list<Initializer*>::iterator iterator;
     96        iterator begin() { return initializers.begin(); }
     97        iterator end() { return initializers.end(); }
    9798
    9899        virtual ListInit *clone() const { return new ListInit( *this ); }
  • src/SynTree/Label.h

    r5070fe4 rc331406  
    2424class Label {
    2525  public:
    26         Label( const std::string & name = "", Statement * labelled = 0 ) : name( name ), labelled( labelled ) {}
     26        Label( const std::string & name = "", Statement * labelled = 0, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : name( name ), labelled( labelled ), attributes( attributes ) {}
    2727        Label( const char * name, Statement * labelled = 0 ) : name( name ), labelled( labelled ) {}
    2828
  • src/SynTree/Mutator.cc

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:51:19 2016
    13 // Update Count     : 17
     12// Last Modified On : Thu Aug  4 11:23:21 2016
     13// Update Count     : 19
    1414//
    1515
     
    126126Statement *Mutator::mutate( SwitchStmt *switchStmt ) {
    127127        switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) );
    128         mutateAll( switchStmt->get_branches(), *this );
     128        mutateAll( switchStmt->get_statements(), *this );
    129129        return switchStmt;
    130130}
     
    349349        compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) );
    350350        return compLitExpr;
     351}
     352
     353Expression *Mutator::mutate( RangeExpr *rangeExpr ) {
     354        rangeExpr->set_low( maybeMutate( rangeExpr->get_low(), *this ) );
     355        rangeExpr->set_high( maybeMutate( rangeExpr->get_high(), *this ) );
     356        return rangeExpr;
    351357}
    352358
  • src/SynTree/Mutator.h

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:51:43 2016
    13 // Update Count     : 11
     12// Last Modified On : Wed Aug  3 16:59:45 2016
     13// Update Count     : 12
    1414//
    1515#include <cassert>
     
    7878        virtual Expression* mutate( UntypedValofExpr *valofExpr );
    7979        virtual Expression* mutate( CompoundLiteralExpr *compLitExpr );
     80        virtual Expression* mutate( RangeExpr *rangeExpr );
    8081
    8182        virtual Type* mutate( VoidType *basicType );
  • src/SynTree/ObjectDecl.cc

    r5070fe4 rc331406  
    1818#include "Initializer.h"
    1919#include "Expression.h"
     20#include "Attribute.h"
    2021#include "Common/utility.h"
    2122#include "Statement.h"
    2223
    23 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline, bool isNoreturn )
    24         : Parent( name, sc, linkage ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
     24ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes, bool isInline, bool isNoreturn )
     25        : Parent( name, sc, linkage, attributes ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {
    2526        set_isInline( isInline );
    2627        set_isNoreturn( isNoreturn );
     
    4546                os << LinkageSpec::toString( get_linkage() ) << " ";
    4647        } // if
     48
     49        printAll( get_attributes(), os, indent );
    4750
    4851        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
     
    8083        } // if
    8184
     85        // xxx - should printShort print attributes?
     86
    8287        if ( get_storageClass() != DeclarationNode::NoStorageClass ) {
    8388                os << DeclarationNode::storageName[ get_storageClass() ] << ' ';
  • src/SynTree/Statement.cc

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:52:32 2016
    13 // Update Count     : 55
     12// Last Modified On : Thu Aug  4 11:25:20 2016
     13// Update Count     : 61
    1414//
    1515
     
    143143}
    144144
    145 SwitchStmt::SwitchStmt( std::list<Label> _labels, Expression * _condition, std::list<Statement *> &_branches ):
    146         Statement( _labels ), condition( _condition ), branches( _branches ) {
     145SwitchStmt::SwitchStmt( std::list<Label> _labels, Expression * _condition, std::list<Statement *> &_statements ):
     146        Statement( _labels ), condition( _condition ), statements( _statements ) {
    147147}
    148148
    149149SwitchStmt::SwitchStmt( const SwitchStmt & other ):
    150150        Statement( other ), condition( maybeClone( other.condition ) ) {
    151         cloneAll( other.branches, branches );
     151        cloneAll( other.statements, statements );
    152152}
    153153
    154154SwitchStmt::~SwitchStmt() {
    155155        delete condition;
    156         // destroy branches
    157 }
    158 
    159 void SwitchStmt::add_case( CaseStmt *c ) {}
     156        // destroy statements
     157}
    160158
    161159void SwitchStmt::print( std::ostream &os, int indent ) const {
     
    164162        os << endl;
    165163
    166         // branches
     164        // statements
    167165        std::list<Statement *>::const_iterator i;
    168         for ( i = branches.begin(); i != branches.end(); i++)
     166        for ( i = statements.begin(); i != statements.end(); i++)
    169167                (*i)->print( os, indent + 4 );
    170168
    171         //for_each( branches.begin(), branches.end(), mem_fun( bind1st(&Statement::print ), os ));
     169        //for_each( statements.begin(), statements.end(), mem_fun( bind1st(&Statement::print ), os ));
    172170}
    173171
     
    187185}
    188186
    189 CaseStmt * CaseStmt::makeDefault( std::list<Label> labels, std::list<Statement *> branches ) {
    190         return new CaseStmt( labels, 0, branches, true );
     187CaseStmt * CaseStmt::makeDefault( std::list<Label> labels, std::list<Statement *> stmts ) {
     188        return new CaseStmt( labels, 0, stmts, true );
    191189}
    192190
  • src/SynTree/Statement.h

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:53:29 2016
    13 // Update Count     : 47
     12// Last Modified On : Thu Aug  4 11:26:02 2016
     13// Update Count     : 64
    1414//
    1515
     
    129129class SwitchStmt : public Statement {
    130130  public:
    131         SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &branches );
     131        SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements );
    132132        SwitchStmt( const SwitchStmt &other );
    133133        virtual ~SwitchStmt();
     
    136136        void set_condition( Expression *newValue ) { condition = newValue; }
    137137
    138         std::list<Statement *> & get_branches() { return branches; }
    139         void add_case( CaseStmt * );
     138        std::list<Statement *> & get_statements() { return statements; }
    140139
    141140        virtual void accept( Visitor &v ) { v.visit( this ); }
     
    146145  private:
    147146        Expression * condition;
    148         std::list<Statement *> branches; // should be list of CaseStmt
     147        std::list<Statement *> statements;
    149148};
    150149
    151150class CaseStmt : public Statement {
    152151  public:
    153         CaseStmt( std::list<Label> labels, Expression *conditions,
    154               std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
     152        CaseStmt( std::list<Label> labels, Expression *conditions, std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError);
    155153        CaseStmt( const CaseStmt &other );
    156154        virtual ~CaseStmt();
    157155
    158         static CaseStmt * makeDefault( std::list<Label> labels = std::list<Label>(),
    159                 std::list<Statement *> stmts = std::list<Statement *>() );
     156        static CaseStmt * makeDefault( std::list<Label> labels = std::list<Label>(), std::list<Statement *> stmts = std::list<Statement *>() );
    160157
    161158        bool isDefault() const { return _isDefault; }
  • src/SynTree/SynTree.h

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:54:02 2016
    13 // Update Count     : 6
     12// Last Modified On : Wed Aug  3 17:02:34 2016
     13// Update Count     : 7
    1414//
    1515
     
    8383class UntypedValofExpr;
    8484class CompoundLiteralExpr;
     85class RangeExpr;
    8586
    8687class Type;
  • src/SynTree/Visitor.cc

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:54:39 2016
    13 // Update Count     : 19
     12// Last Modified On : Thu Aug  4 11:24:25 2016
     13// Update Count     : 21
    1414//
    1515
     
    109109void Visitor::visit( SwitchStmt *switchStmt ) {
    110110        maybeAccept( switchStmt->get_condition(), *this );
    111         acceptAll( switchStmt->get_branches(), *this );
     111        acceptAll( switchStmt->get_statements(), *this );
    112112}
    113113
     
    296296        maybeAccept( compLitExpr->get_type(), *this );
    297297        maybeAccept( compLitExpr->get_initializer(), *this );
     298}
     299
     300void Visitor::visit( RangeExpr *rangeExpr ) {
     301        maybeAccept( rangeExpr->get_low(), *this );
     302        maybeAccept( rangeExpr->get_high(), *this );
    298303}
    299304
  • src/SynTree/Visitor.h

    r5070fe4 rc331406  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jul 12 17:55:09 2016
    13 // Update Count     : 8
     12// Last Modified On : Wed Aug  3 17:01:50 2016
     13// Update Count     : 9
    1414//
    1515
     
    7878        virtual void visit( UntypedValofExpr *valofExpr );
    7979        virtual void visit( CompoundLiteralExpr *compLitExpr );
     80        virtual void visit( RangeExpr *rangeExpr );
    8081
    8182        virtual void visit( VoidType *basicType );
  • src/examples/gc_no_raii/bug-repro/return_template.c

    r5070fe4 rc331406  
    55};
    66
     7forall(otype T) void ?{}(wrap(T)* this);
     8forall(otype T) void ?{}(wrap(T)* this, wrap(T)* rhs);
     9forall(otype T) void ^?{}(wrap(T)* this);
     10forall(otype T) void ?=?(wrap(T)* this, wrap(T)* rhs);
     11
    712forall(otype T)
    8 static inline wrap(T) test()
     13wrap(T) test()
    914{
    1015        wrap(T) tester;
  • src/examples/gc_no_raii/src/gc.h

    r5070fe4 rc331406  
    77static inline gcpointer(T) gcmalloc()
    88{
    9     gcpointer(T) test;
    10     // ctor(&test, gc_allocate(sizeof(T)));
    11     // gc_conditional_collect();
    12     return test;
     9    gcpointer(T) ptr;
     10    void* address = gc_allocate(sizeof(T));
     11    (&ptr){ address };
     12    ctor(&ptr, address);
     13    gc_conditional_collect();
     14    return ptr;
    1315}
  • src/examples/gc_no_raii/src/gcpointers.c

    r5070fe4 rc331406  
    11#include "gcpointers.h"
    22
    3 #include "gc.h"
     3// #include "gc.h"
    44#include "internal/collector.h"
    55#include "internal/object_header.h"
  • src/examples/gc_no_raii/src/gcpointers.h

    r5070fe4 rc331406  
    1010};
    1111
    12 void gcpointer_ctor(gcpointer_t* this);
    13 void gcpointer_ctor(gcpointer_t* this, void* address);
    14 void gcpointer_ctor(gcpointer_t* this, gcpointer_t* other);
    15 void gcpointer_dtor(gcpointer_t* this);
    16 gcpointer_t* gcpointer_assign(gcpointer_t* this, gcpointer_t* rhs);
     12void ?{}(gcpointer_t* this);
     13void ?{}(gcpointer_t* this, void* address);
     14void ?{}(gcpointer_t* this, gcpointer_t other);
     15void ^?{}(gcpointer_t* this);
     16gcpointer_t* ?=?(gcpointer_t this, gcpointer_t rhs);
    1717
    1818//Logical operators
     
    2727};
    2828
    29 forall(otype T)
    30 static inline void ctor(gcpointer(T)* this)
    31 {
    32         gcpointer_ctor(&this->internal);
    33 }
     29//
     30forall(otype T) void ?{}(gcpointer(T)* this);
     31forall(otype T) void ?{}(gcpointer(T)* this, void* address);
     32forall(otype T) void ctor(gcpointer(T)* this, void* address);
     33forall(otype T) void ?{}(gcpointer(T)* this, gcpointer(T)* other);
     34forall(otype T) void ^?{}(gcpointer(T)* this);
     35forall(otype T) gcpointer(T) ?=?(gcpointer(T) this, gcpointer(T) rhs);
    3436
    35 // forall(otype T)
    36 // static inline void ctor(gcpointer(T)* this, int null)
    37 // {
    38 //      gcpointer_ctor(&this->internal, NULL);
    39 // }
    4037
    41 forall(otype T)
    42 static inline void ctor(gcpointer(T)* this, void* address)
    43 {
    44         gcpointer_ctor(&this->internal, address);
    45 }
    46 
    47 forall(otype T)
    48 static inline void ctor(gcpointer(T)* this, gcpointer(T)* other)
    49 {
    50         gcpointer_ctor(&this->internal, other);
    51 }
    52 
    53 forall(otype T)
    54 static inline void dtor(gcpointer(T)* this)
    55 {
    56         gcpointer_dtor(&this->internal);
    57 }
    58 
    59 forall(otype T)
    60 static inline gcpointer(T)* ?=?(gcpointer(T)* this, gcpointer(T)* rhs)
    61 {
    62         gcpointer_assign(&this->internal, &rhs->internal);
    63         return this;
    64 }
    65 
    66 forall(otype T)
    67 static inline T *?(gcpointer(T) this)
    68 {
    69         return *(T*)this.internal.ptr;
    70 }
     38forall(otype T) T *?(gcpointer(T) this);
    7139
    7240//Logical operators
    73 forall(otype T)
    74 static inline int ?!=?(gcpointer(T) this, gcpointer(T) rhs)
    75 {
    76         return this.internal.ptr != rhs.internal.ptr;
    77 }
    78 
    79 forall(otype T)
    80 static inline int ?==?(gcpointer(T) this, gcpointer(T) rhs)
    81 {
    82         return !(this == rhs);
    83 }
    84 
    85 forall(otype T)
    86 extern struct gcpointer(T) 0;
     41forall(otype T) int ?!=?(gcpointer(T) this, gcpointer(T) rhs);
     42forall(otype T) int ?==?(gcpointer(T) this, gcpointer(T) rhs);
  • src/examples/gc_no_raii/src/internal/memory_pool.h

    r5070fe4 rc331406  
    33extern "C" {
    44#include <stdbool.h>
     5#include <stddef.h>
    56#include <stdint.h>
    67}
  • src/examples/gc_no_raii/src/internal/state.h

    r5070fe4 rc331406  
    11#pragma once
    22
     3#ifdef __cforall
     4extern "C" {
     5#endif
    36#include <stddef.h>
    47#include <stdint.h>
     8#ifdef __cforall
     9}
     10#endif
     11#include <vector>
    512
    613#include "tools.h"
    7 #include "vector.h"
    814
    915typedef vector(struct gc_memory_pool*, heap_allocator(struct gc_memory_pool*)) pools_table_t;
  • src/examples/gc_no_raii/src/tools/worklist.h

    r5070fe4 rc331406  
    1010#endif
    1111
    12 #include "vector.h"
     12#include <vector>
    1313
    1414typedef vector(intptr_t*, heap_allocator(intptr_t*)) worklist_t;
  • src/examples/gc_no_raii/test/badlll.c

    r5070fe4 rc331406  
    77};
    88
     9void ?{}(List_t* this);
     10List_t* ?=?(List_t* this, List_t* rhs);
     11
    912typedef gcpointer(List_t) LLL;
    1013
    1114#define MAX (1024 * 1024)
    1215
    13 LLL buildLLL(int sz)
     16// LLL buildLLL(int sz)
     17void bla()
    1418{
    1519        int i;
    16         LLL ll0, lll, llc;
    17 
    18         ll0 = gcmalloc();
    19         ll0->val = 0;
    20         lll = ll0;
    21 
    22         for (i = 1; i < sz; i++)
    23         {
    24                 llc = gcmalloc();
    25                 llc->val = i;
    26                 lll->next = llc;
    27                 lll = llc;
    28         }
    29 
    30         return ll0;
     20        // LLL ll0;//, lll, llc;
     21//
     22//      ll0 = gcmalloc();
     23//      ll0->val = 0;
     24//      lll = ll0;
     25//
     26//      for (i = 1; i < sz; i++)
     27//      {
     28//              llc = gcmalloc();
     29//              llc->val = i;
     30//              lll->next = llc;
     31//              lll = llc;
     32//      }
     33//
     34        // return ll0;
    3135}
    32 
    33 void testLLL(LLL lll)
    34 {
    35         unsigned char *counted;
    36 
    37         counted = (unsigned char *) calloc(MAX, sizeof(unsigned char));
    38         while (lll)
    39         {
    40                 counted[lll->val]++;
    41                 if (counted[lll->val] > 1)
    42                 {
    43                         fprintf(stderr, "ERROR! Encountered %d twice!\n", lll->val);
    44                         exit(1);
    45                 }
    46                 lll = lll->next;
    47         }
    48 
    49         return;
    50 }
     36//
     37// void testLLL(LLL lll)
     38// {
     39//      unsigned char *counted;
     40//
     41//      counted = (unsigned char *) calloc(MAX, sizeof(unsigned char));
     42//      while (lll)
     43//      {
     44//              counted[lll->val]++;
     45//              if (counted[lll->val] > 1)
     46//              {
     47//                      fprintf(stderr, "ERROR! Encountered %d twice!\n", lll->val);
     48//                      exit(1);
     49//              }
     50//              lll = lll->next;
     51//      }
     52//
     53//      return;
     54// }
    5155
    5256int main(void)
     
    5458        LLL mylll;
    5559
    56         mylll = buildLLL(MAX);
    57 
    58         testLLL(mylll);
     60        // mylll = buildLLL(MAX);
     61        //
     62        // testLLL(mylll);
    5963
    6064        return 0;
  • src/examples/gc_no_raii/test/gctest.c

    r5070fe4 rc331406  
    77int main() {
    88        sout | "Bonjour au monde!\n";
     9
     10        gcpointer(int) anInt = gcmalloc();
    911}
  • src/main.cc

    r5070fe4 rc331406  
    4343#include "InitTweak/GenInit.h"
    4444#include "InitTweak/FixInit.h"
    45 #include "InitTweak/FixGlobalInit.h"
    4645//#include "Explain/GenProlog.h"
    4746//#include "Try/Visit.h"
     
    283282                OPTPRINT( "fixNames" )
    284283                CodeGen::fixNames( translationUnit );
    285                 OPTPRINT( "fixGlobalInit" );
    286                 InitTweak::fixGlobalInit( translationUnit, filename, libcfap || treep );
    287284                OPTPRINT( "tweakInit" )
    288285                InitTweak::genInit( translationUnit );
     
    305302                }
    306303
     304                // fix ObjectDecl - replaces ConstructorInit nodes
    307305                OPTPRINT( "fixInit" )
    308                 // fix ObjectDecl - replaces ConstructorInit nodes
    309                 InitTweak::fix( translationUnit );
     306                InitTweak::fix( translationUnit, filename, libcfap || treep );
    310307                if ( ctorinitp ) {
    311308                        dump ( translationUnit );
  • src/tests/.expect/64/extension.txt

    r5070fe4 rc331406  
    100100    ((void)((__extension__ __a__i_2 , __extension__ __b__i_2) , __extension__ __c__i_2));
    101101}
    102 __attribute__ ((constructor(),)) static void _init_extension(void){
    103     int _global_init0;
    104     ((void)((*((int *)(&__a__i_1)))=_global_init0) /* ?{} */);
    105     int _global_init1;
    106     ((void)((*((int *)(&__b__i_1)))=_global_init1) /* ?{} */);
    107     int _global_init2;
    108     ((void)((*((int *)(&__c__i_1)))=_global_init2) /* ?{} */);
    109 }
    110 __attribute__ ((destructor(),)) static void _destroy_extension(void){
    111     ((void)((*((int *)(&__c__i_1)))) /* ^?{} */);
    112     ((void)((*((int *)(&__b__i_1)))) /* ^?{} */);
    113     ((void)((*((int *)(&__a__i_1)))) /* ^?{} */);
    114 }
  • src/tests/init_once.c

    r5070fe4 rc331406  
    9292init_once y = x;
    9393
     94void static_variable() {
     95        static init_once x;
     96}
     97
    9498int main() {
    9599        // local variables
     
    179183                }
    180184        }
     185
     186        // function-scoped static variable
     187        for (int i = 0; i < 10; i++) {
     188                static_variable();
     189        }
    181190}
    182191
  • src/tests/switch.c

    r5070fe4 rc331406  
    1010// Created On       : Tue Jul 12 06:50:22 2016
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Jul 30 14:41:32 2016
    13 // Update Count     : 30
     12// Last Modified On : Thu Aug  4 11:44:29 2016
     13// Update Count     : 31
    1414//
    1515
     
    3939          case 4:
    4040                j = 0;
     41        }
     42
     43        switch ( i ) {
     44          case 1, 2, 3:
     45                switch ( i ) {
     46                  case 2, 3, 4:
     47                        7;
     48                }
    4149        }
    4250
Note: See TracChangeset for help on using the changeset viewer.