Changeset c331406


Ignore:
Timestamp:
Aug 5, 2016, 11:03:04 AM (7 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  */