Changes in / [47a8d17:3f0c6a5]


Ignore:
Location:
src
Files:
2 added
5 deleted
60 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    r47a8d17 r3f0c6a5  
    309309                                                        UntypedExpr * newExpr = new UntypedExpr( new NameExpr( "*?" ) );
    310310                                                        newExpr->get_args().push_back( *arg );
    311                                                         assert( (*arg)->get_results().size() == 1 );
    312                                                         Type * type = InitTweak::getPointerBase( (*arg)->get_results().front() );
     311                                                        Type * type = InitTweak::getPointerBase( (*arg)->get_result() );
    313312                                                        assert( type );
    314                                                         newExpr->get_results().push_back( type->clone() );
     313                                                        newExpr->set_result( type->clone() );
    315314                                                        *arg = newExpr;
    316315                                                } // if
     
    527526                extension( castExpr );
    528527                output << "(";
    529                 if ( castExpr->get_results().empty() ) {
     528                if ( castExpr->get_result()->isVoid() ) {
    530529                        output << "(void)" ;
    531                 } else if ( ! castExpr->get_results().front()->get_isLvalue() ) {
     530                } else if ( ! castExpr->get_result()->get_isLvalue() ) {
    532531                        // at least one result type of cast, but not an lvalue
    533532                        output << "(";
    534                         output << genType( castExpr->get_results().front(), "" );
     533                        output << genType( castExpr->get_result(), "" );
    535534                        output << ")";
    536535                } else {
     
    640639        }
    641640
    642         void CodeGenerator::visit( TupleExpr * tupleExpr ) {}
     641        void CodeGenerator::visit( TupleExpr * tupleExpr ) { assert( false ); }
    643642
    644643        void CodeGenerator::visit( TypeExpr * typeExpr ) {}
     
    654653                asmExpr->get_operand()->accept( *this );
    655654                output << " )";
     655        }
     656
     657        void CodeGenerator::visit( CompoundLiteralExpr *compLitExpr ) {
     658                assert( compLitExpr->get_type() && dynamic_cast< ListInit * > ( compLitExpr->get_initializer() ) );
     659                output << "(" << genType( compLitExpr->get_type(), "" ) << ")";
     660                compLitExpr->get_initializer()->accept( *this );
     661        }
     662
     663        void CodeGenerator::visit( StmtExpr * stmtExpr ) {
     664                std::list< Statement * > & stmts = stmtExpr->get_statements()->get_kids();
     665                output << "({" << std::endl;
     666                cur_indent += CodeGenerator::tabsize;
     667                unsigned int numStmts = stmts.size();
     668                unsigned int i = 0;
     669                for ( Statement * stmt : stmts ) {
     670                        output << indent << printLabels( stmt->get_labels() );
     671                        if ( i+1 == numStmts ) {
     672                                // last statement in a statement expression needs to be handled specially -
     673                                // cannot cast to void, otherwise the expression statement has no value
     674                                if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( stmt ) ) {
     675                                        exprStmt->get_expr()->accept( *this );
     676                                        output << ";" << endl;
     677                                        ++i;
     678                                        break;
     679                                }
     680                        }
     681                        stmt->accept( *this );
     682                        output << endl;
     683                        if ( wantSpacing( stmt ) ) {
     684                                output << endl;
     685                        } // if
     686                        ++i;
     687                }
     688                cur_indent -= CodeGenerator::tabsize;
     689                output << indent << "})";
    656690        }
    657691
  • src/CodeGen/CodeGenerator.h

    r47a8d17 r3f0c6a5  
    7070                virtual void visit( ConditionalExpr *conditionalExpr );
    7171                virtual void visit( CommaExpr *commaExpr );
     72                virtual void visit( CompoundLiteralExpr *compLitExpr );
    7273                virtual void visit( TupleExpr *tupleExpr );
    7374                virtual void visit( TypeExpr *typeExpr );
    7475                virtual void visit( AsmExpr * );
     76                virtual void visit( StmtExpr * );
    7577
    7678                //*** Statements
  • src/CodeGen/GenType.cc

    r47a8d17 r3f0c6a5  
    227227                        typeString = "_Atomic " + typeString;
    228228                } // if
    229                 if ( type->get_isAttribute() ) {
    230                         typeString = "__attribute(( )) " + typeString;
    231                 } // if
    232229        }
    233230} // namespace CodeGen
  • src/Common/utility.h

    r47a8d17 r3f0c6a5  
    148148}
    149149
     150// replace element of list with all elements of another list
    150151template< typename T >
    151152void replace( std::list< T > &org, typename std::list< T >::iterator pos, std::list< T > &with ) {
     
    158159
    159160        return;
     161}
     162
     163// replace range of a list with a single element
     164template< typename T >
     165void replace( std::list< T > &org, typename std::list< T >::iterator begin, typename std::list< T >::iterator end, const T & with ) {
     166        org.insert( begin, with );
     167        org.erase( begin, end );
    160168}
    161169
  • src/ControlStruct/Mutate.cc

    r47a8d17 r3f0c6a5  
    2323#include "MLEMutator.h"
    2424#include "ForExprMutator.h"
    25 #include "LabelTypeChecker.h"
    2625//#include "ExceptMutator.h"
    2726
     
    4140
    4241                //ExceptMutator exc;
    43                 // LabelTypeChecker lbl;
    4442
    4543                mutateAll( translationUnit, formut );
    4644                acceptAll( translationUnit, lfix );
    4745                //mutateAll( translationUnit, exc );
    48                 //acceptAll( translationUnit, lbl );
    4946        }
    5047} // namespace CodeGen
  • src/ControlStruct/module.mk

    r47a8d17 r3f0c6a5  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk -- 
     8## module.mk --
    99##
    1010## Author           : Richard C. Bilson
     
    1919        ControlStruct/MLEMutator.cc \
    2020        ControlStruct/Mutate.cc \
    21         ControlStruct/ForExprMutator.cc \
    22         ControlStruct/LabelTypeChecker.cc
     21        ControlStruct/ForExprMutator.cc
    2322
  • src/GenPoly/Box.cc

    r47a8d17 r3f0c6a5  
    110110                        void addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars );
    111111                        /// Stores assignment operators from assertion list in local map of assignment operations
    112                         void findTypeOps( const std::list< TypeDecl *> &forall );
     112                        void findTypeOps( const Type::ForallList &forall );
    113113                        void passAdapters( ApplicationExpr *appExpr, FunctionType *functionType, const TyVarMap &exprTyVars );
    114114                        FunctionDecl *makeAdapter( FunctionType *adaptee, FunctionType *realType, const std::string &mangleName, const TyVarMap &tyVars );
     
    612612                }
    613613
    614                 void Pass1::findTypeOps( const std::list< TypeDecl *> &forall ) {
     614                void Pass1::findTypeOps( const Type::ForallList &forall ) {
    615615                        // what if a nested function uses an assignment operator?
    616616                        // assignOps.clear();
    617                         for ( std::list< TypeDecl *>::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
     617                        for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
    618618                                for ( std::list< DeclarationWithType *>::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
    619619                                        std::string typeName;
     
    680680                                std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
    681681                                std::list< FunctionType *> functions;
    682                                 for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
     682                                for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    683683                                        for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    684684                                                findFunction( (*assert)->get_type(), functions, scopeTyVars, needsAdapter );
     
    782782
    783783                        // add size/align for generic types to parameter list
    784                         if ( appExpr->get_function()->get_results().empty() ) return;
    785                         FunctionType *funcType = getFunctionType( appExpr->get_function()->get_results().front() );
     784                        if ( ! appExpr->get_function()->has_result() ) return;
     785                        FunctionType *funcType = getFunctionType( appExpr->get_function()->get_result() );
    786786                        assert( funcType );
    787787
     
    799799                        for ( ; fnParm != funcType->get_parameters().end() && fnArg != appExpr->get_args().end(); ++fnParm, ++fnArg ) {
    800800                                VariableExpr *fnArgBase = getBaseVar( *fnArg );
    801                                 if ( ! fnArgBase || fnArgBase->get_results().empty() ) continue;
    802                                 passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_results().front(), arg, exprTyVars, seenTypes );
     801                                if ( ! fnArgBase ) continue; // xxx - previously had check for non-empty fnArgBase results
     802                                passArgTypeVars( appExpr, (*fnParm)->get_type(), fnArgBase->get_result(), arg, exprTyVars, seenTypes );
    803803                        }
    804804                }
     
    890890                        Type * adapteeType = new PointerType( Type::Qualifiers(), new FunctionType( Type::Qualifiers(), true ) );
    891891                        appExpr->get_args().push_front( new CastExpr( appExpr->get_function(), adapteeType ) );
    892                         appExpr->set_function( new NameExpr( adapterName ) );
     892                        appExpr->set_function( new NameExpr( adapterName ) ); // xxx - result is never set on NameExpr
    893893
    894894                        return ret;
     
    896896
    897897                void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) {
    898                         assert( ! arg->get_results().empty() );
     898                        assert( arg->has_result() );
    899899                        if ( isPolyType( param, exprTyVars ) ) {
    900                                 if ( isPolyType( arg->get_results().front() ) ) {
     900                                if ( isPolyType( arg->get_result() ) ) {
    901901                                        // if the argument's type is polymorphic, we don't need to box again!
    902902                                        return;
    903                                 } else if ( arg->get_results().front()->get_isLvalue() ) {
     903                                } else if ( arg->get_result()->get_isLvalue() ) {
    904904                                        // VariableExpr and MemberExpr are lvalues; need to check this isn't coming from the second arg of a comma expression though (not an lvalue)
    905905                                        // xxx - need to test that this code is still reachable
     
    946946                void Pass1::addInferredParams( ApplicationExpr *appExpr, FunctionType *functionType, std::list< Expression *>::iterator &arg, const TyVarMap &tyVars ) {
    947947                        std::list< Expression *>::iterator cur = arg;
    948                         for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
     948                        for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    949949                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    950950                                        InferredParams::const_iterator inferParam = appExpr->get_inferParams().find( (*assert)->get_uniqueId() );
     
    987987                                        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    988988                                        deref->get_args().push_back( new CastExpr( new VariableExpr( param ), new PointerType( Type::Qualifiers(), arg->get_type()->clone() ) ) );
    989                                         deref->get_results().push_back( arg->get_type()->clone() );
     989                                        deref->set_result( arg->get_type()->clone() );
    990990                                        return deref;
    991991                                } // if
     
    10131013                        Statement *bodyStmt;
    10141014
    1015                         std::list< TypeDecl *>::iterator tyArg = realType->get_forall().begin();
    1016                         std::list< TypeDecl *>::iterator tyParam = adapterType->get_forall().begin();
    1017                         std::list< TypeDecl *>::iterator realTyParam = adaptee->get_forall().begin();
     1015                        Type::ForallList::iterator tyArg = realType->get_forall().begin();
     1016                        Type::ForallList::iterator tyParam = adapterType->get_forall().begin();
     1017                        Type::ForallList::iterator realTyParam = adaptee->get_forall().begin();
    10181018                        for ( ; tyParam != adapterType->get_forall().end(); ++tyArg, ++tyParam, ++realTyParam ) {
    10191019                                assert( tyArg != realType->get_forall().end() );
     
    10641064                        std::list< DeclarationWithType *> &paramList = functionType->get_parameters();
    10651065                        std::list< FunctionType *> functions;
    1066                         for ( std::list< TypeDecl *>::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
     1066                        for ( Type::ForallList::iterator tyVar = functionType->get_forall().begin(); tyVar != functionType->get_forall().end(); ++tyVar ) {
    10671067                                for ( std::list< DeclarationWithType *>::iterator assert = (*tyVar)->get_assertions().begin(); assert != (*tyVar)->get_assertions().end(); ++assert ) {
    10681068                                        findFunction( (*assert)->get_type(), functions, exprTyVars, needsAdapter );
     
    11241124                        } // if
    11251125                        addAssign->get_args().push_back( new NameExpr( sizeofName( mangleType( polyType ) ) ) );
    1126                         addAssign->get_results().front() = appExpr->get_results().front()->clone();
     1126                        addAssign->set_result( appExpr->get_result()->clone() );
    11271127                        if ( appExpr->get_env() ) {
    11281128                                addAssign->set_env( appExpr->get_env() );
     
    11381138                                if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) {
    11391139                                        if ( varExpr->get_var()->get_name() == "?[?]" ) {
    1140                                                 assert( ! appExpr->get_results().empty() );
     1140                                                assert( appExpr->has_result() );
    11411141                                                assert( appExpr->get_args().size() == 2 );
    1142                                                 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
    1143                                                 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
     1142                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
     1143                                                Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env );
    11441144                                                assert( ! baseType1 || ! baseType2 ); // the arguments cannot both be polymorphic pointers
    11451145                                                UntypedExpr *ret = 0;
     
    11611161                                                } // if
    11621162                                                if ( baseType1 || baseType2 ) {
    1163                                                         ret->get_results().push_front( appExpr->get_results().front()->clone() );
     1163                                                        ret->set_result( appExpr->get_result()->clone() );
    11641164                                                        if ( appExpr->get_env() ) {
    11651165                                                                ret->set_env( appExpr->get_env() );
     
    11711171                                                } // if
    11721172                                        } else if ( varExpr->get_var()->get_name() == "*?" ) {
    1173                                                 assert( ! appExpr->get_results().empty() );
     1173                                                assert( appExpr->has_result() );
    11741174                                                assert( ! appExpr->get_args().empty() );
    1175                                                 if ( isPolyType( appExpr->get_results().front(), scopeTyVars, env ) ) {
     1175                                                if ( isPolyType( appExpr->get_result(), scopeTyVars, env ) ) {
    11761176                                                        Expression *ret = appExpr->get_args().front();
    1177                                                         delete ret->get_results().front();
    1178                                                         ret->get_results().front() = appExpr->get_results().front()->clone();
     1177                                                        delete ret->get_result();
     1178                                                        ret->set_result( appExpr->get_result()->clone() );
    11791179                                                        if ( appExpr->get_env() ) {
    11801180                                                                ret->set_env( appExpr->get_env() );
     
    11861186                                                } // if
    11871187                                        } else if ( varExpr->get_var()->get_name() == "?++" || varExpr->get_var()->get_name() == "?--" ) {
    1188                                                 assert( ! appExpr->get_results().empty() );
     1188                                                assert( appExpr->has_result() );
    11891189                                                assert( appExpr->get_args().size() == 1 );
    1190                                                 if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
    1191                                                         Type *tempType = appExpr->get_results().front()->clone();
     1190                                                if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
     1191                                                        Type *tempType = appExpr->get_result()->clone();
    11921192                                                        if ( env ) {
    11931193                                                                env->apply( tempType );
     
    12061206                                                } // if
    12071207                                        } else if ( varExpr->get_var()->get_name() == "++?" || varExpr->get_var()->get_name() == "--?" ) {
    1208                                                 assert( ! appExpr->get_results().empty() );
     1208                                                assert( appExpr->has_result() );
    12091209                                                assert( appExpr->get_args().size() == 1 );
    1210                                                 if ( Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env ) ) {
     1210                                                if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) {
    12111211                                                        return makeIncrDecrExpr( appExpr, baseType, varExpr->get_var()->get_name() == "++?" );
    12121212                                                } // if
    12131213                                        } else if ( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) {
    1214                                                 assert( ! appExpr->get_results().empty() );
     1214                                                assert( appExpr->has_result() );
    12151215                                                assert( appExpr->get_args().size() == 2 );
    1216                                                 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_results().front(), scopeTyVars, env );
    1217                                                 Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_results().front(), scopeTyVars, env );
     1216                                                Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env );
     1217                                                Type *baseType2 = isPolyPtr( appExpr->get_args().back()->get_result(), scopeTyVars, env );
    12181218                                                if ( baseType1 && baseType2 ) {
    12191219                                                        UntypedExpr *divide = new UntypedExpr( new NameExpr( "?/?" ) );
    12201220                                                        divide->get_args().push_back( appExpr );
    12211221                                                        divide->get_args().push_back( new SizeofExpr( baseType1->clone() ) );
    1222                                                         divide->get_results().push_front( appExpr->get_results().front()->clone() );
     1222                                                        divide->set_result( appExpr->get_result()->clone() );
    12231223                                                        if ( appExpr->get_env() ) {
    12241224                                                                divide->set_env( appExpr->get_env() );
     
    12381238                                                } // if
    12391239                                        } else if ( varExpr->get_var()->get_name() == "?+=?" || varExpr->get_var()->get_name() == "?-=?" ) {
    1240                                                 assert( ! appExpr->get_results().empty() );
     1240                                                assert( appExpr->has_result() );
    12411241                                                assert( appExpr->get_args().size() == 2 );
    1242                                                 Type *baseType = isPolyPtr( appExpr->get_results().front(), scopeTyVars, env );
     1242                                                Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env );
    12431243                                                if ( baseType ) {
    12441244                                                        UntypedExpr *multiply = new UntypedExpr( new NameExpr( "?*?" ) );
     
    12661266                        useRetval = oldUseRetval;
    12671267
    1268                         assert( ! appExpr->get_function()->get_results().empty() );
    1269                         PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() );
    1270                         assert( pointer );
    1271                         FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() );
    1272                         assert( function );
     1268                        assert( appExpr->get_function()->has_result() );
     1269                        PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() );
     1270                        FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() );
    12731271
    12741272                        if ( Expression *newExpr = handleIntrinsics( appExpr ) ) {
     
    13081306
    13091307                Expression *Pass1::mutate( UntypedExpr *expr ) {
    1310                         if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) {
     1308                        if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
    13111309                                if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
    13121310                                        if ( name->get_name() == "*?" ) {
     
    13221320
    13231321                Expression *Pass1::mutate( AddressExpr *addrExpr ) {
    1324                         assert( ! addrExpr->get_arg()->get_results().empty() );
     1322                        assert( addrExpr->get_arg()->has_result() && ! addrExpr->get_arg()->get_result()->isVoid() );
    13251323
    13261324                        bool needs = false;
    13271325                        if ( UntypedExpr *expr = dynamic_cast< UntypedExpr *>( addrExpr->get_arg() ) ) {
    1328                                 if ( ! expr->get_results().empty() && isPolyType( expr->get_results().front(), scopeTyVars, env ) ) {
     1326                                if ( expr->has_result() && isPolyType( expr->get_result(), scopeTyVars, env ) ) {
    13291327                                        if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) {
    13301328                                                if ( name->get_name() == "*?" ) {
    13311329                                                        if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr->get_args().front() ) ) {
    1332                                                                 assert( ! appExpr->get_function()->get_results().empty() );
    1333                                                                 PointerType *pointer = dynamic_cast< PointerType *>( appExpr->get_function()->get_results().front() );
    1334                                                                 assert( pointer );
    1335                                                                 FunctionType *function = dynamic_cast< FunctionType *>( pointer->get_base() );
    1336                                                                 assert( function );
     1330                                                                assert( appExpr->get_function()->has_result() );
     1331                                                                PointerType *pointer = safe_dynamic_cast< PointerType *>( appExpr->get_function()->get_result() );
     1332                                                                FunctionType *function = safe_dynamic_cast< FunctionType *>( pointer->get_base() );
    13371333                                                                needs = needsAdapter( function, scopeTyVars );
    13381334                                                        } // if
     
    13431339                        // isPolyType check needs to happen before mutating addrExpr arg, so pull it forward
    13441340                        // out of the if condition.
    1345                         bool polytype = isPolyType( addrExpr->get_arg()->get_results().front(), scopeTyVars, env );
     1341                        bool polytype = isPolyType( addrExpr->get_arg()->get_result(), scopeTyVars, env );
    13461342                        addrExpr->set_arg( mutateExpression( addrExpr->get_arg() ) );
    13471343                        if ( polytype || needs ) {
    13481344                                Expression *ret = addrExpr->get_arg();
    1349                                 delete ret->get_results().front();
    1350                                 ret->get_results().front() = addrExpr->get_results().front()->clone();
     1345                                delete ret->get_result();
     1346                                ret->set_result( addrExpr->get_result()->clone() );
    13511347                                addrExpr->set_arg( 0 );
    13521348                                delete addrExpr;
     
    13861382                Statement * Pass1::mutate( ReturnStmt *returnStmt ) {
    13871383                        if ( retval && returnStmt->get_expr() ) {
    1388                                 assert( ! returnStmt->get_expr()->get_results().empty() );
     1384                                assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() );
    13891385                                // ***** Code Removal ***** After introducing a temporary variable for all return expressions, the following code appears superfluous.
    13901386                                // if ( returnStmt->get_expr()->get_results().front()->get_isLvalue() ) {
     
    14201416                                        // find each of its needed secondary assignment operators
    14211417                                        std::list< Expression* > &tyParams = refType->get_parameters();
    1422                                         std::list< TypeDecl* > &forallParams = functionDecl->get_type()->get_forall();
     1418                                        Type::ForallList &forallParams = functionDecl->get_type()->get_forall();
    14231419                                        std::list< Expression* >::const_iterator tyIt = tyParams.begin();
    1424                                         std::list< TypeDecl* >::const_iterator forallIt = forallParams.begin();
     1420                                        Type::ForallList::const_iterator forallIt = forallParams.begin();
    14251421                                        for ( ; tyIt != tyParams.end() && forallIt != forallParams.end(); ++tyIt, ++forallIt ) {
    14261422                                                // Add appropriate mapping to assignment expression environment
     
    14661462                                // replace return statement with appropriate assignment to out parameter
    14671463                                Expression *retParm = new NameExpr( retval->get_name() );
    1468                                 retParm->get_results().push_back( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
     1464                                retParm->set_result( new PointerType( Type::Qualifiers(), retval->get_type()->clone() ) );
    14691465                                assignExpr->get_args().push_back( retParm );
    14701466                                assignExpr->get_args().push_back( returnStmt->get_expr() );
     
    15961592                        ObjectDecl newPtr( "", DeclarationNode::NoStorageClass, LinkageSpec::C, 0,
    15971593                                           new PointerType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ), 0 );
    1598                         for ( std::list< TypeDecl *>::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
     1594                        for ( Type::ForallList::const_iterator tyParm = funcType->get_forall().begin(); tyParm != funcType->get_forall().end(); ++tyParm ) {
    15991595                                ObjectDecl *sizeParm, *alignParm;
    16001596                                // add all size and alignment parameters to parameter list
  • src/GenPoly/CopyParams.cc

    r47a8d17 r3f0c6a5  
    5454                                std::map< std::string, DeclarationWithType* > assignOps;
    5555                                // assume the assignment operator is the first assert param after any "type" parameter
    56                                 for ( std::list< TypeDecl* >::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) {
     56                                for ( Type::ForallList::const_iterator tyVar = funcDecl->get_functionType()->get_forall().begin(); tyVar != funcDecl->get_functionType()->get_forall().end(); ++tyVar ) {
    5757                                        if ( (*tyVar)->get_kind() == TypeDecl::Any ) {
    5858                                                assert( !(*tyVar)->get_assertions().empty() );
  • src/GenPoly/FindFunction.cc

    r47a8d17 r3f0c6a5  
    2929                virtual Type *mutate( PointerType *pointerType );
    3030          private:
    31                 void handleForall( const std::list< TypeDecl* > &forall );
     31                void handleForall( const Type::ForallList &forall );
    3232
    3333                std::list< FunctionType* > &functions;
     
    5151        }
    5252
    53         void FindFunction::handleForall( const std::list< TypeDecl* > &forall ) {
    54                 for ( std::list< TypeDecl* >::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
     53        void FindFunction::handleForall( const Type::ForallList &forall ) {
     54                for ( Type::ForallList::const_iterator i = forall.begin(); i != forall.end(); ++i ) {
    5555                        TyVarMap::iterator var = tyVars.find( (*i)->get_name() );
    5656                        if ( var != tyVars.end() ) {
  • src/GenPoly/GenPoly.cc

    r47a8d17 r3f0c6a5  
    110110        ReferenceToType *isDynRet( FunctionType *function, const TyVarMap &forallTypes ) {
    111111                if ( function->get_returnVals().empty() ) return 0;
    112                
     112
    113113                return (ReferenceToType*)isDynType( function->get_returnVals().front()->get_type(), forallTypes );
    114114        }
     
    127127//              } // if
    128128                if ( isDynRet( adaptee, tyVars ) ) return true;
    129                
     129
    130130                for ( std::list< DeclarationWithType* >::const_iterator innerArg = adaptee->get_parameters().begin(); innerArg != adaptee->get_parameters().end(); ++innerArg ) {
    131131//                      if ( isPolyType( (*innerArg)->get_type(), tyVars ) ) {
     
    228228
    229229        void makeTyVarMap( Type *type, TyVarMap &tyVarMap ) {
    230                 for ( std::list< TypeDecl* >::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {
     230                for ( Type::ForallList::const_iterator tyVar = type->get_forall().begin(); tyVar != type->get_forall().end(); ++tyVar ) {
    231231                        assert( *tyVar );
    232232                        tyVarMap[ (*tyVar)->get_name() ] = (*tyVar)->get_kind();
  • src/GenPoly/Lvalue.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Lvalue.cc -- 
     7// Lvalue.cc --
    88//
    99// Author           : Richard C. Bilson
     
    4141                  public:
    4242                        Pass1();
    43  
     43
    4444                        virtual Expression *mutate( ApplicationExpr *appExpr );
    4545                        virtual Statement *mutate( ReturnStmt *appExpr );
     
    9999                        appExpr->get_function()->acceptMutator( *this );
    100100                        mutateAll( appExpr->get_args(), *this );
    101  
    102                         assert( ! appExpr->get_function()->get_results().empty() );
    103101
    104                         PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
    105                         assert( pointer );
    106                         FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
    107                         assert( function );
     102                        PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
     103                        FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
    108104
    109105                        Type *funType = isLvalueRet( function );
    110106                        if ( funType && ! isIntrinsicApp( appExpr ) ) {
    111107                                Expression *expr = appExpr;
    112                                 Type *appType = appExpr->get_results().front();
     108                                Type *appType = appExpr->get_result();
    113109                                if ( isPolyType( funType ) && ! isPolyType( appType ) ) {
    114110                                        // make sure cast for polymorphic type is inside dereference
     
    116112                                }
    117113                                UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    118                                 deref->get_results().push_back( appType->clone() );
    119                                 appExpr->get_results().front() = new PointerType( Type::Qualifiers(), appType );
     114                                deref->set_result( appType->clone() );
     115                                appExpr->set_result( new PointerType( Type::Qualifiers(), appType ) );
    120116                                deref->get_args().push_back( expr );
    121117                                return deref;
     
    127123                Statement * Pass1::mutate(ReturnStmt *retStmt) {
    128124                        if ( retval && retStmt->get_expr() ) {
    129                                 assert( ! retStmt->get_expr()->get_results().empty() );
    130                                 if ( retStmt->get_expr()->get_results().front()->get_isLvalue() ) {
     125                                if ( retStmt->get_expr()->get_result()->get_isLvalue() ) {
    131126                                        // ***** Code Removal ***** because casts may be stripped already
    132127
     
    155150                                retParm->set_type( new PointerType( Type::Qualifiers(), retParm->get_type() ) );
    156151                        } // if
    157  
     152
    158153                        Visitor::visit( funType );
    159154                }
  • src/GenPoly/Specialize.cc

    r47a8d17 r3f0c6a5  
    147147
    148148        Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) {
    149                 assert( ! actual->get_results().empty() ); // using front, should have this assert
    150                 if ( needsSpecialization( formalType, actual->get_results().front(), env ) ) {
     149                assert( actual->has_result() );
     150                if ( needsSpecialization( formalType, actual->get_result(), env ) ) {
    151151                        FunctionType *funType;
    152152                        if ( ( funType = getFunctionType( formalType ) ) ) {
     
    171171        void Specialize::handleExplicitParams( ApplicationExpr *appExpr ) {
    172172                // create thunks for the explicit parameters
    173                 assert( ! appExpr->get_function()->get_results().empty() );
    174                 FunctionType *function = getFunctionType( appExpr->get_function()->get_results().front() );
     173                assert( appExpr->get_function()->has_result() );
     174                FunctionType *function = getFunctionType( appExpr->get_function()->get_result() );
    175175                assert( function );
    176176                std::list< DeclarationWithType* >::iterator formal;
     
    200200        Expression * Specialize::mutate( AddressExpr *addrExpr ) {
    201201                addrExpr->get_arg()->acceptMutator( *this );
    202                 assert( ! addrExpr->get_results().empty() );
    203                 addrExpr->set_arg( doSpecialization( addrExpr->get_results().front(), addrExpr->get_arg() ) );
     202                assert( addrExpr->has_result() );
     203                addrExpr->set_arg( doSpecialization( addrExpr->get_result(), addrExpr->get_arg() ) );
    204204                return addrExpr;
    205205        }
     
    207207        Expression * Specialize::mutate( CastExpr *castExpr ) {
    208208                castExpr->get_arg()->acceptMutator( *this );
    209                 if ( castExpr->get_results().empty() ) {
     209                if ( castExpr->get_result()->isVoid() ) {
    210210                        // can't specialize if we don't have a return value
    211211                        return castExpr;
    212212                }
    213                 Expression *specialized = doSpecialization( castExpr->get_results().front(), castExpr->get_arg() );
     213                Expression *specialized = doSpecialization( castExpr->get_result(), castExpr->get_arg() );
    214214                if ( specialized != castExpr->get_arg() ) {
    215215                        // assume here that the specialization incorporates the cast
  • src/InitTweak/FixInit.cc

    r47a8d17 r3f0c6a5  
    3535#include "GenPoly/DeclMutator.h"
    3636#include "SynTree/AddStmtVisitor.h"
    37 #include "CodeGen/GenType.h"  // for warnings
    38 
    39 bool ctordtorp = false;
    40 bool ctorp = false;
    41 bool cpctorp = false;
    42 bool dtorp = false;
     37#include "CodeGen/GenType.h"  // for warning/error messages
     38
     39bool ctordtorp = false; // print all debug
     40bool ctorp = false; // print ctor debug
     41bool cpctorp = false; // print copy ctor debug
     42bool dtorp = false; // print dtor debug
    4343#define PRINT( text ) if ( ctordtorp ) { text }
    4444#define CP_CTOR_PRINT( text ) if ( ctordtorp || cpctorp ) { text }
     
    4747namespace InitTweak {
    4848        namespace {
    49                 const std::list<Label> noLabels;
    50                 const std::list<Expression*> noDesignators;
    51 
    5249                class InsertImplicitCalls : public GenPoly::PolyMutator {
    5350                public:
     
    6966
    7067                        /// create and resolve ctor/dtor expression: fname(var, [cpArg])
    71                         ApplicationExpr * makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg = NULL );
     68                        Expression * makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg = NULL );
     69                        Expression * makeCtorDtor( const std::string & fname, Expression * thisArg, Expression * cpArg = NULL );
    7270                        /// true if type does not need to be copy constructed to ensure correctness
    73                         bool skipCopyConstruct( Type * );
     71                        bool skipCopyConstruct( Type * type );
     72                        void copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr );
     73                        void destructRet( Expression * ret, ImplicitCopyCtorExpr * impCpCtorExpr );
    7474                private:
    7575                        TypeSubstitution * env;
     
    357357                }
    358358
    359                 ApplicationExpr * ResolveCopyCtors::makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg ) {
     359                Expression * ResolveCopyCtors::makeCtorDtor( const std::string & fname, ObjectDecl * var, Expression * cpArg ) {
    360360                        assert( var );
     361                        return makeCtorDtor( fname, new AddressExpr( new VariableExpr( var ) ), cpArg );
     362                }
     363
     364                Expression * ResolveCopyCtors::makeCtorDtor( const std::string & fname, Expression * thisArg, Expression * cpArg ) {
     365                        assert( thisArg );
    361366                        UntypedExpr * untyped = new UntypedExpr( new NameExpr( fname ) );
    362                         untyped->get_args().push_back( new AddressExpr( new VariableExpr( var ) ) );
     367                        untyped->get_args().push_back( thisArg );
    363368                        if (cpArg) untyped->get_args().push_back( cpArg->clone() );
    364369
     
    367372                        // (VariableExpr and already resolved expression)
    368373                        CP_CTOR_PRINT( std::cerr << "ResolvingCtorDtor " << untyped << std::endl; )
    369                         ApplicationExpr * resolved = dynamic_cast< ApplicationExpr * >( ResolvExpr::findVoidExpression( untyped, *this ) );
     374                        Expression * resolved = ResolvExpr::findVoidExpression( untyped, *this );
     375                        assert( resolved );
    370376                        if ( resolved->get_env() ) {
    371377                                env->add( *resolved->get_env() );
    372378                        } // if
    373379
    374                         assert( resolved );
    375380                        delete untyped;
    376381                        return resolved;
    377382                }
    378383
     384                void ResolveCopyCtors::copyConstructArg( Expression *& arg, ImplicitCopyCtorExpr * impCpCtorExpr ) {
     385                        static UniqueName tempNamer("_tmp_cp");
     386                        CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; )
     387                        assert( arg->has_result() );
     388                        Type * result = arg->get_result();
     389                        if ( skipCopyConstruct( result ) ) return; // skip certain non-copyable types
     390
     391                        // type may involve type variables, so apply type substitution to get temporary variable's actual type
     392                        result = result->clone();
     393                        impCpCtorExpr->get_env()->apply( result );
     394                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 );
     395                        tmp->get_type()->set_isConst( false );
     396
     397                        // create and resolve copy constructor
     398                        CP_CTOR_PRINT( std::cerr << "makeCtorDtor for an argument" << std::endl; )
     399                        Expression * cpCtor = makeCtorDtor( "?{}", tmp, arg );
     400
     401                        if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( cpCtor ) ) {
     402                                // if the chosen constructor is intrinsic, the copy is unnecessary, so
     403                                // don't create the temporary and don't call the copy constructor
     404                                VariableExpr * function = dynamic_cast< VariableExpr * >( appExpr->get_function() );
     405                                assert( function );
     406                                if ( function->get_var()->get_linkage() == LinkageSpec::Intrinsic ) return;
     407                        }
     408
     409                        // replace argument to function call with temporary
     410                        arg = new CommaExpr( cpCtor, new VariableExpr( tmp ) );
     411                        impCpCtorExpr->get_tempDecls().push_back( tmp );
     412                        impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", tmp ) );
     413                }
     414
     415                void ResolveCopyCtors::destructRet( Expression * ret, ImplicitCopyCtorExpr * impCpCtorExpr ) {
     416                        impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", new AddressExpr( ret ) ) );
     417                }
     418
    379419                void ResolveCopyCtors::visit( ImplicitCopyCtorExpr *impCpCtorExpr ) {
    380                         static UniqueName tempNamer("_tmp_cp");
    381                         static UniqueName retNamer("_tmp_cp_ret");
    382 
    383420                        CP_CTOR_PRINT( std::cerr << "ResolveCopyCtors: " << impCpCtorExpr << std::endl; )
    384421                        Visitor::visit( impCpCtorExpr );
     
    389426                        // take each argument and attempt to copy construct it.
    390427                        for ( Expression * & arg : appExpr->get_args() ) {
    391                                 CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *impCpCtorExpr->get_env() << std::endl; )
    392                                 // xxx - need to handle tuple arguments
    393                                 assert( ! arg->get_results().empty() );
    394                                 Type * result = arg->get_results().front();
    395                                 if ( skipCopyConstruct( result ) ) continue; // skip certain non-copyable types
    396                                 // type may involve type variables, so apply type substitution to get temporary variable's actual type
    397                                 result = result->clone();
    398                                 impCpCtorExpr->get_env()->apply( result );
    399                                 ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, result, 0 );
    400                                 tmp->get_type()->set_isConst( false );
    401 
    402                                 // create and resolve copy constructor
    403                                 CP_CTOR_PRINT( std::cerr << "makeCtorDtor for an argument" << std::endl; )
    404                                 ApplicationExpr * cpCtor = makeCtorDtor( "?{}", tmp, arg );
    405 
    406                                 // if the chosen constructor is intrinsic, the copy is unnecessary, so
    407                                 // don't create the temporary and don't call the copy constructor
    408                                 VariableExpr * function = dynamic_cast< VariableExpr * >( cpCtor->get_function() );
    409                                 assert( function );
    410                                 if ( function->get_var()->get_linkage() != LinkageSpec::Intrinsic ) {
    411                                         // replace argument to function call with temporary
    412                                         arg = new CommaExpr( cpCtor, new VariableExpr( tmp ) );
    413                                         impCpCtorExpr->get_tempDecls().push_back( tmp );
    414                                         impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", tmp ) );
    415                                 } // if
     428                                copyConstructArg( arg, impCpCtorExpr );
    416429                        } // for
    417430
     
    423436                        // level. Trying to pass that environment along.
    424437                        callExpr->set_env( impCpCtorExpr->get_env()->clone() );
    425                         for ( Type * result : appExpr->get_results() ) {
     438                        Type * result = appExpr->get_result();
     439                        if ( ! result->isVoid() ) {
     440                                static UniqueName retNamer("_tmp_cp_ret");
    426441                                result = result->clone();
    427442                                impCpCtorExpr->get_env()->apply( result );
     
    430445                                impCpCtorExpr->get_returnDecls().push_back( ret );
    431446                                CP_CTOR_PRINT( std::cerr << "makeCtorDtor for a return" << std::endl; )
    432                                 impCpCtorExpr->get_dtors().push_front( makeCtorDtor( "^?{}", ret ) );
     447                                destructRet( new VariableExpr( ret ) , impCpCtorExpr );
    433448                        } // for
    434449                        CP_CTOR_PRINT( std::cerr << "after Resolving: " << impCpCtorExpr << std::endl; )
     
    479494                                // know the result type of the assignment is the type of the LHS (minus the pointer), so
    480495                                // add that onto the assignment expression so that later steps have the necessary information
    481                                 assign->add_result( returnDecl->get_type()->clone() );
     496                                assign->set_result( returnDecl->get_type()->clone() );
    482497
    483498                                Expression * retExpr = new CommaExpr( assign, new VariableExpr( returnDecl ) );
    484                                 if ( callExpr->get_results().front()->get_isLvalue() ) {
     499                                if ( callExpr->get_result()->get_isLvalue() ) {
    485500                                        // lvalue returning functions are funny. Lvalue.cc inserts a *? in front of any lvalue returning
    486501                                        // non-intrinsic function. Add an AddressExpr to the call to negate the derefence and change the
     
    500515                                        UntypedExpr * deref = new UntypedExpr( new NameExpr( "*?" ) );
    501516                                        deref->get_args().push_back( retExpr );
    502                                         deref->add_result( resultType );
     517                                        deref->set_result( resultType );
    503518                                        retExpr = deref;
    504519                                } // if
     
    939954                Expression * FixCtorExprs::mutate( ConstructorExpr * ctorExpr ) {
    940955                        static UniqueName tempNamer( "_tmp_ctor_expr" );
    941                         assert( ctorExpr->get_results().size() == 1 );
    942                         ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_results().front()->clone(), nullptr );
     956                        // xxx - is the size check necessary?
     957                        assert( ctorExpr->has_result() && ctorExpr->get_result()->size() == 1 );
     958                        ObjectDecl * tmp = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, nullptr, ctorExpr->get_result()->clone(), nullptr );
    943959                        addDeclaration( tmp );
    944960
     
    952968                        assign->get_args().push_back( new VariableExpr( tmp ) );
    953969                        assign->get_args().push_back( firstArg );
    954                         cloneAll( ctorExpr->get_results(), assign->get_results() );
     970                        assign->set_result( ctorExpr->get_result()->clone() );
    955971                        firstArg = assign;
    956972
  • src/InitTweak/GenInit.cc

    r47a8d17 r3f0c6a5  
    2929#include "GenPoly/DeclMutator.h"
    3030#include "GenPoly/ScopedSet.h"
     31#include "ResolvExpr/typeops.h"
    3132
    3233namespace InitTweak {
     
    5051
    5152          protected:
    52                 std::list<DeclarationWithType*> returnVals;
     53                FunctionType * ftype;
    5354                UniqueName tempNamer;
    5455                std::string funcName;
     
    8687
    8788                bool isManaged( ObjectDecl * objDecl ) const ; // determine if object is managed
     89                bool isManaged( Type * type ) const; // determine if type is managed
    8890                void handleDWT( DeclarationWithType * dwt ); // add type to managed if ctor/dtor
    8991                GenPoly::ScopedSet< std::string > managedTypes;
     
    134136
    135137        Statement *ReturnFixer::mutate( ReturnStmt *returnStmt ) {
    136                 // update for multiple return values
     138                std::list< DeclarationWithType * > & returnVals = ftype->get_returnVals();
    137139                assert( returnVals.size() == 0 || returnVals.size() == 1 );
    138140                // hands off if the function returns an lvalue - we don't want to allocate a temporary if a variable's address
     
    156158
    157159        DeclarationWithType* ReturnFixer::mutate( FunctionDecl *functionDecl ) {
    158                 ValueGuard< std::list<DeclarationWithType*> > oldReturnVals( returnVals );
     160                // xxx - need to handle named return values - this pass may need to happen
     161                // after resolution? the ordering is tricky because return statements must be
     162                // constructed - the simplest way to do that (while also handling multiple
     163                // returns) is to structure the returnVals into a tuple, as done here.
     164                // however, if the tuple return value is structured before resolution,
     165                // it's difficult to resolve named return values, since the name is lost
     166                // in conversion to a tuple. this might be easiest to deal with
     167                // after reference types are added, as it may then be possible to
     168                // uniformly move named return values to the parameter list directly
     169                ValueGuard< FunctionType * > oldFtype( ftype );
    159170                ValueGuard< std::string > oldFuncName( funcName );
    160171
    161                 FunctionType * type = functionDecl->get_functionType();
    162                 returnVals = type->get_returnVals();
     172                ftype = functionDecl->get_functionType();
     173                std::list< DeclarationWithType * > & retVals = ftype->get_returnVals();
     174                if ( retVals.size() > 1 ) {
     175                        TupleType * tupleType = safe_dynamic_cast< TupleType * >( ResolvExpr::extractResultType( ftype ) );
     176                        ObjectDecl * newRet = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, tupleType, new ListInit( std::list<Initializer*>(), noDesignators, false ) );
     177                        retVals.clear();
     178                        retVals.push_back( newRet );
     179                }
    163180                funcName = functionDecl->get_name();
    164181                DeclarationWithType * decl = Mutator::mutate( functionDecl );
     
    220237        }
    221238
     239        bool CtorDtor::isManaged( Type * type ) const {
     240                if ( TupleType * tupleType = dynamic_cast< TupleType * > ( type ) ) {
     241                        // tuple is also managed if any of its components are managed
     242                        if ( std::any_of( tupleType->get_types().begin(), tupleType->get_types().end(), [&](Type * type) { return isManaged( type ); }) ) {
     243                                return true;
     244                        }
     245                }
     246                return managedTypes.find( SymTab::Mangler::mangle( type ) ) != managedTypes.end();
     247        }
     248
    222249        bool CtorDtor::isManaged( ObjectDecl * objDecl ) const {
    223250                Type * type = objDecl->get_type();
     
    225252                        type = at->get_base();
    226253                }
    227                 return managedTypes.find( SymTab::Mangler::mangle( type ) ) != managedTypes.end();
     254                return isManaged( type );
    228255        }
    229256
     
    236263                        managedTypes.insert( SymTab::Mangler::mangle( type->get_base() ) );
    237264                }
     265        }
     266
     267        ConstructorInit * genCtorInit( ObjectDecl * objDecl ) {
     268                // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor
     269                // for each constructable object
     270                std::list< Statement * > ctor;
     271                std::list< Statement * > dtor;
     272
     273                InitExpander srcParam( objDecl->get_init() );
     274                InitExpander nullParam( (Initializer *)NULL );
     275                SymTab::genImplicitCall( srcParam, new VariableExpr( objDecl ), "?{}", back_inserter( ctor ), objDecl );
     276                SymTab::genImplicitCall( nullParam, new VariableExpr( objDecl ), "^?{}", front_inserter( dtor ), objDecl, false );
     277
     278                // Currently genImplicitCall produces a single Statement - a CompoundStmt
     279                // which  wraps everything that needs to happen. As such, it's technically
     280                // possible to use a Statement ** in the above calls, but this is inherently
     281                // unsafe, so instead we take the slightly less efficient route, but will be
     282                // immediately informed if somehow the above assumption is broken. In this case,
     283                // we could always wrap the list of statements at this point with a CompoundStmt,
     284                // but it seems reasonable at the moment for this to be done by genImplicitCall
     285                // itself. It is possible that genImplicitCall produces no statements (e.g. if
     286                // an array type does not have a dimension). In this case, it's fine to ignore
     287                // the object for the purposes of construction.
     288                assert( ctor.size() == dtor.size() && ctor.size() <= 1 );
     289                if ( ctor.size() == 1 ) {
     290                        // need to remember init expression, in case no ctors exist
     291                        // if ctor does exist, want to use ctor expression instead of init
     292                        // push this decision to the resolver
     293                        assert( dynamic_cast< ImplicitCtorDtorStmt * > ( ctor.front() ) && dynamic_cast< ImplicitCtorDtorStmt * > ( dtor.front() ) );
     294                        return new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() );
     295                }
     296                return nullptr;
    238297        }
    239298
     
    248307                        if ( ! checkInitDepth( objDecl ) ) throw SemanticError( "Managed object's initializer is too deep ", objDecl );
    249308
    250                         // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor
    251                         // for each constructable object
    252                         std::list< Statement * > ctor;
    253                         std::list< Statement * > dtor;
    254 
    255                         InitExpander srcParam( objDecl->get_init() );
    256                         InitExpander nullParam( (Initializer *)NULL );
    257                         SymTab::genImplicitCall( srcParam, new VariableExpr( objDecl ), "?{}", back_inserter( ctor ), objDecl );
    258                         SymTab::genImplicitCall( nullParam, new VariableExpr( objDecl ), "^?{}", front_inserter( dtor ), objDecl, false );
    259 
    260                         // Currently genImplicitCall produces a single Statement - a CompoundStmt
    261                         // which  wraps everything that needs to happen. As such, it's technically
    262                         // possible to use a Statement ** in the above calls, but this is inherently
    263                         // unsafe, so instead we take the slightly less efficient route, but will be
    264                         // immediately informed if somehow the above assumption is broken. In this case,
    265                         // we could always wrap the list of statements at this point with a CompoundStmt,
    266                         // but it seems reasonable at the moment for this to be done by genImplicitCall
    267                         // itself. It is possible that genImplicitCall produces no statements (e.g. if
    268                         // an array type does not have a dimension). In this case, it's fine to ignore
    269                         // the object for the purposes of construction.
    270                         assert( ctor.size() == dtor.size() && ctor.size() <= 1 );
    271                         if ( ctor.size() == 1 ) {
    272                                 // need to remember init expression, in case no ctors exist
    273                                 // if ctor does exist, want to use ctor expression instead of init
    274                                 // push this decision to the resolver
    275                                 assert( dynamic_cast< ImplicitCtorDtorStmt * > ( ctor.front() ) && dynamic_cast< ImplicitCtorDtorStmt * > ( dtor.front() ) );
    276                                 objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) );
    277                         }
     309                        objDecl->set_init( genCtorInit( objDecl ) );
    278310                }
    279311                return Parent::mutate( objDecl );
     
    288320                managedTypes.beginScope();
    289321                // go through assertions and recursively add seen ctor/dtors
    290                 for ( TypeDecl * tyDecl : functionDecl->get_functionType()->get_forall() ) {
     322                for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) {
    291323                        for ( DeclarationWithType *& assertion : tyDecl->get_assertions() ) {
    292324                                assertion = assertion->acceptMutator( *this );
  • src/InitTweak/GenInit.h

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // RemoveInit.h --
     7// GenInit.h --
    88//
    99// Author           : Rodolfo G. Esteves
     
    2727        /// Adds return value temporaries and wraps Initializers in ConstructorInit nodes
    2828        void genInit( std::list< Declaration * > & translationUnit );
     29
     30        /// creates an appropriate ConstructorInit node which contains a constructor, destructor, and C-initializer
     31        ConstructorInit * genCtorInit( ObjectDecl * objDecl );
    2932} // namespace
    3033
  • src/InitTweak/InitTweak.cc

    r47a8d17 r3f0c6a5  
    340340                return allofCtorDtor( stmt, []( Expression * callExpr ){
    341341                        if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) {
    342                                 assert( ! appExpr->get_function()->get_results().empty() );
    343                                 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_results().front() );
     342                                FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_result() );
    344343                                assert( funcType );
    345344                                return funcType->get_parameters().size() == 1;
     
    388387                                return memberExpr->get_member()->get_name();
    389388                        } else if ( UntypedMemberExpr * memberExpr = dynamic_cast< UntypedMemberExpr * > ( func ) ) {
    390                                 return memberExpr->get_member();
     389                                return funcName( memberExpr->get_member() );
    391390                        } else {
    392391                                assertf( false, "Unexpected expression type being called as a function in call expression" );
     
    451450                // virtual void visit( LogicalExpr *logicalExpr );
    452451                // virtual void visit( ConditionalExpr *conditionalExpr );
    453                 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }
    454                 virtual void visit( SolvedTupleExpr *tupleExpr ) { isConstExpr = false; }
    455452                virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; }
    456453                virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; }
    457454                virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; }
    458455                virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; }
     456                virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }
     457                virtual void visit( TupleAssignExpr *tupleExpr ) { isConstExpr = false; }
    459458
    460459                bool isConstExpr;
  • src/Makefile.in

    r47a8d17 r3f0c6a5  
    105105        ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \
    106106        ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \
    107         ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT) \
    108107        GenPoly/driver_cfa_cpp-Box.$(OBJEXT) \
    109108        GenPoly/driver_cfa_cpp-GenPoly.$(OBJEXT) \
     
    191190        SynTree/driver_cfa_cpp-Attribute.$(OBJEXT) \
    192191        Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) \
    193         Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT)
     192        Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT)
    194193am_driver_cfa_cpp_OBJECTS = $(am__objects_1)
    195194driver_cfa_cpp_OBJECTS = $(am_driver_cfa_cpp_OBJECTS)
     
    365364        ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \
    366365        ControlStruct/MLEMutator.cc ControlStruct/Mutate.cc \
    367         ControlStruct/ForExprMutator.cc \
    368         ControlStruct/LabelTypeChecker.cc GenPoly/Box.cc \
     366        ControlStruct/ForExprMutator.cc GenPoly/Box.cc \
    369367        GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \
    370368        GenPoly/ScrubTyVars.cc GenPoly/Lvalue.cc GenPoly/Specialize.cc \
     
    406404        SynTree/AddStmtVisitor.cc SynTree/TypeSubstitution.cc \
    407405        SynTree/Attribute.cc Tuples/TupleAssignment.cc \
    408         Tuples/NameMatcher.cc
     406        Tuples/TupleExpansion.cc
    409407MAINTAINERCLEANFILES = Parser/parser.output ${libdir}/${notdir \
    410408        ${cfa_cpplib_PROGRAMS}}
     
    541539        ControlStruct/$(DEPDIR)/$(am__dirstamp)
    542540ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT):  \
    543         ControlStruct/$(am__dirstamp) \
    544         ControlStruct/$(DEPDIR)/$(am__dirstamp)
    545 ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT):  \
    546541        ControlStruct/$(am__dirstamp) \
    547542        ControlStruct/$(DEPDIR)/$(am__dirstamp)
     
    777772Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT):  \
    778773        Tuples/$(am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp)
    779 Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT): Tuples/$(am__dirstamp) \
    780         Tuples/$(DEPDIR)/$(am__dirstamp)
     774Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT): \
     775        Tuples/$(am__dirstamp) Tuples/$(DEPDIR)/$(am__dirstamp)
    781776driver/$(am__dirstamp):
    782777        @$(MKDIR_P) driver
     
    800795        -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT)
    801796        -rm -f ControlStruct/driver_cfa_cpp-LabelGenerator.$(OBJEXT)
    802         -rm -f ControlStruct/driver_cfa_cpp-LabelTypeChecker.$(OBJEXT)
    803797        -rm -f ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT)
    804798        -rm -f ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT)
     
    887881        -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT)
    888882        -rm -f SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT)
    889         -rm -f Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT)
    890883        -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT)
     884        -rm -f Tuples/driver_cfa_cpp-TupleExpansion.$(OBJEXT)
    891885
    892886distclean-compile:
     
    907901@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@
    908902@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelGenerator.Po@am__quote@
    909 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po@am__quote@
    910903@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-MLEMutator.Po@am__quote@
    911904@AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Po@am__quote@
     
    994987@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@
    995988@AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po@am__quote@
    996 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po@am__quote@
    997989@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po@am__quote@
     990@AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po@am__quote@
    998991
    999992.cc.o:
     
    12371230@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-ForExprMutator.obj `if test -f 'ControlStruct/ForExprMutator.cc'; then $(CYGPATH_W) 'ControlStruct/ForExprMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/ForExprMutator.cc'; fi`
    12381231
    1239 ControlStruct/driver_cfa_cpp-LabelTypeChecker.o: ControlStruct/LabelTypeChecker.cc
    1240 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelTypeChecker.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.o `test -f 'ControlStruct/LabelTypeChecker.cc' || echo '$(srcdir)/'`ControlStruct/LabelTypeChecker.cc
    1241 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po
    1242 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelTypeChecker.cc' object='ControlStruct/driver_cfa_cpp-LabelTypeChecker.o' libtool=no @AMDEPBACKSLASH@
    1243 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1244 @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-LabelTypeChecker.o `test -f 'ControlStruct/LabelTypeChecker.cc' || echo '$(srcdir)/'`ControlStruct/LabelTypeChecker.cc
    1245 
    1246 ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj: ControlStruct/LabelTypeChecker.cc
    1247 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo -c -o ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj `if test -f 'ControlStruct/LabelTypeChecker.cc'; then $(CYGPATH_W) 'ControlStruct/LabelTypeChecker.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelTypeChecker.cc'; fi`
    1248 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelTypeChecker.Po
    1249 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='ControlStruct/LabelTypeChecker.cc' object='ControlStruct/driver_cfa_cpp-LabelTypeChecker.obj' libtool=no @AMDEPBACKSLASH@
    1250 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    1251 @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-LabelTypeChecker.obj `if test -f 'ControlStruct/LabelTypeChecker.cc'; then $(CYGPATH_W) 'ControlStruct/LabelTypeChecker.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/LabelTypeChecker.cc'; fi`
    1252 
    12531232GenPoly/driver_cfa_cpp-Box.o: GenPoly/Box.cc
    12541233@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT GenPoly/driver_cfa_cpp-Box.o -MD -MP -MF GenPoly/$(DEPDIR)/driver_cfa_cpp-Box.Tpo -c -o GenPoly/driver_cfa_cpp-Box.o `test -f 'GenPoly/Box.cc' || echo '$(srcdir)/'`GenPoly/Box.cc
     
    24412420@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleAssignment.obj `if test -f 'Tuples/TupleAssignment.cc'; then $(CYGPATH_W) 'Tuples/TupleAssignment.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleAssignment.cc'; fi`
    24422421
    2443 Tuples/driver_cfa_cpp-NameMatcher.o: Tuples/NameMatcher.cc
    2444 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-NameMatcher.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo -c -o Tuples/driver_cfa_cpp-NameMatcher.o `test -f 'Tuples/NameMatcher.cc' || echo '$(srcdir)/'`Tuples/NameMatcher.cc
    2445 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po
    2446 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/NameMatcher.cc' object='Tuples/driver_cfa_cpp-NameMatcher.o' libtool=no @AMDEPBACKSLASH@
    2447 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2448 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-NameMatcher.o `test -f 'Tuples/NameMatcher.cc' || echo '$(srcdir)/'`Tuples/NameMatcher.cc
    2449 
    2450 Tuples/driver_cfa_cpp-NameMatcher.obj: Tuples/NameMatcher.cc
    2451 @am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-NameMatcher.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo -c -o Tuples/driver_cfa_cpp-NameMatcher.obj `if test -f 'Tuples/NameMatcher.cc'; then $(CYGPATH_W) 'Tuples/NameMatcher.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/NameMatcher.cc'; fi`
    2452 @am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po
    2453 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/NameMatcher.cc' object='Tuples/driver_cfa_cpp-NameMatcher.obj' libtool=no @AMDEPBACKSLASH@
    2454 @AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
    2455 @am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-NameMatcher.obj `if test -f 'Tuples/NameMatcher.cc'; then $(CYGPATH_W) 'Tuples/NameMatcher.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/NameMatcher.cc'; fi`
     2422Tuples/driver_cfa_cpp-TupleExpansion.o: Tuples/TupleExpansion.cc
     2423@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleExpansion.o -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc
     2424@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po
     2425@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.o' libtool=no @AMDEPBACKSLASH@
     2426@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2427@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleExpansion.o `test -f 'Tuples/TupleExpansion.cc' || echo '$(srcdir)/'`Tuples/TupleExpansion.cc
     2428
     2429Tuples/driver_cfa_cpp-TupleExpansion.obj: Tuples/TupleExpansion.cc
     2430@am__fastdepCXX_TRUE@   $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT Tuples/driver_cfa_cpp-TupleExpansion.obj -MD -MP -MF Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo -c -o Tuples/driver_cfa_cpp-TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`
     2431@am__fastdepCXX_TRUE@   $(AM_V_at)$(am__mv) Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Tpo Tuples/$(DEPDIR)/driver_cfa_cpp-TupleExpansion.Po
     2432@AMDEP_TRUE@@am__fastdepCXX_FALSE@      $(AM_V_CXX)source='Tuples/TupleExpansion.cc' object='Tuples/driver_cfa_cpp-TupleExpansion.obj' libtool=no @AMDEPBACKSLASH@
     2433@AMDEP_TRUE@@am__fastdepCXX_FALSE@      DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
     2434@am__fastdepCXX_FALSE@  $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o Tuples/driver_cfa_cpp-TupleExpansion.obj `if test -f 'Tuples/TupleExpansion.cc'; then $(CYGPATH_W) 'Tuples/TupleExpansion.cc'; else $(CYGPATH_W) '$(srcdir)/Tuples/TupleExpansion.cc'; fi`
    24562435
    24572436.ll.cc:
  • src/Parser/ExpressionNode.cc

    r47a8d17 r3f0c6a5  
    198198}
    199199
    200 Expression *build_fieldSel( ExpressionNode *expr_node, NameExpr *member ) {
    201         UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), maybeMoveBuild< Expression >(expr_node) );
    202         delete member;
    203         return ret;
    204 }
    205 
    206 Expression *build_pfieldSel( ExpressionNode *expr_node, NameExpr *member ) {
     200Expression *build_fieldSel( ExpressionNode *expr_node, Expression *member ) {
     201        UntypedMemberExpr *ret = new UntypedMemberExpr( member, maybeMoveBuild< Expression >(expr_node) );
     202        return ret;
     203}
     204
     205Expression *build_pfieldSel( ExpressionNode *expr_node, Expression *member ) {
    207206        UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) );
    208207        deref->get_args().push_back( maybeMoveBuild< Expression >(expr_node) );
    209         UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), deref );
    210         delete member;
     208        UntypedMemberExpr *ret = new UntypedMemberExpr( member, deref );
    211209        return ret;
    212210}
  • src/Parser/ParseNode.h

    r47a8d17 r3f0c6a5  
    160160
    161161Expression * build_cast( DeclarationNode * decl_node, ExpressionNode * expr_node );
    162 Expression * build_fieldSel( ExpressionNode * expr_node, NameExpr * member );
    163 Expression * build_pfieldSel( ExpressionNode * expr_node, NameExpr * member );
     162Expression * build_fieldSel( ExpressionNode * expr_node, Expression * member );
     163Expression * build_pfieldSel( ExpressionNode * expr_node, Expression * member );
    164164Expression * build_addressOf( ExpressionNode * expr_node );
    165165Expression * build_sizeOfexpr( ExpressionNode * expr_node );
     
    383383//##############################################################################
    384384
    385 template< typename SynTreeType, typename NodeType >
    386 void buildList( const NodeType * firstNode, std::list< SynTreeType * > &outputList ) {
     385template< typename SynTreeType, typename NodeType, template< typename, typename...> class Container, typename... Args >
     386void buildList( const NodeType * firstNode, Container< SynTreeType *, Args... > &outputList ) {
    387387        SemanticError errors;
    388         std::back_insert_iterator< std::list< SynTreeType * > > out( outputList );
     388        std::back_insert_iterator< Container< SynTreeType *, Args... > > out( outputList );
    389389        const NodeType * cur = firstNode;
    390390
  • src/Parser/TypeData.cc

    r47a8d17 r3f0c6a5  
    385385} // TypeData::print
    386386
    387 void buildForall( const DeclarationNode * firstNode, list< TypeDecl* > &outputList ) {
     387template< typename ForallList >
     388void buildForall( const DeclarationNode * firstNode, ForallList &outputList ) {
    388389        buildList( firstNode, outputList );
    389         for ( list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
    390                 if ( (*i)->get_kind() == TypeDecl::Any ) {
     390        for ( typename ForallList::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
     391                TypeDecl * td = static_cast<TypeDecl*>(*i);
     392                if ( td->get_kind() == TypeDecl::Any ) {
    391393                        // add assertion parameters to `type' tyvars in reverse order
    392394                        // add dtor:  void ^?{}(T *)
    393395                        FunctionType * dtorType = new FunctionType( Type::Qualifiers(), false );
    394                         dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
    395                         (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, nullptr, false, false ) );
     396                        dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     397                        td->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, nullptr, false, false ) );
    396398
    397399                        // add copy ctor:  void ?{}(T *, T)
    398400                        FunctionType * copyCtorType = new FunctionType( Type::Qualifiers(), false );
    399                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
    400                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) );
    401                         (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, nullptr, false, false ) );
     401                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     402                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     403                        td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, nullptr, false, false ) );
    402404
    403405                        // add default ctor:  void ?{}(T *)
    404406                        FunctionType * ctorType = new FunctionType( Type::Qualifiers(), false );
    405                         ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
    406                         (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, nullptr, false, false ) );
     407                        ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     408                        td->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, nullptr, false, false ) );
    407409
    408410                        // add assignment operator:  T * ?=?(T *, T)
    409411                        FunctionType * assignType = new FunctionType( Type::Qualifiers(), false );
    410                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), nullptr ) );
    411                         assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) );
    412                         assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), nullptr ) );
    413                         (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, nullptr, false, false ) );
     412                        assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), td->get_name(), *i ) ), nullptr ) );
     413                        assignType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     414                        assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, new TypeInstType( Type::Qualifiers(), td->get_name(), *i ), nullptr ) );
     415                        td->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, nullptr, false, false ) );
    414416                } // if
    415417        } // for
     
    515517                // character types. The implementation shall define char to have the same range, representation, and behavior as
    516518                // either signed char or unsigned char.
    517                 static BasicType::Kind chartype[] = { BasicType::SignedChar, BasicType::UnsignedChar, BasicType::Char }; 
     519                static BasicType::Kind chartype[] = { BasicType::SignedChar, BasicType::UnsignedChar, BasicType::Char };
    518520
    519521                if ( td->length != DeclarationNode::NoLength ) {
  • src/Parser/parser.cc

    r47a8d17 r3f0c6a5  
    10261026static const yytype_uint16 yyrline[] =
    10271027{
    1028        0,   306,   306,   310,   317,   318,   319,   320,   321,   325,
    1029      326,   327,   331,   332,   336,   337,   341,   342,   346,   350,
    1030      351,   362,   364,   366,   367,   369,   374,   375,   381,   383,
    1031      385,   386,   387,   389,   390,   392,   394,   396,   405,   406,
    1032      412,   413,   417,   418,   422,   424,   426,   428,   430,   432,
    1033      434,   439,   441,   443,   447,   449,   453,   456,   458,   460,
    1034      465,   478,   480,   482,   484,   486,   488,   490,   492,   494,
    1035      496,   498,   505,   506,   512,   513,   514,   515,   519,   520,
    1036      527,   528,   530,   532,   537,   538,   540,   545,   546,   548,
    1037      553,   554,   556,   558,   560,   565,   566,   568,   573,   574,
    1038      579,   580,   585,   586,   591,   592,   597,   598,   603,   604,
    1039      607,   614,   619,   620,   628,   629,   633,   634,   635,   636,
    1040      637,   638,   639,   640,   641,   642,   643,   644,   654,   656,
    1041      661,   662,   667,   668,   674,   675,   681,   682,   683,   684,
    1042      685,   686,   687,   688,   689,   699,   706,   708,   718,   719,
    1043      724,   726,   732,   734,   738,   739,   744,   749,   752,   754,
    1044      756,   766,   768,   779,   780,   782,   786,   788,   792,   793,
    1045      798,   799,   803,   808,   809,   813,   815,   821,   822,   826,
    1046      828,   830,   832,   838,   839,   843,   845,   850,   852,   854,
    1047      859,   861,   866,   868,   872,   875,   879,   882,   886,   888,
    1048      890,   892,   897,   899,   901,   906,   908,   910,   912,   914,
    1049      919,   921,   923,   925,   930,   942,   943,   948,   950,   955,
    1050      959,   961,   963,   965,   967,   973,   974,   980,   981,   985,
    1051      986,   991,   993,   999,  1000,  1002,  1007,  1012,  1022,  1024,
    1052     1028,  1029,  1034,  1036,  1040,  1041,  1045,  1047,  1051,  1052,
    1053     1056,  1057,  1061,  1062,  1077,  1078,  1079,  1080,  1081,  1085,
    1054     1090,  1097,  1107,  1112,  1117,  1125,  1130,  1135,  1140,  1145,
    1055     1175,  1180,  1187,  1189,  1196,  1201,  1206,  1217,  1222,  1227,
    1056     1232,  1237,  1246,  1251,  1259,  1260,  1261,  1262,  1268,  1273,
    1057     1281,  1282,  1283,  1284,  1288,  1289,  1290,  1291,  1296,  1297,
    1058     1306,  1307,  1312,  1313,  1318,  1320,  1322,  1324,  1326,  1329,
    1059     1328,  1340,  1341,  1343,  1353,  1354,  1359,  1361,  1363,  1365,
    1060     1367,  1370,  1372,  1375,  1380,  1382,  1384,  1386,  1388,  1390,
    1061     1392,  1394,  1396,  1398,  1400,  1402,  1404,  1410,  1411,  1413,
    1062     1415,  1417,  1422,  1423,  1429,  1430,  1432,  1434,  1439,  1441,
    1063     1443,  1445,  1450,  1451,  1453,  1455,  1460,  1461,  1463,  1468,
    1064     1469,  1471,  1473,  1478,  1480,  1482,  1487,  1488,  1492,  1494,
    1065     1500,  1499,  1503,  1505,  1510,  1512,  1518,  1519,  1524,  1525,
    1066     1527,  1528,  1537,  1538,  1540,  1542,  1547,  1549,  1555,  1556,
    1067     1558,  1561,  1564,  1569,  1570,  1575,  1580,  1584,  1586,  1592,
    1068     1591,  1598,  1600,  1606,  1607,  1615,  1616,  1620,  1621,  1622,
    1069     1624,  1626,  1633,  1634,  1636,  1638,  1643,  1644,  1650,  1651,
    1070     1655,  1656,  1661,  1662,  1663,  1665,  1673,  1674,  1676,  1679,
    1071     1681,  1685,  1686,  1687,  1689,  1691,  1695,  1700,  1708,  1709,
    1072     1718,  1720,  1725,  1726,  1727,  1731,  1732,  1733,  1737,  1738,
    1073     1739,  1743,  1744,  1745,  1750,  1751,  1752,  1753,  1759,  1760,
    1074     1762,  1767,  1768,  1773,  1774,  1775,  1776,  1777,  1792,  1793,
    1075     1798,  1799,  1805,  1807,  1810,  1812,  1814,  1837,  1838,  1840,
    1076     1842,  1847,  1848,  1850,  1855,  1860,  1861,  1867,  1866,  1870,
    1077     1874,  1876,  1878,  1884,  1885,  1890,  1895,  1897,  1902,  1904,
    1078     1905,  1907,  1912,  1914,  1916,  1921,  1923,  1928,  1933,  1941,
    1079     1947,  1946,  1960,  1961,  1966,  1967,  1971,  1976,  1981,  1989,
    1080     1994,  2005,  2006,  2011,  2012,  2018,  2019,  2023,  2024,  2025,
    1081     2028,  2027,  2038,  2047,  2053,  2059,  2068,  2074,  2080,  2086,
    1082     2092,  2100,  2106,  2114,  2120,  2129,  2130,  2131,  2135,  2139,
    1083     2141,  2146,  2147,  2151,  2152,  2157,  2163,  2164,  2167,  2169,
    1084     2170,  2174,  2175,  2176,  2177,  2211,  2213,  2214,  2216,  2221,
    1085     2226,  2231,  2233,  2235,  2240,  2242,  2244,  2246,  2251,  2253,
    1086     2262,  2264,  2265,  2270,  2272,  2274,  2279,  2281,  2283,  2288,
    1087     2290,  2292,  2301,  2302,  2303,  2307,  2309,  2311,  2316,  2318,
    1088     2320,  2325,  2327,  2329,  2344,  2346,  2347,  2349,  2354,  2355,
    1089     2360,  2362,  2364,  2369,  2371,  2373,  2375,  2380,  2382,  2384,
    1090     2394,  2396,  2397,  2399,  2404,  2406,  2408,  2413,  2415,  2417,
    1091     2419,  2424,  2426,  2428,  2459,  2461,  2462,  2464,  2469,  2474,
    1092     2482,  2484,  2486,  2491,  2493,  2498,  2500,  2514,  2515,  2517,
    1093     2522,  2524,  2526,  2528,  2530,  2535,  2536,  2538,  2540,  2545,
    1094     2547,  2549,  2555,  2557,  2559,  2563,  2565,  2567,  2569,  2583,
    1095     2584,  2586,  2591,  2593,  2595,  2597,  2599,  2604,  2605,  2607,
    1096     2609,  2614,  2616,  2618,  2624,  2625,  2627,  2636,  2639,  2641,
    1097     2644,  2646,  2648,  2661,  2662,  2664,  2669,  2671,  2673,  2675,
    1098     2677,  2682,  2683,  2685,  2687,  2692,  2694,  2702,  2703,  2704,
    1099     2709,  2710,  2714,  2716,  2718,  2720,  2722,  2724,  2731,  2733,
    1100     2735,  2737,  2739,  2742,  2744,  2746,  2748,  2750,  2755,  2757,
    1101     2759,  2764,  2790,  2791,  2793,  2797,  2798,  2802,  2804,  2806,
    1102     2808,  2810,  2812,  2819,  2821,  2823,  2825,  2827,  2829,  2834,
    1103     2841,  2843,  2861,  2863,  2868,  2869
     1028       0,   305,   305,   309,   316,   317,   318,   319,   320,   324,
     1029     325,   326,   330,   331,   335,   336,   340,   341,   345,   349,
     1030     350,   361,   363,   365,   366,   368,   373,   374,   380,   382,
     1031     384,   386,   388,   390,   392,   394,   396,   398,   407,   408,
     1032     414,   415,   419,   420,   424,   425,   427,   429,   431,   433,
     1033     435,   440,   442,   444,   448,   450,   454,   457,   459,   461,
     1034     466,   479,   481,   483,   485,   487,   489,   491,   493,   495,
     1035     497,   499,   506,   507,   513,   514,   515,   516,   520,   521,
     1036     528,   529,   531,   533,   538,   539,   541,   546,   547,   549,
     1037     554,   555,   557,   559,   561,   566,   567,   569,   574,   575,
     1038     580,   581,   586,   587,   592,   593,   598,   599,   604,   605,
     1039     608,   615,   620,   621,   629,   630,   634,   635,   636,   637,
     1040     638,   639,   640,   641,   642,   643,   644,   645,   655,   657,
     1041     662,   663,   668,   669,   675,   676,   682,   683,   684,   685,
     1042     686,   687,   688,   689,   690,   700,   707,   709,   719,   720,
     1043     725,   727,   733,   735,   739,   740,   745,   750,   753,   755,
     1044     757,   767,   769,   780,   781,   783,   787,   789,   793,   794,
     1045     799,   800,   804,   809,   810,   814,   816,   822,   823,   827,
     1046     829,   831,   833,   839,   840,   844,   846,   851,   853,   855,
     1047     860,   862,   867,   869,   873,   876,   880,   883,   887,   889,
     1048     891,   893,   898,   900,   902,   907,   909,   911,   913,   915,
     1049     920,   922,   924,   926,   931,   943,   944,   949,   951,   956,
     1050     960,   962,   964,   966,   968,   974,   975,   981,   982,   986,
     1051     987,   992,   994,  1000,  1001,  1003,  1008,  1013,  1023,  1025,
     1052    1029,  1030,  1035,  1037,  1041,  1042,  1046,  1048,  1052,  1053,
     1053    1057,  1058,  1062,  1063,  1078,  1079,  1080,  1081,  1082,  1086,
     1054    1091,  1098,  1108,  1113,  1118,  1126,  1131,  1136,  1141,  1146,
     1055    1176,  1181,  1188,  1190,  1197,  1202,  1207,  1218,  1223,  1228,
     1056    1233,  1238,  1247,  1252,  1260,  1261,  1262,  1263,  1269,  1274,
     1057    1282,  1283,  1284,  1285,  1289,  1290,  1291,  1292,  1297,  1298,
     1058    1307,  1308,  1313,  1314,  1319,  1321,  1323,  1325,  1327,  1330,
     1059    1329,  1341,  1342,  1344,  1354,  1355,  1360,  1362,  1364,  1366,
     1060    1368,  1371,  1373,  1376,  1381,  1383,  1385,  1387,  1389,  1391,
     1061    1393,  1395,  1397,  1399,  1401,  1403,  1405,  1411,  1412,  1414,
     1062    1416,  1418,  1423,  1424,  1430,  1431,  1433,  1435,  1440,  1442,
     1063    1444,  1446,  1451,  1452,  1454,  1456,  1461,  1462,  1464,  1469,
     1064    1470,  1472,  1474,  1479,  1481,  1483,  1488,  1489,  1493,  1495,
     1065    1501,  1500,  1504,  1506,  1511,  1513,  1519,  1520,  1525,  1526,
     1066    1528,  1529,  1538,  1539,  1541,  1543,  1548,  1550,  1556,  1557,
     1067    1559,  1562,  1565,  1570,  1571,  1576,  1581,  1585,  1587,  1593,
     1068    1592,  1599,  1601,  1607,  1608,  1616,  1617,  1621,  1622,  1623,
     1069    1625,  1627,  1634,  1635,  1637,  1639,  1644,  1645,  1651,  1652,
     1070    1656,  1657,  1662,  1663,  1664,  1666,  1674,  1675,  1677,  1680,
     1071    1682,  1686,  1687,  1688,  1690,  1692,  1696,  1701,  1709,  1710,
     1072    1719,  1721,  1726,  1727,  1728,  1732,  1733,  1734,  1738,  1739,
     1073    1740,  1744,  1745,  1746,  1751,  1752,  1753,  1754,  1760,  1761,
     1074    1763,  1768,  1769,  1774,  1775,  1776,  1777,  1778,  1793,  1794,
     1075    1799,  1800,  1806,  1808,  1811,  1813,  1815,  1838,  1839,  1841,
     1076    1843,  1848,  1849,  1851,  1856,  1861,  1862,  1868,  1867,  1871,
     1077    1875,  1877,  1879,  1885,  1886,  1891,  1896,  1898,  1903,  1905,
     1078    1906,  1908,  1913,  1915,  1917,  1922,  1924,  1929,  1934,  1942,
     1079    1948,  1947,  1961,  1962,  1967,  1968,  1972,  1977,  1982,  1990,
     1080    1995,  2006,  2007,  2012,  2013,  2019,  2020,  2024,  2025,  2026,
     1081    2029,  2028,  2039,  2048,  2054,  2060,  2069,  2075,  2081,  2087,
     1082    2093,  2101,  2107,  2115,  2121,  2130,  2131,  2132,  2136,  2140,
     1083    2142,  2147,  2148,  2152,  2153,  2158,  2164,  2165,  2168,  2170,
     1084    2171,  2175,  2176,  2177,  2178,  2212,  2214,  2215,  2217,  2222,
     1085    2227,  2232,  2234,  2236,  2241,  2243,  2245,  2247,  2252,  2254,
     1086    2263,  2265,  2266,  2271,  2273,  2275,  2280,  2282,  2284,  2289,
     1087    2291,  2293,  2302,  2303,  2304,  2308,  2310,  2312,  2317,  2319,
     1088    2321,  2326,  2328,  2330,  2345,  2347,  2348,  2350,  2355,  2356,
     1089    2361,  2363,  2365,  2370,  2372,  2374,  2376,  2381,  2383,  2385,
     1090    2395,  2397,  2398,  2400,  2405,  2407,  2409,  2414,  2416,  2418,
     1091    2420,  2425,  2427,  2429,  2460,  2462,  2463,  2465,  2470,  2475,
     1092    2483,  2485,  2487,  2492,  2494,  2499,  2501,  2515,  2516,  2518,
     1093    2523,  2525,  2527,  2529,  2531,  2536,  2537,  2539,  2541,  2546,
     1094    2548,  2550,  2556,  2558,  2560,  2564,  2566,  2568,  2570,  2584,
     1095    2585,  2587,  2592,  2594,  2596,  2598,  2600,  2605,  2606,  2608,
     1096    2610,  2615,  2617,  2619,  2625,  2626,  2628,  2637,  2640,  2642,
     1097    2645,  2647,  2649,  2662,  2663,  2665,  2670,  2672,  2674,  2676,
     1098    2678,  2683,  2684,  2686,  2688,  2693,  2695,  2703,  2704,  2705,
     1099    2710,  2711,  2715,  2717,  2719,  2721,  2723,  2725,  2732,  2734,
     1100    2736,  2738,  2740,  2743,  2745,  2747,  2749,  2751,  2756,  2758,
     1101    2760,  2765,  2791,  2792,  2794,  2798,  2799,  2803,  2805,  2807,
     1102    2809,  2811,  2813,  2820,  2822,  2824,  2826,  2828,  2830,  2835,
     1103    2842,  2844,  2862,  2864,  2869,  2870
    11041104};
    11051105#endif
     
    48514851
    48524852/* Line 1806 of yacc.c  */
    4853 #line 306 "parser.yy"
     4853#line 305 "parser.yy"
    48544854    { typedefTable.enterScope(); }
    48554855    break;
     
    48584858
    48594859/* Line 1806 of yacc.c  */
    4860 #line 310 "parser.yy"
     4860#line 309 "parser.yy"
    48614861    { typedefTable.leaveScope(); }
    48624862    break;
     
    48654865
    48664866/* Line 1806 of yacc.c  */
     4867#line 316 "parser.yy"
     4868    { (yyval.en) = new ExpressionNode( build_constantInteger( *(yyvsp[(1) - (1)].tok) ) ); }
     4869    break;
     4870
     4871  case 5:
     4872
     4873/* Line 1806 of yacc.c  */
    48674874#line 317 "parser.yy"
    4868     { (yyval.en) = new ExpressionNode( build_constantInteger( *(yyvsp[(1) - (1)].tok) ) ); }
    4869     break;
    4870 
    4871   case 5:
     4875    { (yyval.en) = new ExpressionNode( build_constantFloat( *(yyvsp[(1) - (1)].tok) ) ); }
     4876    break;
     4877
     4878  case 6:
    48724879
    48734880/* Line 1806 of yacc.c  */
     
    48764883    break;
    48774884
    4878   case 6:
     4885  case 7:
    48794886
    48804887/* Line 1806 of yacc.c  */
     
    48834890    break;
    48844891
    4885   case 7:
     4892  case 8:
    48864893
    48874894/* Line 1806 of yacc.c  */
    48884895#line 320 "parser.yy"
    4889     { (yyval.en) = new ExpressionNode( build_constantFloat( *(yyvsp[(1) - (1)].tok) ) ); }
    4890     break;
    4891 
    4892   case 8:
    4893 
    4894 /* Line 1806 of yacc.c  */
    4895 #line 321 "parser.yy"
    48964896    { (yyval.en) = new ExpressionNode( build_constantChar( *(yyvsp[(1) - (1)].tok) ) ); }
    48974897    break;
     
    49004900
    49014901/* Line 1806 of yacc.c  */
    4902 #line 346 "parser.yy"
     4902#line 345 "parser.yy"
    49034903    { (yyval.constant) = build_constantStr( *(yyvsp[(1) - (1)].str) ); }
    49044904    break;
     
    49074907
    49084908/* Line 1806 of yacc.c  */
    4909 #line 350 "parser.yy"
     4909#line 349 "parser.yy"
    49104910    { (yyval.str) = (yyvsp[(1) - (1)].tok); }
    49114911    break;
     
    49144914
    49154915/* Line 1806 of yacc.c  */
    4916 #line 352 "parser.yy"
     4916#line 351 "parser.yy"
    49174917    {
    49184918                        appendStr( (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].tok) );                                            // append 2nd juxtaposed string to 1st
     
    49254925
    49264926/* Line 1806 of yacc.c  */
    4927 #line 363 "parser.yy"
     4927#line 362 "parser.yy"
    49284928    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); }
    49294929    break;
     
    49324932
    49334933/* Line 1806 of yacc.c  */
    4934 #line 365 "parser.yy"
     4934#line 364 "parser.yy"
    49354935    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); }
    49364936    break;
     
    49394939
    49404940/* Line 1806 of yacc.c  */
    4941 #line 368 "parser.yy"
     4941#line 367 "parser.yy"
    49424942    { (yyval.en) = (yyvsp[(2) - (3)].en); }
    49434943    break;
     
    49464946
    49474947/* Line 1806 of yacc.c  */
    4948 #line 370 "parser.yy"
     4948#line 369 "parser.yy"
    49494949    { (yyval.en) = new ExpressionNode( build_valexpr( (yyvsp[(2) - (3)].sn) ) ); }
    49504950    break;
     
    49534953
    49544954/* Line 1806 of yacc.c  */
    4955 #line 380 "parser.yy"
     4955#line 379 "parser.yy"
    49564956    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Index, (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en) ) ); }
    49574957    break;
     
    49604960
    49614961/* Line 1806 of yacc.c  */
    4962 #line 382 "parser.yy"
     4962#line 381 "parser.yy"
    49634963    { (yyval.en) = new ExpressionNode( build_func( (yyvsp[(1) - (4)].en), (yyvsp[(3) - (4)].en) ) ); }
    49644964    break;
     
    49674967
    49684968/* Line 1806 of yacc.c  */
    4969 #line 384 "parser.yy"
     4969#line 383 "parser.yy"
    49704970    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (3)].en), build_varref( (yyvsp[(3) - (3)].tok) ) ) ); }
    49714971    break;
    49724972
     4973  case 30:
     4974
     4975/* Line 1806 of yacc.c  */
     4976#line 385 "parser.yy"
     4977    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
     4978    break;
     4979
     4980  case 31:
     4981
     4982/* Line 1806 of yacc.c  */
     4983#line 387 "parser.yy"
     4984    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (2)].en), build_constantInteger( *(yyvsp[(2) - (2)].tok) ) ) ); }
     4985    break;
     4986
    49734987  case 32:
    49744988
    49754989/* Line 1806 of yacc.c  */
    4976 #line 388 "parser.yy"
     4990#line 389 "parser.yy"
    49774991    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (3)].en), build_varref( (yyvsp[(3) - (3)].tok) ) ) ); }
    49784992    break;
    49794993
     4994  case 33:
     4995
     4996/* Line 1806 of yacc.c  */
     4997#line 391 "parser.yy"
     4998    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
     4999    break;
     5000
    49805001  case 34:
    49815002
    49825003/* Line 1806 of yacc.c  */
    4983 #line 391 "parser.yy"
     5004#line 393 "parser.yy"
    49845005    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, (yyvsp[(1) - (2)].en) ) ); }
    49855006    break;
     
    49885009
    49895010/* Line 1806 of yacc.c  */
    4990 #line 393 "parser.yy"
     5011#line 395 "parser.yy"
    49915012    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::DecrPost, (yyvsp[(1) - (2)].en) ) ); }
    49925013    break;
     
    49955016
    49965017/* Line 1806 of yacc.c  */
    4997 #line 395 "parser.yy"
     5018#line 397 "parser.yy"
    49985019    { (yyval.en) = new ExpressionNode( build_compoundLiteral( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ) ); }
    49995020    break;
     
    50025023
    50035024/* Line 1806 of yacc.c  */
    5004 #line 397 "parser.yy"
     5025#line 399 "parser.yy"
    50055026    {
    50065027                        Token fn;
     
    50135034
    50145035/* Line 1806 of yacc.c  */
    5015 #line 407 "parser.yy"
     5036#line 409 "parser.yy"
    50165037    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); }
    50175038    break;
     
    50205041
    50215042/* Line 1806 of yacc.c  */
    5022 #line 412 "parser.yy"
     5043#line 414 "parser.yy"
    50235044    { (yyval.en) = 0; }
    50245045    break;
     
    50275048
    50285049/* Line 1806 of yacc.c  */
    5029 #line 418 "parser.yy"
     5050#line 420 "parser.yy"
    50305051    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
    50315052    break;
    50325053
    5033   case 44:
    5034 
    5035 /* Line 1806 of yacc.c  */
    5036 #line 423 "parser.yy"
    5037     { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (1)].tok) ) ); }
    5038     break;
    5039 
    50405054  case 45:
    50415055
    50425056/* Line 1806 of yacc.c  */
    5043 #line 425 "parser.yy"
    5044     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(2) - (2)].en), build_varref( (yyvsp[(1) - (2)].tok) ) ) ); }
     5057#line 426 "parser.yy"
     5058    { (yyval.en) = new ExpressionNode( build_fieldSel( new ExpressionNode( build_constantInteger( *(yyvsp[(1) - (2)].tok) ) ), maybeMoveBuild<Expression>( (yyvsp[(2) - (2)].en) ) ) ); }
    50455059    break;
    50465060
     
    50485062
    50495063/* Line 1806 of yacc.c  */
    5050 #line 427 "parser.yy"
    5051     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(4) - (6)].en), build_varref( (yyvsp[(1) - (6)].tok) ) ) ); }
     5064#line 428 "parser.yy"
     5065    { (yyval.en) = new ExpressionNode( build_fieldSel( new ExpressionNode( build_constantInteger( *(yyvsp[(1) - (6)].tok) ) ), build_tuple( (yyvsp[(4) - (6)].en) ) ) ); }
    50525066    break;
    50535067
     
    50555069
    50565070/* Line 1806 of yacc.c  */
    5057 #line 429 "parser.yy"
    5058     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }
     5071#line 430 "parser.yy"
     5072    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (3)].en), maybeMoveBuild<Expression>( (yyvsp[(3) - (3)].en) ) ) ); }
    50595073    break;
    50605074
     
    50625076
    50635077/* Line 1806 of yacc.c  */
    5064 #line 431 "parser.yy"
    5065     { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); }
     5078#line 432 "parser.yy"
     5079    { (yyval.en) = new ExpressionNode( build_fieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
    50665080    break;
    50675081
     
    50695083
    50705084/* Line 1806 of yacc.c  */
    5071 #line 433 "parser.yy"
    5072     { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(3) - (3)].en), build_varref( (yyvsp[(1) - (3)].tok) ) ) ); }
     5085#line 434 "parser.yy"
     5086    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (3)].en), maybeMoveBuild<Expression>( (yyvsp[(3) - (3)].en) ) ) ); }
    50735087    break;
    50745088
     
    50765090
    50775091/* Line 1806 of yacc.c  */
    5078 #line 435 "parser.yy"
    5079     { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(5) - (7)].en), build_varref( (yyvsp[(1) - (7)].tok) ) ) ); }
     5092#line 436 "parser.yy"
     5093    { (yyval.en) = new ExpressionNode( build_pfieldSel( (yyvsp[(1) - (7)].en), build_tuple( (yyvsp[(5) - (7)].en) ) ) ); }
    50805094    break;
    50815095
     
    50835097
    50845098/* Line 1806 of yacc.c  */
    5085 #line 440 "parser.yy"
    5086     { (yyval.tok) = (yyvsp[(1) - (2)].tok); }
     5099#line 441 "parser.yy"
     5100    { (yyval.en) = new ExpressionNode( build_constantInteger( *(yyvsp[(1) - (2)].tok) ) ); }
    50875101    break;
    50885102
     
    50905104
    50915105/* Line 1806 of yacc.c  */
    5092 #line 442 "parser.yy"
    5093     { (yyval.tok) = (yyvsp[(1) - (2)].tok); }
     5106#line 443 "parser.yy"
     5107    { (yyval.en) = new ExpressionNode( build_constantInteger( *(yyvsp[(1) - (2)].tok) ) ); }
    50945108    break;
    50955109
     
    50975111
    50985112/* Line 1806 of yacc.c  */
    5099 #line 444 "parser.yy"
    5100     { (yyval.tok) = (yyvsp[(1) - (2)].tok); }
     5113#line 445 "parser.yy"
     5114    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (2)].tok) ) ); }
    51015115    break;
    51025116
     
    51045118
    51055119/* Line 1806 of yacc.c  */
    5106 #line 457 "parser.yy"
     5120#line 458 "parser.yy"
    51075121    { (yyval.en) = (yyvsp[(1) - (1)].en); }
    51085122    break;
     
    51115125
    51125126/* Line 1806 of yacc.c  */
    5113 #line 459 "parser.yy"
     5127#line 460 "parser.yy"
    51145128    { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }
    51155129    break;
     
    51185132
    51195133/* Line 1806 of yacc.c  */
    5120 #line 461 "parser.yy"
     5134#line 462 "parser.yy"
    51215135    { (yyval.en) = (yyvsp[(2) - (2)].en)->set_extension( true ); }
    51225136    break;
     
    51255139
    51265140/* Line 1806 of yacc.c  */
    5127 #line 466 "parser.yy"
     5141#line 467 "parser.yy"
    51285142    {
    51295143                        switch ( (yyvsp[(1) - (2)].op) ) {
     
    51435157
    51445158/* Line 1806 of yacc.c  */
    5145 #line 479 "parser.yy"
     5159#line 480 "parser.yy"
    51465160    { (yyval.en) = new ExpressionNode( build_unary_val( (yyvsp[(1) - (2)].op), (yyvsp[(2) - (2)].en) ) ); }
    51475161    break;
     
    51505164
    51515165/* Line 1806 of yacc.c  */
    5152 #line 481 "parser.yy"
     5166#line 482 "parser.yy"
    51535167    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Incr, (yyvsp[(2) - (2)].en) ) ); }
    51545168    break;
     
    51575171
    51585172/* Line 1806 of yacc.c  */
    5159 #line 483 "parser.yy"
     5173#line 484 "parser.yy"
    51605174    { (yyval.en) = new ExpressionNode( build_unary_ptr( OperKinds::Decr, (yyvsp[(2) - (2)].en) ) ); }
    51615175    break;
     
    51645178
    51655179/* Line 1806 of yacc.c  */
    5166 #line 485 "parser.yy"
     5180#line 486 "parser.yy"
    51675181    { (yyval.en) = new ExpressionNode( build_sizeOfexpr( (yyvsp[(2) - (2)].en) ) ); }
    51685182    break;
     
    51715185
    51725186/* Line 1806 of yacc.c  */
    5173 #line 487 "parser.yy"
     5187#line 488 "parser.yy"
    51745188    { (yyval.en) = new ExpressionNode( build_sizeOftype( (yyvsp[(3) - (4)].decl) ) ); }
    51755189    break;
     
    51785192
    51795193/* Line 1806 of yacc.c  */
    5180 #line 489 "parser.yy"
     5194#line 490 "parser.yy"
    51815195    { (yyval.en) = new ExpressionNode( build_alignOfexpr( (yyvsp[(2) - (2)].en) ) ); }
    51825196    break;
     
    51855199
    51865200/* Line 1806 of yacc.c  */
    5187 #line 491 "parser.yy"
     5201#line 492 "parser.yy"
    51885202    { (yyval.en) = new ExpressionNode( build_alignOftype( (yyvsp[(3) - (4)].decl) ) ); }
    51895203    break;
     
    51925206
    51935207/* Line 1806 of yacc.c  */
    5194 #line 493 "parser.yy"
     5208#line 494 "parser.yy"
    51955209    { (yyval.en) = new ExpressionNode( build_offsetOf( (yyvsp[(3) - (6)].decl), build_varref( (yyvsp[(5) - (6)].tok) ) ) ); }
    51965210    break;
     
    51995213
    52005214/* Line 1806 of yacc.c  */
    5201 #line 495 "parser.yy"
     5215#line 496 "parser.yy"
    52025216    { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (1)].tok) ), nullptr ) ); }
    52035217    break;
     
    52065220
    52075221/* Line 1806 of yacc.c  */
    5208 #line 497 "parser.yy"
     5222#line 498 "parser.yy"
    52095223    { (yyval.en) = new ExpressionNode( build_attrexpr( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ) ); }
    52105224    break;
     
    52135227
    52145228/* Line 1806 of yacc.c  */
    5215 #line 499 "parser.yy"
     5229#line 500 "parser.yy"
    52165230    { (yyval.en) = new ExpressionNode( build_attrtype( build_varref( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].decl) ) ); }
    52175231    break;
     
    52205234
    52215235/* Line 1806 of yacc.c  */
    5222 #line 505 "parser.yy"
     5236#line 506 "parser.yy"
    52235237    { (yyval.op) = OperKinds::PointTo; }
    52245238    break;
     
    52275241
    52285242/* Line 1806 of yacc.c  */
    5229 #line 506 "parser.yy"
     5243#line 507 "parser.yy"
    52305244    { (yyval.op) = OperKinds::AddressOf; }
    52315245    break;
     
    52345248
    52355249/* Line 1806 of yacc.c  */
    5236 #line 512 "parser.yy"
     5250#line 513 "parser.yy"
    52375251    { (yyval.op) = OperKinds::UnPlus; }
    52385252    break;
     
    52415255
    52425256/* Line 1806 of yacc.c  */
    5243 #line 513 "parser.yy"
     5257#line 514 "parser.yy"
    52445258    { (yyval.op) = OperKinds::UnMinus; }
    52455259    break;
     
    52485262
    52495263/* Line 1806 of yacc.c  */
    5250 #line 514 "parser.yy"
     5264#line 515 "parser.yy"
    52515265    { (yyval.op) = OperKinds::Neg; }
    52525266    break;
     
    52555269
    52565270/* Line 1806 of yacc.c  */
    5257 #line 515 "parser.yy"
     5271#line 516 "parser.yy"
    52585272    { (yyval.op) = OperKinds::BitNeg; }
    52595273    break;
     
    52625276
    52635277/* Line 1806 of yacc.c  */
    5264 #line 521 "parser.yy"
     5278#line 522 "parser.yy"
    52655279    { (yyval.en) = new ExpressionNode( build_cast( (yyvsp[(2) - (4)].decl), (yyvsp[(4) - (4)].en) ) ); }
    52665280    break;
     
    52695283
    52705284/* Line 1806 of yacc.c  */
    5271 #line 529 "parser.yy"
     5285#line 530 "parser.yy"
    52725286    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mul, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    52735287    break;
     
    52765290
    52775291/* Line 1806 of yacc.c  */
    5278 #line 531 "parser.yy"
     5292#line 532 "parser.yy"
    52795293    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Div, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    52805294    break;
     
    52835297
    52845298/* Line 1806 of yacc.c  */
    5285 #line 533 "parser.yy"
     5299#line 534 "parser.yy"
    52865300    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Mod, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    52875301    break;
     
    52905304
    52915305/* Line 1806 of yacc.c  */
    5292 #line 539 "parser.yy"
     5306#line 540 "parser.yy"
    52935307    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Plus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    52945308    break;
     
    52975311
    52985312/* Line 1806 of yacc.c  */
    5299 #line 541 "parser.yy"
     5313#line 542 "parser.yy"
    53005314    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Minus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53015315    break;
     
    53045318
    53055319/* Line 1806 of yacc.c  */
    5306 #line 547 "parser.yy"
     5320#line 548 "parser.yy"
    53075321    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53085322    break;
     
    53115325
    53125326/* Line 1806 of yacc.c  */
    5313 #line 549 "parser.yy"
     5327#line 550 "parser.yy"
    53145328    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::RShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53155329    break;
     
    53185332
    53195333/* Line 1806 of yacc.c  */
    5320 #line 555 "parser.yy"
     5334#line 556 "parser.yy"
    53215335    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53225336    break;
     
    53255339
    53265340/* Line 1806 of yacc.c  */
    5327 #line 557 "parser.yy"
     5341#line 558 "parser.yy"
    53285342    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53295343    break;
     
    53325346
    53335347/* Line 1806 of yacc.c  */
    5334 #line 559 "parser.yy"
     5348#line 560 "parser.yy"
    53355349    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53365350    break;
     
    53395353
    53405354/* Line 1806 of yacc.c  */
    5341 #line 561 "parser.yy"
     5355#line 562 "parser.yy"
    53425356    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::GEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53435357    break;
     
    53465360
    53475361/* Line 1806 of yacc.c  */
    5348 #line 567 "parser.yy"
     5362#line 568 "parser.yy"
    53495363    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Eq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53505364    break;
     
    53535367
    53545368/* Line 1806 of yacc.c  */
    5355 #line 569 "parser.yy"
     5369#line 570 "parser.yy"
    53565370    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Neq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53575371    break;
     
    53605374
    53615375/* Line 1806 of yacc.c  */
    5362 #line 575 "parser.yy"
     5376#line 576 "parser.yy"
    53635377    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitAnd, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53645378    break;
     
    53675381
    53685382/* Line 1806 of yacc.c  */
    5369 #line 581 "parser.yy"
     5383#line 582 "parser.yy"
    53705384    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::Xor, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53715385    break;
     
    53745388
    53755389/* Line 1806 of yacc.c  */
    5376 #line 587 "parser.yy"
     5390#line 588 "parser.yy"
    53775391    { (yyval.en) = new ExpressionNode( build_binary_val( OperKinds::BitOr, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    53785392    break;
     
    53815395
    53825396/* Line 1806 of yacc.c  */
    5383 #line 593 "parser.yy"
     5397#line 594 "parser.yy"
    53845398    { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), true ) ); }
    53855399    break;
     
    53885402
    53895403/* Line 1806 of yacc.c  */
    5390 #line 599 "parser.yy"
     5404#line 600 "parser.yy"
    53915405    { (yyval.en) = new ExpressionNode( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), false ) ); }
    53925406    break;
     
    53955409
    53965410/* Line 1806 of yacc.c  */
    5397 #line 605 "parser.yy"
     5411#line 606 "parser.yy"
    53985412    { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); }
    53995413    break;
     
    54025416
    54035417/* Line 1806 of yacc.c  */
    5404 #line 608 "parser.yy"
     5418#line 609 "parser.yy"
    54055419    { (yyval.en) = new ExpressionNode( build_cond( (yyvsp[(1) - (4)].en), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ) ); }
    54065420    break;
     
    54095423
    54105424/* Line 1806 of yacc.c  */
    5411 #line 621 "parser.yy"
     5425#line 622 "parser.yy"
    54125426    { (yyval.en) = new ExpressionNode( build_binary_ptr( (yyvsp[(2) - (3)].op), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    54135427    break;
     
    54165430
    54175431/* Line 1806 of yacc.c  */
    5418 #line 628 "parser.yy"
     5432#line 629 "parser.yy"
    54195433    { (yyval.en) = nullptr; }
    54205434    break;
     
    54235437
    54245438/* Line 1806 of yacc.c  */
    5425 #line 633 "parser.yy"
     5439#line 634 "parser.yy"
    54265440    { (yyval.op) = OperKinds::Assign; }
    54275441    break;
     
    54305444
    54315445/* Line 1806 of yacc.c  */
    5432 #line 634 "parser.yy"
     5446#line 635 "parser.yy"
    54335447    { (yyval.op) = OperKinds::AtAssn; }
    54345448    break;
     
    54375451
    54385452/* Line 1806 of yacc.c  */
    5439 #line 635 "parser.yy"
     5453#line 636 "parser.yy"
    54405454    { (yyval.op) = OperKinds::MulAssn; }
    54415455    break;
     
    54445458
    54455459/* Line 1806 of yacc.c  */
    5446 #line 636 "parser.yy"
     5460#line 637 "parser.yy"
    54475461    { (yyval.op) = OperKinds::DivAssn; }
    54485462    break;
     
    54515465
    54525466/* Line 1806 of yacc.c  */
    5453 #line 637 "parser.yy"
     5467#line 638 "parser.yy"
    54545468    { (yyval.op) = OperKinds::ModAssn; }
    54555469    break;
     
    54585472
    54595473/* Line 1806 of yacc.c  */
    5460 #line 638 "parser.yy"
     5474#line 639 "parser.yy"
    54615475    { (yyval.op) = OperKinds::PlusAssn; }
    54625476    break;
     
    54655479
    54665480/* Line 1806 of yacc.c  */
    5467 #line 639 "parser.yy"
     5481#line 640 "parser.yy"
    54685482    { (yyval.op) = OperKinds::MinusAssn; }
    54695483    break;
     
    54725486
    54735487/* Line 1806 of yacc.c  */
    5474 #line 640 "parser.yy"
     5488#line 641 "parser.yy"
    54755489    { (yyval.op) = OperKinds::LSAssn; }
    54765490    break;
     
    54795493
    54805494/* Line 1806 of yacc.c  */
    5481 #line 641 "parser.yy"
     5495#line 642 "parser.yy"
    54825496    { (yyval.op) = OperKinds::RSAssn; }
    54835497    break;
     
    54865500
    54875501/* Line 1806 of yacc.c  */
    5488 #line 642 "parser.yy"
     5502#line 643 "parser.yy"
    54895503    { (yyval.op) = OperKinds::AndAssn; }
    54905504    break;
     
    54935507
    54945508/* Line 1806 of yacc.c  */
    5495 #line 643 "parser.yy"
     5509#line 644 "parser.yy"
    54965510    { (yyval.op) = OperKinds::ERAssn; }
    54975511    break;
     
    55005514
    55015515/* Line 1806 of yacc.c  */
    5502 #line 644 "parser.yy"
     5516#line 645 "parser.yy"
    55035517    { (yyval.op) = OperKinds::OrAssn; }
    55045518    break;
     
    55075521
    55085522/* Line 1806 of yacc.c  */
    5509 #line 655 "parser.yy"
     5523#line 656 "parser.yy"
    55105524    { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(new ExpressionNode( nullptr ) )->set_last( (yyvsp[(4) - (6)].en) ) ) ); }
    55115525    break;
     
    55145528
    55155529/* Line 1806 of yacc.c  */
    5516 #line 657 "parser.yy"
     5530#line 658 "parser.yy"
    55175531    { (yyval.en) = new ExpressionNode( build_tuple( (ExpressionNode *)(yyvsp[(3) - (7)].en)->set_last( (yyvsp[(5) - (7)].en) ) ) ); }
    55185532    break;
     
    55215535
    55225536/* Line 1806 of yacc.c  */
    5523 #line 663 "parser.yy"
     5537#line 664 "parser.yy"
    55245538    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
    55255539    break;
     
    55285542
    55295543/* Line 1806 of yacc.c  */
    5530 #line 669 "parser.yy"
     5544#line 670 "parser.yy"
    55315545    { (yyval.en) = new ExpressionNode( build_comma( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    55325546    break;
     
    55355549
    55365550/* Line 1806 of yacc.c  */
    5537 #line 674 "parser.yy"
     5551#line 675 "parser.yy"
    55385552    { (yyval.en) = 0; }
    55395553    break;
     
    55425556
    55435557/* Line 1806 of yacc.c  */
    5544 #line 683 "parser.yy"
     5558#line 684 "parser.yy"
    55455559    { (yyval.sn) = (yyvsp[(1) - (1)].sn); }
    55465560    break;
     
    55495563
    55505564/* Line 1806 of yacc.c  */
    5551 #line 690 "parser.yy"
     5565#line 691 "parser.yy"
    55525566    {
    55535567                        Token fn;
     
    55605574
    55615575/* Line 1806 of yacc.c  */
    5562 #line 700 "parser.yy"
     5576#line 701 "parser.yy"
    55635577    {
    55645578                        (yyval.sn) = (yyvsp[(4) - (4)].sn)->add_label( (yyvsp[(1) - (4)].tok) );
     
    55695583
    55705584/* Line 1806 of yacc.c  */
    5571 #line 707 "parser.yy"
     5585#line 708 "parser.yy"
    55725586    { (yyval.sn) = new StatementNode( build_compound( (StatementNode *)0 ) ); }
    55735587    break;
     
    55765590
    55775591/* Line 1806 of yacc.c  */
    5578 #line 714 "parser.yy"
     5592#line 715 "parser.yy"
    55795593    { (yyval.sn) = new StatementNode( build_compound( (yyvsp[(5) - (7)].sn) ) ); }
    55805594    break;
     
    55835597
    55845598/* Line 1806 of yacc.c  */
    5585 #line 720 "parser.yy"
     5599#line 721 "parser.yy"
    55865600    { if ( (yyvsp[(1) - (3)].sn) != 0 ) { (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ); (yyval.sn) = (yyvsp[(1) - (3)].sn); } }
    55875601    break;
     
    55905604
    55915605/* Line 1806 of yacc.c  */
    5592 #line 725 "parser.yy"
     5606#line 726 "parser.yy"
    55935607    { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }
    55945608    break;
     
    55975611
    55985612/* Line 1806 of yacc.c  */
    5599 #line 727 "parser.yy"
     5613#line 728 "parser.yy"
    56005614    {   // mark all fields in list
    56015615                        for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() )
     
    56085622
    56095623/* Line 1806 of yacc.c  */
    5610 #line 733 "parser.yy"
     5624#line 734 "parser.yy"
    56115625    { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); }
    56125626    break;
     
    56155629
    56165630/* Line 1806 of yacc.c  */
    5617 #line 740 "parser.yy"
     5631#line 741 "parser.yy"
    56185632    { if ( (yyvsp[(1) - (2)].sn) != 0 ) { (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) ); (yyval.sn) = (yyvsp[(1) - (2)].sn); } }
    56195633    break;
     
    56225636
    56235637/* Line 1806 of yacc.c  */
    5624 #line 745 "parser.yy"
     5638#line 746 "parser.yy"
    56255639    { (yyval.sn) = new StatementNode( build_expr( (yyvsp[(1) - (2)].en) ) ); }
    56265640    break;
     
    56295643
    56305644/* Line 1806 of yacc.c  */
    5631 #line 751 "parser.yy"
     5645#line 752 "parser.yy"
    56325646    { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn), nullptr ) ); }
    56335647    break;
     
    56365650
    56375651/* Line 1806 of yacc.c  */
    5638 #line 753 "parser.yy"
     5652#line 754 "parser.yy"
    56395653    { (yyval.sn) = new StatementNode( build_if( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].sn), (yyvsp[(7) - (7)].sn) ) ); }
    56405654    break;
     
    56435657
    56445658/* Line 1806 of yacc.c  */
    5645 #line 755 "parser.yy"
     5659#line 756 "parser.yy"
    56465660    { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
    56475661    break;
     
    56505664
    56515665/* Line 1806 of yacc.c  */
    5652 #line 757 "parser.yy"
     5666#line 758 "parser.yy"
    56535667    {
    56545668                        StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) );
     
    56655679
    56665680/* Line 1806 of yacc.c  */
    5667 #line 767 "parser.yy"
     5681#line 768 "parser.yy"
    56685682    { (yyval.sn) = new StatementNode( build_switch( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
    56695683    break;
     
    56725686
    56735687/* Line 1806 of yacc.c  */
    5674 #line 769 "parser.yy"
     5688#line 770 "parser.yy"
    56755689    {
    56765690                        StatementNode *sw = new StatementNode( build_switch( (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ) );
     
    56825696
    56835697/* Line 1806 of yacc.c  */
    5684 #line 779 "parser.yy"
     5698#line 780 "parser.yy"
    56855699    { (yyval.en) = (yyvsp[(1) - (1)].en); }
    56865700    break;
     
    56895703
    56905704/* Line 1806 of yacc.c  */
    5691 #line 781 "parser.yy"
     5705#line 782 "parser.yy"
    56925706    { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    56935707    break;
     
    56965710
    56975711/* Line 1806 of yacc.c  */
    5698 #line 786 "parser.yy"
     5712#line 787 "parser.yy"
    56995713    { (yyval.sn) = new StatementNode( build_case( (yyvsp[(1) - (1)].en) ) ); }
    57005714    break;
     
    57035717
    57045718/* Line 1806 of yacc.c  */
    5705 #line 788 "parser.yy"
     5719#line 789 "parser.yy"
    57065720    { (yyval.sn) = (StatementNode *)((yyvsp[(1) - (3)].sn)->set_last( new StatementNode( build_case( (yyvsp[(3) - (3)].en) ) ) ) ); }
    57075721    break;
     
    57105724
    57115725/* Line 1806 of yacc.c  */
    5712 #line 792 "parser.yy"
     5726#line 793 "parser.yy"
    57135727    { (yyval.sn) = (yyvsp[(2) - (3)].sn); }
    57145728    break;
     
    57175731
    57185732/* Line 1806 of yacc.c  */
    5719 #line 793 "parser.yy"
     5733#line 794 "parser.yy"
    57205734    { (yyval.sn) = new StatementNode( build_default() ); }
    57215735    break;
     
    57245738
    57255739/* Line 1806 of yacc.c  */
    5726 #line 799 "parser.yy"
     5740#line 800 "parser.yy"
    57275741    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (2)].sn)->set_last( (yyvsp[(2) - (2)].sn) )); }
    57285742    break;
     
    57315745
    57325746/* Line 1806 of yacc.c  */
    5733 #line 803 "parser.yy"
     5747#line 804 "parser.yy"
    57345748    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); }
    57355749    break;
     
    57385752
    57395753/* Line 1806 of yacc.c  */
    5740 #line 808 "parser.yy"
     5754#line 809 "parser.yy"
    57415755    { (yyval.sn) = 0; }
    57425756    break;
     
    57455759
    57465760/* Line 1806 of yacc.c  */
    5747 #line 814 "parser.yy"
     5761#line 815 "parser.yy"
    57485762    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(2) - (2)].sn) ) ) ); }
    57495763    break;
     
    57525766
    57535767/* Line 1806 of yacc.c  */
    5754 #line 816 "parser.yy"
     5768#line 817 "parser.yy"
    57555769    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( new StatementNode( build_compound( (yyvsp[(3) - (3)].sn) ) ) ) ) ); }
    57565770    break;
     
    57595773
    57605774/* Line 1806 of yacc.c  */
    5761 #line 821 "parser.yy"
     5775#line 822 "parser.yy"
    57625776    { (yyval.sn) = 0; }
    57635777    break;
     
    57665780
    57675781/* Line 1806 of yacc.c  */
    5768 #line 827 "parser.yy"
     5782#line 828 "parser.yy"
    57695783    { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); }
    57705784    break;
     
    57735787
    57745788/* Line 1806 of yacc.c  */
    5775 #line 829 "parser.yy"
     5789#line 830 "parser.yy"
    57765790    { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(2) - (3)].sn)->set_last( (yyvsp[(3) - (3)].sn) ) ) ) ); }
    57775791    break;
     
    57805794
    57815795/* Line 1806 of yacc.c  */
    5782 #line 831 "parser.yy"
     5796#line 832 "parser.yy"
    57835797    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_last( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); }
    57845798    break;
     
    57875801
    57885802/* Line 1806 of yacc.c  */
    5789 #line 833 "parser.yy"
     5803#line 834 "parser.yy"
    57905804    { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (4)].sn)->set_last( (yyvsp[(2) - (4)].sn)->append_last_case( new StatementNode( build_compound( (StatementNode *)(yyvsp[(3) - (4)].sn)->set_last( (yyvsp[(4) - (4)].sn) ) ) ) ) ) ); }
    57915805    break;
     
    57945808
    57955809/* Line 1806 of yacc.c  */
    5796 #line 838 "parser.yy"
     5810#line 839 "parser.yy"
    57975811    { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); }
    57985812    break;
     
    58015815
    58025816/* Line 1806 of yacc.c  */
    5803 #line 844 "parser.yy"
     5817#line 845 "parser.yy"
    58045818    { (yyval.sn) = 0; }
    58055819    break;
     
    58085822
    58095823/* Line 1806 of yacc.c  */
    5810 #line 846 "parser.yy"
     5824#line 847 "parser.yy"
    58115825    { (yyval.sn) = 0; }
    58125826    break;
     
    58155829
    58165830/* Line 1806 of yacc.c  */
    5817 #line 851 "parser.yy"
     5831#line 852 "parser.yy"
    58185832    { (yyval.sn) = new StatementNode( build_while( (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ) ); }
    58195833    break;
     
    58225836
    58235837/* Line 1806 of yacc.c  */
    5824 #line 853 "parser.yy"
     5838#line 854 "parser.yy"
    58255839    { (yyval.sn) = new StatementNode( build_while( (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn), true ) ); }
    58265840    break;
     
    58295843
    58305844/* Line 1806 of yacc.c  */
    5831 #line 855 "parser.yy"
     5845#line 856 "parser.yy"
    58325846    { (yyval.sn) = new StatementNode( build_for( (yyvsp[(4) - (6)].fctl), (yyvsp[(6) - (6)].sn) ) ); }
    58335847    break;
     
    58365850
    58375851/* Line 1806 of yacc.c  */
    5838 #line 860 "parser.yy"
     5852#line 861 "parser.yy"
    58395853    { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); }
    58405854    break;
     
    58435857
    58445858/* Line 1806 of yacc.c  */
    5845 #line 862 "parser.yy"
     5859#line 863 "parser.yy"
    58465860    { (yyval.fctl) = new ForCtl( (yyvsp[(1) - (4)].decl), (yyvsp[(2) - (4)].en), (yyvsp[(4) - (4)].en) ); }
    58475861    break;
     
    58505864
    58515865/* Line 1806 of yacc.c  */
    5852 #line 867 "parser.yy"
     5866#line 868 "parser.yy"
    58535867    { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Goto ) ); }
    58545868    break;
     
    58575871
    58585872/* Line 1806 of yacc.c  */
    5859 #line 871 "parser.yy"
     5873#line 872 "parser.yy"
    58605874    { (yyval.sn) = new StatementNode( build_computedgoto( (yyvsp[(3) - (4)].en) ) ); }
    58615875    break;
     
    58645878
    58655879/* Line 1806 of yacc.c  */
    5866 #line 874 "parser.yy"
     5880#line 875 "parser.yy"
    58675881    { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Continue ) ); }
    58685882    break;
     
    58715885
    58725886/* Line 1806 of yacc.c  */
    5873 #line 878 "parser.yy"
     5887#line 879 "parser.yy"
    58745888    { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Continue ) ); }
    58755889    break;
     
    58785892
    58795893/* Line 1806 of yacc.c  */
    5880 #line 881 "parser.yy"
     5894#line 882 "parser.yy"
    58815895    { (yyval.sn) = new StatementNode( build_branch( BranchStmt::Break ) ); }
    58825896    break;
     
    58855899
    58865900/* Line 1806 of yacc.c  */
    5887 #line 885 "parser.yy"
     5901#line 886 "parser.yy"
    58885902    { (yyval.sn) = new StatementNode( build_branch( (yyvsp[(2) - (3)].tok), BranchStmt::Break ) ); }
    58895903    break;
     
    58925906
    58935907/* Line 1806 of yacc.c  */
    5894 #line 887 "parser.yy"
     5908#line 888 "parser.yy"
    58955909    { (yyval.sn) = new StatementNode( build_return( (yyvsp[(2) - (3)].en) ) ); }
    58965910    break;
     
    58995913
    59005914/* Line 1806 of yacc.c  */
    5901 #line 889 "parser.yy"
     5915#line 890 "parser.yy"
    59025916    { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); }
    59035917    break;
     
    59065920
    59075921/* Line 1806 of yacc.c  */
    5908 #line 891 "parser.yy"
     5922#line 892 "parser.yy"
    59095923    { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (3)].en) ) ); }
    59105924    break;
     
    59135927
    59145928/* Line 1806 of yacc.c  */
    5915 #line 893 "parser.yy"
     5929#line 894 "parser.yy"
    59165930    { (yyval.sn) = new StatementNode( build_throw( (yyvsp[(2) - (5)].en) ) ); }
    59175931    break;
     
    59205934
    59215935/* Line 1806 of yacc.c  */
    5922 #line 898 "parser.yy"
     5936#line 899 "parser.yy"
    59235937    { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), (yyvsp[(3) - (3)].sn), 0 ) ); }
    59245938    break;
     
    59275941
    59285942/* Line 1806 of yacc.c  */
    5929 #line 900 "parser.yy"
     5943#line 901 "parser.yy"
    59305944    { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (3)].sn), 0, (yyvsp[(3) - (3)].sn) ) ); }
    59315945    break;
     
    59345948
    59355949/* Line 1806 of yacc.c  */
    5936 #line 902 "parser.yy"
     5950#line 903 "parser.yy"
    59375951    { (yyval.sn) = new StatementNode( build_try( (yyvsp[(2) - (4)].sn), (yyvsp[(3) - (4)].sn), (yyvsp[(4) - (4)].sn) ) ); }
    59385952    break;
     
    59415955
    59425956/* Line 1806 of yacc.c  */
    5943 #line 909 "parser.yy"
     5957#line 910 "parser.yy"
    59445958    { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }
    59455959    break;
     
    59485962
    59495963/* Line 1806 of yacc.c  */
    5950 #line 911 "parser.yy"
     5964#line 912 "parser.yy"
    59515965    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); }
    59525966    break;
     
    59555969
    59565970/* Line 1806 of yacc.c  */
    5957 #line 913 "parser.yy"
     5971#line 914 "parser.yy"
    59585972    { (yyval.sn) = new StatementNode( build_catch( 0, (yyvsp[(5) - (5)].sn), true ) ); }
    59595973    break;
     
    59625976
    59635977/* Line 1806 of yacc.c  */
    5964 #line 915 "parser.yy"
     5978#line 916 "parser.yy"
    59655979    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (6)].sn)->set_last( new StatementNode( build_catch( 0, (yyvsp[(6) - (6)].sn), true ) ) ); }
    59665980    break;
     
    59695983
    59705984/* Line 1806 of yacc.c  */
    5971 #line 920 "parser.yy"
     5985#line 921 "parser.yy"
    59725986    { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }
    59735987    break;
     
    59765990
    59775991/* Line 1806 of yacc.c  */
    5978 #line 922 "parser.yy"
     5992#line 923 "parser.yy"
    59795993    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); }
    59805994    break;
     
    59835997
    59845998/* Line 1806 of yacc.c  */
    5985 #line 924 "parser.yy"
     5999#line 925 "parser.yy"
    59866000    { (yyval.sn) = new StatementNode( build_catch( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ) ); }
    59876001    break;
     
    59906004
    59916005/* Line 1806 of yacc.c  */
    5992 #line 926 "parser.yy"
     6006#line 927 "parser.yy"
    59936007    { (yyval.sn) = (StatementNode *)(yyvsp[(1) - (10)].sn)->set_last( new StatementNode( build_catch( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ) ); }
    59946008    break;
     
    59976011
    59986012/* Line 1806 of yacc.c  */
    5999 #line 931 "parser.yy"
     6013#line 932 "parser.yy"
    60006014    {
    60016015                        (yyval.sn) = new StatementNode( build_finally( (yyvsp[(2) - (2)].sn) ) );
     
    60066020
    60076021/* Line 1806 of yacc.c  */
    6008 #line 944 "parser.yy"
     6022#line 945 "parser.yy"
    60096023    {
    60106024                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    60166030
    60176031/* Line 1806 of yacc.c  */
    6018 #line 949 "parser.yy"
     6032#line 950 "parser.yy"
    60196033    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    60206034    break;
     
    60236037
    60246038/* Line 1806 of yacc.c  */
    6025 #line 951 "parser.yy"
     6039#line 952 "parser.yy"
    60266040    {
    60276041                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    60336047
    60346048/* Line 1806 of yacc.c  */
    6035 #line 960 "parser.yy"
     6049#line 961 "parser.yy"
    60366050    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (6)].flag), (yyvsp[(4) - (6)].constant), 0 ) ); }
    60376051    break;
     
    60406054
    60416055/* Line 1806 of yacc.c  */
    6042 #line 962 "parser.yy"
     6056#line 963 "parser.yy"
    60436057    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ) ); }
    60446058    break;
     
    60476061
    60486062/* Line 1806 of yacc.c  */
    6049 #line 964 "parser.yy"
     6063#line 965 "parser.yy"
    60506064    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ) ); }
    60516065    break;
     
    60546068
    60556069/* Line 1806 of yacc.c  */
    6056 #line 966 "parser.yy"
     6070#line 967 "parser.yy"
    60576071    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].en) ) ); }
    60586072    break;
     
    60616075
    60626076/* Line 1806 of yacc.c  */
    6063 #line 968 "parser.yy"
     6077#line 969 "parser.yy"
    60646078    { (yyval.sn) = new StatementNode( build_asmstmt( (yyvsp[(2) - (14)].flag), (yyvsp[(5) - (14)].constant), 0, (yyvsp[(8) - (14)].en), (yyvsp[(10) - (14)].en), (yyvsp[(12) - (14)].label) ) ); }
    60656079    break;
     
    60686082
    60696083/* Line 1806 of yacc.c  */
    6070 #line 973 "parser.yy"
     6084#line 974 "parser.yy"
    60716085    { (yyval.flag) = false; }
    60726086    break;
     
    60756089
    60766090/* Line 1806 of yacc.c  */
    6077 #line 975 "parser.yy"
     6091#line 976 "parser.yy"
    60786092    { (yyval.flag) = true; }
    60796093    break;
     
    60826096
    60836097/* Line 1806 of yacc.c  */
    6084 #line 980 "parser.yy"
     6098#line 981 "parser.yy"
    60856099    { (yyval.en) = 0; }
    60866100    break;
     
    60896103
    60906104/* Line 1806 of yacc.c  */
    6091 #line 987 "parser.yy"
     6105#line 988 "parser.yy"
    60926106    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) ); }
    60936107    break;
     
    60966110
    60976111/* Line 1806 of yacc.c  */
    6098 #line 992 "parser.yy"
     6112#line 993 "parser.yy"
    60996113    { (yyval.en) = new ExpressionNode( build_asmexpr( 0, (yyvsp[(1) - (4)].constant), (yyvsp[(3) - (4)].en) ) ); }
    61006114    break;
     
    61036117
    61046118/* Line 1806 of yacc.c  */
    6105 #line 994 "parser.yy"
     6119#line 995 "parser.yy"
    61066120    { (yyval.en) = new ExpressionNode( build_asmexpr( (yyvsp[(2) - (7)].en), (yyvsp[(4) - (7)].constant), (yyvsp[(6) - (7)].en) ) ); }
    61076121    break;
     
    61106124
    61116125/* Line 1806 of yacc.c  */
    6112 #line 999 "parser.yy"
     6126#line 1000 "parser.yy"
    61136127    { (yyval.en) = 0; }
    61146128    break;
     
    61176131
    61186132/* Line 1806 of yacc.c  */
    6119 #line 1001 "parser.yy"
     6133#line 1002 "parser.yy"
    61206134    { (yyval.en) = new ExpressionNode( (yyvsp[(1) - (1)].constant) ); }
    61216135    break;
     
    61246138
    61256139/* Line 1806 of yacc.c  */
    6126 #line 1003 "parser.yy"
     6140#line 1004 "parser.yy"
    61276141    { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( (yyvsp[(3) - (3)].constant) ) ); }
    61286142    break;
     
    61316145
    61326146/* Line 1806 of yacc.c  */
    6133 #line 1008 "parser.yy"
     6147#line 1009 "parser.yy"
    61346148    {
    61356149                        (yyval.label) = new LabelNode(); (yyval.label)->labels.push_back( *(yyvsp[(1) - (1)].tok) );
     
    61416155
    61426156/* Line 1806 of yacc.c  */
    6143 #line 1013 "parser.yy"
     6157#line 1014 "parser.yy"
    61446158    {
    61456159                        (yyval.label) = (yyvsp[(1) - (3)].label); (yyvsp[(1) - (3)].label)->labels.push_back( *(yyvsp[(3) - (3)].tok) );
     
    61516165
    61526166/* Line 1806 of yacc.c  */
    6153 #line 1023 "parser.yy"
     6167#line 1024 "parser.yy"
    61546168    { (yyval.decl) = 0; }
    61556169    break;
     
    61586172
    61596173/* Line 1806 of yacc.c  */
    6160 #line 1030 "parser.yy"
     6174#line 1031 "parser.yy"
    61616175    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    61626176    break;
     
    61656179
    61666180/* Line 1806 of yacc.c  */
    6167 #line 1035 "parser.yy"
     6181#line 1036 "parser.yy"
    61686182    { (yyval.decl) = 0; }
    61696183    break;
     
    61726186
    61736187/* Line 1806 of yacc.c  */
    6174 #line 1042 "parser.yy"
     6188#line 1043 "parser.yy"
    61756189    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    61766190    break;
    61776191
    61786192  case 250:
    6179 
    6180 /* Line 1806 of yacc.c  */
    6181 #line 1056 "parser.yy"
    6182     {}
    6183     break;
    6184 
    6185   case 251:
    61866193
    61876194/* Line 1806 of yacc.c  */
     
    61906197    break;
    61916198
     6199  case 251:
     6200
     6201/* Line 1806 of yacc.c  */
     6202#line 1058 "parser.yy"
     6203    {}
     6204    break;
     6205
    61926206  case 259:
    61936207
    61946208/* Line 1806 of yacc.c  */
    6195 #line 1086 "parser.yy"
     6209#line 1087 "parser.yy"
    61966210    {
    61976211                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    62036217
    62046218/* Line 1806 of yacc.c  */
    6205 #line 1093 "parser.yy"
     6219#line 1094 "parser.yy"
    62066220    {
    62076221                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    62136227
    62146228/* Line 1806 of yacc.c  */
    6215 #line 1098 "parser.yy"
     6229#line 1099 "parser.yy"
    62166230    {
    62176231                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (6)].tok), TypedefTable::ID );
     
    62236237
    62246238/* Line 1806 of yacc.c  */
    6225 #line 1108 "parser.yy"
     6239#line 1109 "parser.yy"
    62266240    {
    62276241                        typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) );
     
    62336247
    62346248/* Line 1806 of yacc.c  */
    6235 #line 1113 "parser.yy"
     6249#line 1114 "parser.yy"
    62366250    {
    62376251                        typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) );
     
    62436257
    62446258/* Line 1806 of yacc.c  */
    6245 #line 1118 "parser.yy"
     6259#line 1119 "parser.yy"
    62466260    {
    62476261                        typedefTable.setNextIdentifier( *(yyvsp[(3) - (4)].tok) );
     
    62536267
    62546268/* Line 1806 of yacc.c  */
    6255 #line 1126 "parser.yy"
     6269#line 1127 "parser.yy"
    62566270    {
    62576271                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    62636277
    62646278/* Line 1806 of yacc.c  */
    6265 #line 1131 "parser.yy"
     6279#line 1132 "parser.yy"
    62666280    {
    62676281                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    62736287
    62746288/* Line 1806 of yacc.c  */
    6275 #line 1136 "parser.yy"
     6289#line 1137 "parser.yy"
    62766290    {
    62776291                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    62836297
    62846298/* Line 1806 of yacc.c  */
    6285 #line 1141 "parser.yy"
     6299#line 1142 "parser.yy"
    62866300    {
    62876301                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    62936307
    62946308/* Line 1806 of yacc.c  */
    6295 #line 1146 "parser.yy"
     6309#line 1147 "parser.yy"
    62966310    {
    62976311                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::ID );
     
    63036317
    63046318/* Line 1806 of yacc.c  */
    6305 #line 1177 "parser.yy"
     6319#line 1178 "parser.yy"
    63066320    {
    63076321                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true );
     
    63126326
    63136327/* Line 1806 of yacc.c  */
    6314 #line 1181 "parser.yy"
     6328#line 1182 "parser.yy"
    63156329    {
    63166330                        (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true );
     
    63216335
    63226336/* Line 1806 of yacc.c  */
    6323 #line 1188 "parser.yy"
     6337#line 1189 "parser.yy"
    63246338    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); }
    63256339    break;
     
    63286342
    63296343/* Line 1806 of yacc.c  */
    6330 #line 1192 "parser.yy"
     6344#line 1193 "parser.yy"
    63316345    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (9)].decl)->appendList( (yyvsp[(7) - (9)].decl) ) ); }
    63326346    break;
     
    63356349
    63366350/* Line 1806 of yacc.c  */
    6337 #line 1197 "parser.yy"
     6351#line 1198 "parser.yy"
    63386352    {
    63396353                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    63456359
    63466360/* Line 1806 of yacc.c  */
    6347 #line 1202 "parser.yy"
     6361#line 1203 "parser.yy"
    63486362    {
    63496363                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    63556369
    63566370/* Line 1806 of yacc.c  */
    6357 #line 1207 "parser.yy"
     6371#line 1208 "parser.yy"
    63586372    {
    63596373                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::TD );
     
    63656379
    63666380/* Line 1806 of yacc.c  */
    6367 #line 1218 "parser.yy"
     6381#line 1219 "parser.yy"
    63686382    {
    63696383                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    63756389
    63766390/* Line 1806 of yacc.c  */
    6377 #line 1223 "parser.yy"
     6391#line 1224 "parser.yy"
    63786392    {
    63796393                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    63856399
    63866400/* Line 1806 of yacc.c  */
    6387 #line 1228 "parser.yy"
     6401#line 1229 "parser.yy"
    63886402    {
    63896403                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    63956409
    63966410/* Line 1806 of yacc.c  */
    6397 #line 1233 "parser.yy"
     6411#line 1234 "parser.yy"
    63986412    {
    63996413                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    64056419
    64066420/* Line 1806 of yacc.c  */
    6407 #line 1238 "parser.yy"
     6421#line 1239 "parser.yy"
    64086422    {
    64096423                        typedefTable.addToEnclosingScope( TypedefTable::TD );
     
    64156429
    64166430/* Line 1806 of yacc.c  */
    6417 #line 1247 "parser.yy"
     6431#line 1248 "parser.yy"
    64186432    {
    64196433                        typedefTable.addToEnclosingScope( *(yyvsp[(2) - (4)].tok), TypedefTable::TD );
     
    64256439
    64266440/* Line 1806 of yacc.c  */
    6427 #line 1252 "parser.yy"
     6441#line 1253 "parser.yy"
    64286442    {
    64296443                        typedefTable.addToEnclosingScope( *(yyvsp[(5) - (7)].tok), TypedefTable::TD );
     
    64356449
    64366450/* Line 1806 of yacc.c  */
    6437 #line 1269 "parser.yy"
     6451#line 1270 "parser.yy"
    64386452    {
    64396453                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    64456459
    64466460/* Line 1806 of yacc.c  */
    6447 #line 1274 "parser.yy"
     6461#line 1275 "parser.yy"
    64486462    {
    64496463                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    64556469
    64566470/* Line 1806 of yacc.c  */
    6457 #line 1296 "parser.yy"
     6471#line 1297 "parser.yy"
    64586472    { (yyval.decl) = 0; }
    64596473    break;
     
    64626476
    64636477/* Line 1806 of yacc.c  */
    6464 #line 1308 "parser.yy"
     6478#line 1309 "parser.yy"
    64656479    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    64666480    break;
     
    64696483
    64706484/* Line 1806 of yacc.c  */
    6471 #line 1319 "parser.yy"
     6485#line 1320 "parser.yy"
    64726486    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Const ); }
    64736487    break;
     
    64766490
    64776491/* Line 1806 of yacc.c  */
    6478 #line 1321 "parser.yy"
     6492#line 1322 "parser.yy"
    64796493    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Restrict ); }
    64806494    break;
     
    64836497
    64846498/* Line 1806 of yacc.c  */
    6485 #line 1323 "parser.yy"
     6499#line 1324 "parser.yy"
    64866500    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); }
    64876501    break;
     
    64906504
    64916505/* Line 1806 of yacc.c  */
    6492 #line 1325 "parser.yy"
     6506#line 1326 "parser.yy"
    64936507    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); }
    64946508    break;
     
    64976511
    64986512/* Line 1806 of yacc.c  */
    6499 #line 1327 "parser.yy"
     6513#line 1328 "parser.yy"
    65006514    { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); }
    65016515    break;
     
    65046518
    65056519/* Line 1806 of yacc.c  */
    6506 #line 1329 "parser.yy"
     6520#line 1330 "parser.yy"
    65076521    {
    65086522                        typedefTable.enterScope();
     
    65136527
    65146528/* Line 1806 of yacc.c  */
    6515 #line 1333 "parser.yy"
     6529#line 1334 "parser.yy"
    65166530    {
    65176531                        typedefTable.leaveScope();
     
    65236537
    65246538/* Line 1806 of yacc.c  */
    6525 #line 1342 "parser.yy"
     6539#line 1343 "parser.yy"
    65266540    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    65276541    break;
     
    65306544
    65316545/* Line 1806 of yacc.c  */
    6532 #line 1344 "parser.yy"
     6546#line 1345 "parser.yy"
    65336547    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    65346548    break;
     
    65376551
    65386552/* Line 1806 of yacc.c  */
    6539 #line 1355 "parser.yy"
     6553#line 1356 "parser.yy"
    65406554    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    65416555    break;
     
    65446558
    65456559/* Line 1806 of yacc.c  */
    6546 #line 1360 "parser.yy"
     6560#line 1361 "parser.yy"
    65476561    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); }
    65486562    break;
     
    65516565
    65526566/* Line 1806 of yacc.c  */
    6553 #line 1362 "parser.yy"
     6567#line 1363 "parser.yy"
    65546568    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); }
    65556569    break;
     
    65586572
    65596573/* Line 1806 of yacc.c  */
    6560 #line 1364 "parser.yy"
     6574#line 1365 "parser.yy"
    65616575    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); }
    65626576    break;
     
    65656579
    65666580/* Line 1806 of yacc.c  */
    6567 #line 1366 "parser.yy"
     6581#line 1367 "parser.yy"
    65686582    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Register ); }
    65696583    break;
     
    65726586
    65736587/* Line 1806 of yacc.c  */
    6574 #line 1369 "parser.yy"
     6588#line 1370 "parser.yy"
    65756589    { (yyval.decl) = new DeclarationNode; (yyval.decl)->isInline = true; }
    65766590    break;
     
    65796593
    65806594/* Line 1806 of yacc.c  */
    6581 #line 1371 "parser.yy"
     6595#line 1372 "parser.yy"
    65826596    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); }
    65836597    break;
     
    65866600
    65876601/* Line 1806 of yacc.c  */
    6588 #line 1374 "parser.yy"
     6602#line 1375 "parser.yy"
    65896603    { (yyval.decl) = new DeclarationNode; (yyval.decl)->isNoreturn = true; }
    65906604    break;
     
    65936607
    65946608/* Line 1806 of yacc.c  */
    6595 #line 1376 "parser.yy"
     6609#line 1377 "parser.yy"
    65966610    { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); }
    65976611    break;
     
    66006614
    66016615/* Line 1806 of yacc.c  */
    6602 #line 1381 "parser.yy"
     6616#line 1382 "parser.yy"
    66036617    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); }
    66046618    break;
     
    66076621
    66086622/* Line 1806 of yacc.c  */
    6609 #line 1383 "parser.yy"
     6623#line 1384 "parser.yy"
    66106624    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); }
    66116625    break;
     
    66146628
    66156629/* Line 1806 of yacc.c  */
    6616 #line 1385 "parser.yy"
     6630#line 1386 "parser.yy"
    66176631    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); }
    66186632    break;
     
    66216635
    66226636/* Line 1806 of yacc.c  */
    6623 #line 1387 "parser.yy"
     6637#line 1388 "parser.yy"
    66246638    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); }
    66256639    break;
     
    66286642
    66296643/* Line 1806 of yacc.c  */
    6630 #line 1389 "parser.yy"
     6644#line 1390 "parser.yy"
    66316645    { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Long ); }
    66326646    break;
     
    66356649
    66366650/* Line 1806 of yacc.c  */
    6637 #line 1391 "parser.yy"
     6651#line 1392 "parser.yy"
    66386652    { (yyval.decl) = DeclarationNode::newLength( DeclarationNode::Short ); }
    66396653    break;
     
    66426656
    66436657/* Line 1806 of yacc.c  */
    6644 #line 1393 "parser.yy"
     6658#line 1394 "parser.yy"
    66456659    { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
    66466660    break;
     
    66496663
    66506664/* Line 1806 of yacc.c  */
    6651 #line 1395 "parser.yy"
     6665#line 1396 "parser.yy"
    66526666    { (yyval.decl) = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
    66536667    break;
     
    66566670
    66576671/* Line 1806 of yacc.c  */
    6658 #line 1397 "parser.yy"
     6672#line 1398 "parser.yy"
    66596673    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); }
    66606674    break;
     
    66636677
    66646678/* Line 1806 of yacc.c  */
    6665 #line 1399 "parser.yy"
     6679#line 1400 "parser.yy"
    66666680    { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
    66676681    break;
     
    66706684
    66716685/* Line 1806 of yacc.c  */
    6672 #line 1401 "parser.yy"
     6686#line 1402 "parser.yy"
    66736687    { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
    66746688    break;
     
    66776691
    66786692/* Line 1806 of yacc.c  */
    6679 #line 1403 "parser.yy"
     6693#line 1404 "parser.yy"
    66806694    { (yyval.decl) = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
    66816695    break;
     
    66846698
    66856699/* Line 1806 of yacc.c  */
    6686 #line 1405 "parser.yy"
     6700#line 1406 "parser.yy"
    66876701    { (yyval.decl) = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); }
    66886702    break;
     
    66916705
    66926706/* Line 1806 of yacc.c  */
    6693 #line 1412 "parser.yy"
     6707#line 1413 "parser.yy"
    66946708    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    66956709    break;
     
    66986712
    66996713/* Line 1806 of yacc.c  */
    6700 #line 1414 "parser.yy"
     6714#line 1415 "parser.yy"
    67016715    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    67026716    break;
     
    67056719
    67066720/* Line 1806 of yacc.c  */
    6707 #line 1416 "parser.yy"
     6721#line 1417 "parser.yy"
    67086722    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    67096723    break;
     
    67126726
    67136727/* Line 1806 of yacc.c  */
    6714 #line 1418 "parser.yy"
     6728#line 1419 "parser.yy"
    67156729    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); }
    67166730    break;
     
    67196733
    67206734/* Line 1806 of yacc.c  */
    6721 #line 1424 "parser.yy"
     6735#line 1425 "parser.yy"
    67226736    { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    67236737    break;
     
    67266740
    67276741/* Line 1806 of yacc.c  */
    6728 #line 1431 "parser.yy"
     6742#line 1432 "parser.yy"
    67296743    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    67306744    break;
     
    67336747
    67346748/* Line 1806 of yacc.c  */
    6735 #line 1433 "parser.yy"
     6749#line 1434 "parser.yy"
    67366750    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    67376751    break;
     
    67406754
    67416755/* Line 1806 of yacc.c  */
    6742 #line 1435 "parser.yy"
     6756#line 1436 "parser.yy"
    67436757    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); }
    67446758    break;
     
    67476761
    67486762/* Line 1806 of yacc.c  */
    6749 #line 1440 "parser.yy"
     6763#line 1441 "parser.yy"
    67506764    { (yyval.decl) = (yyvsp[(3) - (4)].decl); }
    67516765    break;
     
    67546768
    67556769/* Line 1806 of yacc.c  */
    6756 #line 1442 "parser.yy"
     6770#line 1443 "parser.yy"
    67576771    { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); }
    67586772    break;
     
    67616775
    67626776/* Line 1806 of yacc.c  */
    6763 #line 1444 "parser.yy"
     6777#line 1445 "parser.yy"
    67646778    { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); }
    67656779    break;
     
    67686782
    67696783/* Line 1806 of yacc.c  */
    6770 #line 1446 "parser.yy"
     6784#line 1447 "parser.yy"
    67716785    { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
    67726786    break;
     
    67756789
    67766790/* Line 1806 of yacc.c  */
    6777 #line 1452 "parser.yy"
     6791#line 1453 "parser.yy"
    67786792    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    67796793    break;
     
    67826796
    67836797/* Line 1806 of yacc.c  */
    6784 #line 1454 "parser.yy"
     6798#line 1455 "parser.yy"
    67856799    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    67866800    break;
     
    67896803
    67906804/* Line 1806 of yacc.c  */
    6791 #line 1456 "parser.yy"
     6805#line 1457 "parser.yy"
    67926806    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    67936807    break;
     
    67966810
    67976811/* Line 1806 of yacc.c  */
    6798 #line 1462 "parser.yy"
     6812#line 1463 "parser.yy"
    67996813    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    68006814    break;
     
    68036817
    68046818/* Line 1806 of yacc.c  */
    6805 #line 1464 "parser.yy"
     6819#line 1465 "parser.yy"
    68066820    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68076821    break;
     
    68106824
    68116825/* Line 1806 of yacc.c  */
    6812 #line 1470 "parser.yy"
     6826#line 1471 "parser.yy"
    68136827    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    68146828    break;
     
    68176831
    68186832/* Line 1806 of yacc.c  */
    6819 #line 1472 "parser.yy"
     6833#line 1473 "parser.yy"
    68206834    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68216835    break;
     
    68246838
    68256839/* Line 1806 of yacc.c  */
    6826 #line 1474 "parser.yy"
     6840#line 1475 "parser.yy"
    68276841    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    68286842    break;
     
    68316845
    68326846/* Line 1806 of yacc.c  */
    6833 #line 1479 "parser.yy"
     6847#line 1480 "parser.yy"
    68346848    { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); }
    68356849    break;
     
    68386852
    68396853/* Line 1806 of yacc.c  */
    6840 #line 1481 "parser.yy"
     6854#line 1482 "parser.yy"
    68416855    { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    68426856    break;
     
    68456859
    68466860/* Line 1806 of yacc.c  */
    6847 #line 1483 "parser.yy"
     6861#line 1484 "parser.yy"
    68486862    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    68496863    break;
     
    68526866
    68536867/* Line 1806 of yacc.c  */
    6854 #line 1493 "parser.yy"
     6868#line 1494 "parser.yy"
    68556869    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), nullptr, nullptr, (yyvsp[(3) - (4)].decl), true ); }
    68566870    break;
     
    68596873
    68606874/* Line 1806 of yacc.c  */
    6861 #line 1495 "parser.yy"
     6875#line 1496 "parser.yy"
    68626876    {
    68636877                        typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) );
     
    68696883
    68706884/* Line 1806 of yacc.c  */
    6871 #line 1500 "parser.yy"
     6885#line 1501 "parser.yy"
    68726886    { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
    68736887    break;
     
    68766890
    68776891/* Line 1806 of yacc.c  */
    6878 #line 1502 "parser.yy"
     6892#line 1503 "parser.yy"
    68796893    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), nullptr, (yyvsp[(5) - (6)].decl), true ); }
    68806894    break;
     
    68836897
    68846898/* Line 1806 of yacc.c  */
    6885 #line 1504 "parser.yy"
     6899#line 1505 "parser.yy"
    68866900    { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), nullptr, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); }
    68876901    break;
     
    68906904
    68916905/* Line 1806 of yacc.c  */
    6892 #line 1506 "parser.yy"
     6906#line 1507 "parser.yy"
    68936907    { (yyval.decl) = (yyvsp[(2) - (2)].decl); }
    68946908    break;
     
    68976911
    68986912/* Line 1806 of yacc.c  */
    6899 #line 1511 "parser.yy"
     6913#line 1512 "parser.yy"
    69006914    { (yyval.aggKey) = DeclarationNode::Struct; }
    69016915    break;
     
    69046918
    69056919/* Line 1806 of yacc.c  */
    6906 #line 1513 "parser.yy"
     6920#line 1514 "parser.yy"
    69076921    { (yyval.aggKey) = DeclarationNode::Union; }
    69086922    break;
     
    69116925
    69126926/* Line 1806 of yacc.c  */
    6913 #line 1518 "parser.yy"
     6927#line 1519 "parser.yy"
    69146928    { (yyval.decl) = 0; }
    69156929    break;
     
    69186932
    69196933/* Line 1806 of yacc.c  */
    6920 #line 1520 "parser.yy"
     6934#line 1521 "parser.yy"
    69216935    { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }
    69226936    break;
     
    69256939
    69266940/* Line 1806 of yacc.c  */
    6927 #line 1526 "parser.yy"
     6941#line 1527 "parser.yy"
    69286942    { (yyval.decl) = (yyvsp[(2) - (3)].decl)->set_extension( true ); }
    69296943    break;
     
    69326946
    69336947/* Line 1806 of yacc.c  */
    6934 #line 1529 "parser.yy"
     6948#line 1530 "parser.yy"
    69356949    {   // mark all fields in list
    69366950                        for ( DeclarationNode *iter = (yyvsp[(2) - (3)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() )
     
    69436957
    69446958/* Line 1806 of yacc.c  */
    6945 #line 1539 "parser.yy"
     6959#line 1540 "parser.yy"
    69466960    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addName( (yyvsp[(2) - (2)].tok) ); }
    69476961    break;
     
    69506964
    69516965/* Line 1806 of yacc.c  */
    6952 #line 1541 "parser.yy"
     6966#line 1542 "parser.yy"
    69536967    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(1) - (3)].decl)->cloneType( (yyvsp[(3) - (3)].tok) ) ); }
    69546968    break;
     
    69576971
    69586972/* Line 1806 of yacc.c  */
    6959 #line 1543 "parser.yy"
     6973#line 1544 "parser.yy"
    69606974    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(1) - (2)].decl)->cloneType( 0 ) ); }
    69616975    break;
     
    69646978
    69656979/* Line 1806 of yacc.c  */
    6966 #line 1548 "parser.yy"
     6980#line 1549 "parser.yy"
    69676981    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    69686982    break;
     
    69716985
    69726986/* Line 1806 of yacc.c  */
    6973 #line 1550 "parser.yy"
     6987#line 1551 "parser.yy"
    69746988    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(1) - (4)].decl)->cloneBaseType( (yyvsp[(4) - (4)].decl) ) ); }
    69756989    break;
     
    69786992
    69796993/* Line 1806 of yacc.c  */
    6980 #line 1555 "parser.yy"
     6994#line 1556 "parser.yy"
    69816995    { (yyval.decl) = DeclarationNode::newName( 0 ); /* XXX */ }
    69826996    break;
     
    69856999
    69867000/* Line 1806 of yacc.c  */
    6987 #line 1557 "parser.yy"
     7001#line 1558 "parser.yy"
    69887002    { (yyval.decl) = DeclarationNode::newBitfield( (yyvsp[(1) - (1)].en) ); }
    69897003    break;
     
    69927006
    69937007/* Line 1806 of yacc.c  */
    6994 #line 1560 "parser.yy"
     7008#line 1561 "parser.yy"
    69957009    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }
    69967010    break;
     
    69997013
    70007014/* Line 1806 of yacc.c  */
    7001 #line 1563 "parser.yy"
     7015#line 1564 "parser.yy"
    70027016    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }
    70037017    break;
     
    70067020
    70077021/* Line 1806 of yacc.c  */
    7008 #line 1569 "parser.yy"
     7022#line 1570 "parser.yy"
    70097023    { (yyval.en) = 0; }
    70107024    break;
     
    70137027
    70147028/* Line 1806 of yacc.c  */
    7015 #line 1571 "parser.yy"
     7029#line 1572 "parser.yy"
    70167030    { (yyval.en) = (yyvsp[(1) - (1)].en); }
    70177031    break;
     
    70207034
    70217035/* Line 1806 of yacc.c  */
    7022 #line 1576 "parser.yy"
     7036#line 1577 "parser.yy"
    70237037    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    70247038    break;
     
    70277041
    70287042/* Line 1806 of yacc.c  */
    7029 #line 1585 "parser.yy"
     7043#line 1586 "parser.yy"
    70307044    { (yyval.decl) = DeclarationNode::newEnum( nullptr, (yyvsp[(3) - (5)].decl) ); }
    70317045    break;
     
    70347048
    70357049/* Line 1806 of yacc.c  */
    7036 #line 1587 "parser.yy"
     7050#line 1588 "parser.yy"
    70377051    {
    70387052                        typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) );
     
    70447058
    70457059/* Line 1806 of yacc.c  */
    7046 #line 1592 "parser.yy"
     7060#line 1593 "parser.yy"
    70477061    { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }
    70487062    break;
     
    70517065
    70527066/* Line 1806 of yacc.c  */
    7053 #line 1594 "parser.yy"
     7067#line 1595 "parser.yy"
    70547068    { (yyval.decl) = DeclarationNode::newEnum( (yyvsp[(2) - (7)].tok), (yyvsp[(5) - (7)].decl) ); }
    70557069    break;
     
    70587072
    70597073/* Line 1806 of yacc.c  */
    7060 #line 1599 "parser.yy"
     7074#line 1600 "parser.yy"
    70617075    { (yyval.decl) = DeclarationNode::newEnumConstant( (yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].en) ); }
    70627076    break;
     
    70657079
    70667080/* Line 1806 of yacc.c  */
    7067 #line 1601 "parser.yy"
     7081#line 1602 "parser.yy"
    70687082    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( DeclarationNode::newEnumConstant( (yyvsp[(3) - (4)].tok), (yyvsp[(4) - (4)].en) ) ); }
    70697083    break;
     
    70727086
    70737087/* Line 1806 of yacc.c  */
    7074 #line 1606 "parser.yy"
     7088#line 1607 "parser.yy"
    70757089    { (yyval.en) = 0; }
    70767090    break;
     
    70797093
    70807094/* Line 1806 of yacc.c  */
    7081 #line 1608 "parser.yy"
     7095#line 1609 "parser.yy"
    70827096    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    70837097    break;
     
    70867100
    70877101/* Line 1806 of yacc.c  */
    7088 #line 1615 "parser.yy"
     7102#line 1616 "parser.yy"
    70897103    { (yyval.decl) = 0; }
    70907104    break;
     
    70937107
    70947108/* Line 1806 of yacc.c  */
    7095 #line 1623 "parser.yy"
     7109#line 1624 "parser.yy"
    70967110    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    70977111    break;
     
    71007114
    71017115/* Line 1806 of yacc.c  */
    7102 #line 1625 "parser.yy"
     7116#line 1626 "parser.yy"
    71037117    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    71047118    break;
     
    71077121
    71087122/* Line 1806 of yacc.c  */
    7109 #line 1627 "parser.yy"
     7123#line 1628 "parser.yy"
    71107124    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    71117125    break;
     
    71147128
    71157129/* Line 1806 of yacc.c  */
    7116 #line 1635 "parser.yy"
     7130#line 1636 "parser.yy"
    71177131    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71187132    break;
     
    71217135
    71227136/* Line 1806 of yacc.c  */
    7123 #line 1637 "parser.yy"
     7137#line 1638 "parser.yy"
    71247138    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71257139    break;
     
    71287142
    71297143/* Line 1806 of yacc.c  */
    7130 #line 1639 "parser.yy"
     7144#line 1640 "parser.yy"
    71317145    { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); }
    71327146    break;
     
    71357149
    71367150/* Line 1806 of yacc.c  */
    7137 #line 1645 "parser.yy"
     7151#line 1646 "parser.yy"
    71387152    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71397153    break;
     
    71427156
    71437157/* Line 1806 of yacc.c  */
    7144 #line 1650 "parser.yy"
     7158#line 1651 "parser.yy"
    71457159    { (yyval.decl) = 0; }
    71467160    break;
     
    71497163
    71507164/* Line 1806 of yacc.c  */
    7151 #line 1657 "parser.yy"
     7165#line 1658 "parser.yy"
    71527166    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); }
    71537167    break;
     
    71567170
    71577171/* Line 1806 of yacc.c  */
    7158 #line 1664 "parser.yy"
     7172#line 1665 "parser.yy"
    71597173    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71607174    break;
     
    71637177
    71647178/* Line 1806 of yacc.c  */
    7165 #line 1666 "parser.yy"
     7179#line 1667 "parser.yy"
    71667180    { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); }
    71677181    break;
     
    71707184
    71717185/* Line 1806 of yacc.c  */
    7172 #line 1675 "parser.yy"
     7186#line 1676 "parser.yy"
    71737187    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }
    71747188    break;
     
    71777191
    71787192/* Line 1806 of yacc.c  */
    7179 #line 1678 "parser.yy"
     7193#line 1679 "parser.yy"
    71807194    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); }
    71817195    break;
     
    71847198
    71857199/* Line 1806 of yacc.c  */
    7186 #line 1680 "parser.yy"
     7200#line 1681 "parser.yy"
    71877201    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addName( (yyvsp[(3) - (4)].tok) )->addQualifiers( (yyvsp[(1) - (4)].decl) ); }
    71887202    break;
     
    71917205
    71927206/* Line 1806 of yacc.c  */
    7193 #line 1690 "parser.yy"
     7207#line 1691 "parser.yy"
    71947208    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    71957209    break;
     
    71987212
    71997213/* Line 1806 of yacc.c  */
    7200 #line 1696 "parser.yy"
     7214#line 1697 "parser.yy"
    72017215    {
    72027216                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    72087222
    72097223/* Line 1806 of yacc.c  */
    7210 #line 1701 "parser.yy"
     7224#line 1702 "parser.yy"
    72117225    {
    72127226                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    72187232
    72197233/* Line 1806 of yacc.c  */
    7220 #line 1710 "parser.yy"
     7234#line 1711 "parser.yy"
    72217235    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    72227236    break;
     
    72257239
    72267240/* Line 1806 of yacc.c  */
    7227 #line 1719 "parser.yy"
     7241#line 1720 "parser.yy"
    72287242    { (yyval.decl) = DeclarationNode::newName( (yyvsp[(1) - (1)].tok) ); }
    72297243    break;
     
    72327246
    72337247/* Line 1806 of yacc.c  */
    7234 #line 1721 "parser.yy"
     7248#line 1722 "parser.yy"
    72357249    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( DeclarationNode::newName( (yyvsp[(3) - (3)].tok) ) ); }
    72367250    break;
     
    72397253
    72407254/* Line 1806 of yacc.c  */
    7241 #line 1746 "parser.yy"
     7255#line 1747 "parser.yy"
    72427256    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    72437257    break;
     
    72467260
    72477261/* Line 1806 of yacc.c  */
    7248 #line 1754 "parser.yy"
     7262#line 1755 "parser.yy"
    72497263    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); }
    72507264    break;
     
    72537267
    72547268/* Line 1806 of yacc.c  */
    7255 #line 1759 "parser.yy"
     7269#line 1760 "parser.yy"
    72567270    { (yyval.in) = 0; }
    72577271    break;
     
    72607274
    72617275/* Line 1806 of yacc.c  */
    7262 #line 1761 "parser.yy"
     7276#line 1762 "parser.yy"
    72637277    { (yyval.in) = (yyvsp[(2) - (2)].in); }
    72647278    break;
     
    72677281
    72687282/* Line 1806 of yacc.c  */
    7269 #line 1763 "parser.yy"
     7283#line 1764 "parser.yy"
    72707284    { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); }
    72717285    break;
     
    72747288
    72757289/* Line 1806 of yacc.c  */
    7276 #line 1767 "parser.yy"
     7290#line 1768 "parser.yy"
    72777291    { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); }
    72787292    break;
     
    72817295
    72827296/* Line 1806 of yacc.c  */
    7283 #line 1768 "parser.yy"
     7297#line 1769 "parser.yy"
    72847298    { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); }
    72857299    break;
     
    72887302
    72897303/* Line 1806 of yacc.c  */
    7290 #line 1773 "parser.yy"
     7304#line 1774 "parser.yy"
    72917305    { (yyval.in) = 0; }
    72927306    break;
     
    72957309
    72967310/* Line 1806 of yacc.c  */
    7297 #line 1775 "parser.yy"
     7311#line 1776 "parser.yy"
    72987312    { (yyval.in) = (yyvsp[(2) - (2)].in)->set_designators( (yyvsp[(1) - (2)].en) ); }
    72997313    break;
     
    73027316
    73037317/* Line 1806 of yacc.c  */
    7304 #line 1776 "parser.yy"
     7318#line 1777 "parser.yy"
    73057319    { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (3)].in)->set_last( (yyvsp[(3) - (3)].in) ) ); }
    73067320    break;
     
    73097323
    73107324/* Line 1806 of yacc.c  */
    7311 #line 1778 "parser.yy"
     7325#line 1779 "parser.yy"
    73127326    { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (4)].in)->set_last( (yyvsp[(4) - (4)].in)->set_designators( (yyvsp[(3) - (4)].en) ) ) ); }
    73137327    break;
     
    73167330
    73177331/* Line 1806 of yacc.c  */
    7318 #line 1794 "parser.yy"
     7332#line 1795 "parser.yy"
    73197333    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(1) - (2)].tok) ) ); }
    73207334    break;
     
    73237337
    73247338/* Line 1806 of yacc.c  */
    7325 #line 1800 "parser.yy"
     7339#line 1801 "parser.yy"
    73267340    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (2)].en)->set_last( (yyvsp[(2) - (2)].en) ) ); }
    73277341    break;
     
    73307344
    73317345/* Line 1806 of yacc.c  */
    7332 #line 1806 "parser.yy"
     7346#line 1807 "parser.yy"
    73337347    { (yyval.en) = new ExpressionNode( build_varref( (yyvsp[(2) - (2)].tok) ) ); }
    73347348    break;
     
    73377351
    73387352/* Line 1806 of yacc.c  */
    7339 #line 1809 "parser.yy"
     7353#line 1810 "parser.yy"
    73407354    { (yyval.en) = (yyvsp[(3) - (5)].en); }
    73417355    break;
     
    73447358
    73457359/* Line 1806 of yacc.c  */
    7346 #line 1811 "parser.yy"
     7360#line 1812 "parser.yy"
    73477361    { (yyval.en) = (yyvsp[(3) - (5)].en); }
    73487362    break;
     
    73517365
    73527366/* Line 1806 of yacc.c  */
    7353 #line 1813 "parser.yy"
     7367#line 1814 "parser.yy"
    73547368    { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ); }
    73557369    break;
     
    73587372
    73597373/* Line 1806 of yacc.c  */
    7360 #line 1815 "parser.yy"
     7374#line 1816 "parser.yy"
    73617375    { (yyval.en) = (yyvsp[(4) - (6)].en); }
    73627376    break;
     
    73657379
    73667380/* Line 1806 of yacc.c  */
    7367 #line 1839 "parser.yy"
     7381#line 1840 "parser.yy"
    73687382    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    73697383    break;
     
    73727386
    73737387/* Line 1806 of yacc.c  */
    7374 #line 1841 "parser.yy"
     7388#line 1842 "parser.yy"
    73757389    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    73767390    break;
     
    73797393
    73807394/* Line 1806 of yacc.c  */
    7381 #line 1843 "parser.yy"
     7395#line 1844 "parser.yy"
    73827396    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }
    73837397    break;
     
    73867400
    73877401/* Line 1806 of yacc.c  */
    7388 #line 1849 "parser.yy"
     7402#line 1850 "parser.yy"
    73897403    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    73907404    break;
     
    73937407
    73947408/* Line 1806 of yacc.c  */
    7395 #line 1851 "parser.yy"
     7409#line 1852 "parser.yy"
    73967410    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    73977411    break;
     
    74007414
    74017415/* Line 1806 of yacc.c  */
    7402 #line 1856 "parser.yy"
     7416#line 1857 "parser.yy"
    74037417    { (yyval.decl) = DeclarationNode::newFromTypeGen( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }
    74047418    break;
     
    74077421
    74087422/* Line 1806 of yacc.c  */
    7409 #line 1862 "parser.yy"
     7423#line 1863 "parser.yy"
    74107424    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(3) - (4)].decl) ); }
    74117425    break;
     
    74147428
    74157429/* Line 1806 of yacc.c  */
    7416 #line 1867 "parser.yy"
     7430#line 1868 "parser.yy"
    74177431    { typedefTable.addToEnclosingScope( *(yyvsp[(2) - (2)].tok), TypedefTable::TD ); }
    74187432    break;
     
    74217435
    74227436/* Line 1806 of yacc.c  */
    7423 #line 1869 "parser.yy"
     7437#line 1870 "parser.yy"
    74247438    { (yyval.decl) = DeclarationNode::newTypeParam( (yyvsp[(1) - (4)].tclass), (yyvsp[(2) - (4)].tok) )->addAssertions( (yyvsp[(4) - (4)].decl) ); }
    74257439    break;
     
    74287442
    74297443/* Line 1806 of yacc.c  */
    7430 #line 1875 "parser.yy"
     7444#line 1876 "parser.yy"
    74317445    { (yyval.tclass) = DeclarationNode::Otype; }
    74327446    break;
     
    74357449
    74367450/* Line 1806 of yacc.c  */
    7437 #line 1877 "parser.yy"
     7451#line 1878 "parser.yy"
    74387452    { (yyval.tclass) = DeclarationNode::Ftype; }
    74397453    break;
     
    74427456
    74437457/* Line 1806 of yacc.c  */
    7444 #line 1879 "parser.yy"
     7458#line 1880 "parser.yy"
    74457459    { (yyval.tclass) = DeclarationNode::Dtype; }
    74467460    break;
     
    74497463
    74507464/* Line 1806 of yacc.c  */
    7451 #line 1884 "parser.yy"
     7465#line 1885 "parser.yy"
    74527466    { (yyval.decl) = 0; }
    74537467    break;
     
    74567470
    74577471/* Line 1806 of yacc.c  */
    7458 #line 1886 "parser.yy"
     7472#line 1887 "parser.yy"
    74597473    { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }
    74607474    break;
     
    74637477
    74647478/* Line 1806 of yacc.c  */
    7465 #line 1891 "parser.yy"
     7479#line 1892 "parser.yy"
    74667480    {
    74677481                        typedefTable.openTrait( *(yyvsp[(2) - (5)].tok) );
     
    74737487
    74747488/* Line 1806 of yacc.c  */
    7475 #line 1896 "parser.yy"
     7489#line 1897 "parser.yy"
    74767490    { (yyval.decl) = (yyvsp[(4) - (5)].decl); }
    74777491    break;
     
    74807494
    74817495/* Line 1806 of yacc.c  */
    7482 #line 1898 "parser.yy"
     7496#line 1899 "parser.yy"
    74837497    { (yyval.decl) = 0; }
    74847498    break;
     
    74877501
    74887502/* Line 1806 of yacc.c  */
    7489 #line 1903 "parser.yy"
     7503#line 1904 "parser.yy"
    74907504    { (yyval.en) = new ExpressionNode( build_typevalue( (yyvsp[(1) - (1)].decl) ) ); }
    74917505    break;
     
    74947508
    74957509/* Line 1806 of yacc.c  */
    7496 #line 1906 "parser.yy"
     7510#line 1907 "parser.yy"
    74977511    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( new ExpressionNode( build_typevalue( (yyvsp[(3) - (3)].decl) ) ) ) ); }
    74987512    break;
     
    75017515
    75027516/* Line 1806 of yacc.c  */
    7503 #line 1908 "parser.yy"
     7517#line 1909 "parser.yy"
    75047518    { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_last( (yyvsp[(3) - (3)].en) )); }
    75057519    break;
     
    75087522
    75097523/* Line 1806 of yacc.c  */
    7510 #line 1913 "parser.yy"
     7524#line 1914 "parser.yy"
    75117525    { (yyval.decl) = (yyvsp[(2) - (2)].decl); }
    75127526    break;
     
    75157529
    75167530/* Line 1806 of yacc.c  */
    7517 #line 1915 "parser.yy"
     7531#line 1916 "parser.yy"
    75187532    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) ); }
    75197533    break;
     
    75227536
    75237537/* Line 1806 of yacc.c  */
    7524 #line 1917 "parser.yy"
     7538#line 1918 "parser.yy"
    75257539    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl)->copyStorageClasses( (yyvsp[(1) - (3)].decl) ) ); }
    75267540    break;
     
    75297543
    75307544/* Line 1806 of yacc.c  */
    7531 #line 1922 "parser.yy"
     7545#line 1923 "parser.yy"
    75327546    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addAssertions( (yyvsp[(2) - (2)].decl) ); }
    75337547    break;
     
    75367550
    75377551/* Line 1806 of yacc.c  */
    7538 #line 1924 "parser.yy"
     7552#line 1925 "parser.yy"
    75397553    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addAssertions( (yyvsp[(2) - (4)].decl) )->addType( (yyvsp[(4) - (4)].decl) ); }
    75407554    break;
     
    75437557
    75447558/* Line 1806 of yacc.c  */
    7545 #line 1929 "parser.yy"
     7559#line 1930 "parser.yy"
    75467560    {
    75477561                        typedefTable.addToEnclosingScope( *(yyvsp[(1) - (1)].tok), TypedefTable::TD );
     
    75537567
    75547568/* Line 1806 of yacc.c  */
    7555 #line 1934 "parser.yy"
     7569#line 1935 "parser.yy"
    75567570    {
    75577571                        typedefTable.addToEnclosingScope( *(yyvsp[(1) - (6)].tok), TypedefTable::TG );
     
    75637577
    75647578/* Line 1806 of yacc.c  */
    7565 #line 1942 "parser.yy"
     7579#line 1943 "parser.yy"
    75667580    {
    75677581                        typedefTable.addToEnclosingScope( *(yyvsp[(2) - (9)].tok), TypedefTable::ID );
     
    75737587
    75747588/* Line 1806 of yacc.c  */
    7575 #line 1947 "parser.yy"
     7589#line 1948 "parser.yy"
    75767590    {
    75777591                        typedefTable.enterTrait( *(yyvsp[(2) - (8)].tok) );
     
    75837597
    75847598/* Line 1806 of yacc.c  */
    7585 #line 1952 "parser.yy"
     7599#line 1953 "parser.yy"
    75867600    {
    75877601                        typedefTable.leaveTrait();
     
    75947608
    75957609/* Line 1806 of yacc.c  */
    7596 #line 1962 "parser.yy"
     7610#line 1963 "parser.yy"
    75977611    { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); }
    75987612    break;
     
    76017615
    76027616/* Line 1806 of yacc.c  */
    7603 #line 1972 "parser.yy"
     7617#line 1973 "parser.yy"
    76047618    {
    76057619                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    76117625
    76127626/* Line 1806 of yacc.c  */
    7613 #line 1977 "parser.yy"
     7627#line 1978 "parser.yy"
    76147628    {
    76157629                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    76217635
    76227636/* Line 1806 of yacc.c  */
    7623 #line 1982 "parser.yy"
     7637#line 1983 "parser.yy"
    76247638    {
    76257639                        typedefTable.addToEnclosingScope2( *(yyvsp[(5) - (5)].tok), TypedefTable::ID );
     
    76317645
    76327646/* Line 1806 of yacc.c  */
    7633 #line 1990 "parser.yy"
     7647#line 1991 "parser.yy"
    76347648    {
    76357649                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    76417655
    76427656/* Line 1806 of yacc.c  */
    7643 #line 1995 "parser.yy"
     7657#line 1996 "parser.yy"
    76447658    {
    76457659                        typedefTable.addToEnclosingScope2( TypedefTable::ID );
     
    76517665
    76527666/* Line 1806 of yacc.c  */
    7653 #line 2005 "parser.yy"
     7667#line 2006 "parser.yy"
    76547668    {}
    76557669    break;
     
    76587672
    76597673/* Line 1806 of yacc.c  */
    7660 #line 2007 "parser.yy"
     7674#line 2008 "parser.yy"
    76617675    { parseTree = parseTree != nullptr ? parseTree->appendList( (yyvsp[(1) - (1)].decl) ) : (yyvsp[(1) - (1)].decl);    }
    76627676    break;
     
    76657679
    76667680/* Line 1806 of yacc.c  */
    7667 #line 2013 "parser.yy"
     7681#line 2014 "parser.yy"
    76687682    { (yyval.decl) = (yyvsp[(1) - (3)].decl) != nullptr ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); }
    76697683    break;
     
    76727686
    76737687/* Line 1806 of yacc.c  */
    7674 #line 2018 "parser.yy"
     7688#line 2019 "parser.yy"
    76757689    { (yyval.decl) = 0; }
    76767690    break;
     
    76797693
    76807694/* Line 1806 of yacc.c  */
    7681 #line 2026 "parser.yy"
     7695#line 2027 "parser.yy"
    76827696    {}
    76837697    break;
     
    76867700
    76877701/* Line 1806 of yacc.c  */
    7688 #line 2028 "parser.yy"
     7702#line 2029 "parser.yy"
    76897703    {
    76907704                        linkageStack.push( linkage );                           // handle nested extern "C"/"Cforall"
     
    76967710
    76977711/* Line 1806 of yacc.c  */
    7698 #line 2033 "parser.yy"
     7712#line 2034 "parser.yy"
    76997713    {
    77007714                        linkage = linkageStack.top();
     
    77077721
    77087722/* Line 1806 of yacc.c  */
    7709 #line 2039 "parser.yy"
     7723#line 2040 "parser.yy"
    77107724    {   // mark all fields in list
    77117725                        for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != nullptr; iter = (DeclarationNode *)iter->get_next() )
     
    77187732
    77197733/* Line 1806 of yacc.c  */
    7720 #line 2054 "parser.yy"
     7734#line 2055 "parser.yy"
    77217735    {
    77227736                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77297743
    77307744/* Line 1806 of yacc.c  */
    7731 #line 2060 "parser.yy"
     7745#line 2061 "parser.yy"
    77327746    {
    77337747                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77407754
    77417755/* Line 1806 of yacc.c  */
    7742 #line 2069 "parser.yy"
     7756#line 2070 "parser.yy"
    77437757    {
    77447758                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77517765
    77527766/* Line 1806 of yacc.c  */
    7753 #line 2075 "parser.yy"
     7767#line 2076 "parser.yy"
    77547768    {
    77557769                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77627776
    77637777/* Line 1806 of yacc.c  */
    7764 #line 2081 "parser.yy"
     7778#line 2082 "parser.yy"
    77657779    {
    77667780                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77737787
    77747788/* Line 1806 of yacc.c  */
    7775 #line 2087 "parser.yy"
     7789#line 2088 "parser.yy"
    77767790    {
    77777791                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77847798
    77857799/* Line 1806 of yacc.c  */
    7786 #line 2093 "parser.yy"
     7800#line 2094 "parser.yy"
    77877801    {
    77887802                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    77957809
    77967810/* Line 1806 of yacc.c  */
    7797 #line 2101 "parser.yy"
     7811#line 2102 "parser.yy"
    77987812    {
    77997813                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78067820
    78077821/* Line 1806 of yacc.c  */
    7808 #line 2107 "parser.yy"
     7822#line 2108 "parser.yy"
    78097823    {
    78107824                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78177831
    78187832/* Line 1806 of yacc.c  */
    7819 #line 2115 "parser.yy"
     7833#line 2116 "parser.yy"
    78207834    {
    78217835                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78287842
    78297843/* Line 1806 of yacc.c  */
    7830 #line 2121 "parser.yy"
     7844#line 2122 "parser.yy"
    78317845    {
    78327846                        typedefTable.addToEnclosingScope( TypedefTable::ID );
     
    78397853
    78407854/* Line 1806 of yacc.c  */
    7841 #line 2136 "parser.yy"
     7855#line 2137 "parser.yy"
    78427856    { (yyval.en) = new ExpressionNode( build_range( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }
    78437857    break;
     
    78467860
    78477861/* Line 1806 of yacc.c  */
    7848 #line 2141 "parser.yy"
     7862#line 2142 "parser.yy"
    78497863    { delete (yyvsp[(3) - (5)].str); }
    78507864    break;
     
    78537867
    78547868/* Line 1806 of yacc.c  */
    7855 #line 2146 "parser.yy"
     7869#line 2147 "parser.yy"
    78567870    { (yyval.decl) = 0; }
    78577871    break;
     
    78607874
    78617875/* Line 1806 of yacc.c  */
    7862 #line 2153 "parser.yy"
     7876#line 2154 "parser.yy"
    78637877    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    78647878    break;
     
    78677881
    78687882/* Line 1806 of yacc.c  */
    7869 #line 2159 "parser.yy"
     7883#line 2160 "parser.yy"
    78707884    { (yyval.decl) = 0; }
    78717885    break;
     
    78747888
    78757889/* Line 1806 of yacc.c  */
    7876 #line 2170 "parser.yy"
     7890#line 2171 "parser.yy"
    78777891    { delete (yyvsp[(3) - (4)].en); }
    78787892    break;
     
    78817895
    78827896/* Line 1806 of yacc.c  */
    7883 #line 2174 "parser.yy"
     7897#line 2175 "parser.yy"
    78847898    { delete (yyvsp[(1) - (1)].tok); }
    78857899    break;
    78867900
    78877901  case 562:
    7888 
    7889 /* Line 1806 of yacc.c  */
    7890 #line 2175 "parser.yy"
    7891     { delete (yyvsp[(1) - (1)].decl); }
    7892     break;
    7893 
    7894   case 563:
    78957902
    78967903/* Line 1806 of yacc.c  */
     
    78997906    break;
    79007907
    7901   case 564:
     7908  case 563:
    79027909
    79037910/* Line 1806 of yacc.c  */
     
    79067913    break;
    79077914
     7915  case 564:
     7916
     7917/* Line 1806 of yacc.c  */
     7918#line 2178 "parser.yy"
     7919    { delete (yyvsp[(1) - (1)].decl); }
     7920    break;
     7921
    79087922  case 565:
    79097923
    79107924/* Line 1806 of yacc.c  */
    7911 #line 2212 "parser.yy"
     7925#line 2213 "parser.yy"
    79127926    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    79137927    break;
     
    79167930
    79177931/* Line 1806 of yacc.c  */
    7918 #line 2215 "parser.yy"
     7932#line 2216 "parser.yy"
    79197933    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    79207934    break;
     
    79237937
    79247938/* Line 1806 of yacc.c  */
    7925 #line 2217 "parser.yy"
     7939#line 2218 "parser.yy"
    79267940    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    79277941    break;
     
    79307944
    79317945/* Line 1806 of yacc.c  */
    7932 #line 2222 "parser.yy"
     7946#line 2223 "parser.yy"
    79337947    {
    79347948                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    79407954
    79417955/* Line 1806 of yacc.c  */
    7942 #line 2227 "parser.yy"
     7956#line 2228 "parser.yy"
    79437957    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    79447958    break;
     
    79477961
    79487962/* Line 1806 of yacc.c  */
    7949 #line 2232 "parser.yy"
     7963#line 2233 "parser.yy"
    79507964    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    79517965    break;
     
    79547968
    79557969/* Line 1806 of yacc.c  */
    7956 #line 2234 "parser.yy"
     7970#line 2235 "parser.yy"
    79577971    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    79587972    break;
     
    79617975
    79627976/* Line 1806 of yacc.c  */
    7963 #line 2236 "parser.yy"
     7977#line 2237 "parser.yy"
    79647978    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    79657979    break;
     
    79687982
    79697983/* Line 1806 of yacc.c  */
    7970 #line 2241 "parser.yy"
     7984#line 2242 "parser.yy"
    79717985    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    79727986    break;
     
    79757989
    79767990/* Line 1806 of yacc.c  */
    7977 #line 2243 "parser.yy"
     7991#line 2244 "parser.yy"
    79787992    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    79797993    break;
     
    79827996
    79837997/* Line 1806 of yacc.c  */
    7984 #line 2245 "parser.yy"
     7998#line 2246 "parser.yy"
    79857999    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    79868000    break;
     
    79898003
    79908004/* Line 1806 of yacc.c  */
    7991 #line 2247 "parser.yy"
     8005#line 2248 "parser.yy"
    79928006    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    79938007    break;
     
    79968010
    79978011/* Line 1806 of yacc.c  */
    7998 #line 2252 "parser.yy"
     8012#line 2253 "parser.yy"
    79998013    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    80008014    break;
     
    80038017
    80048018/* Line 1806 of yacc.c  */
    8005 #line 2254 "parser.yy"
     8019#line 2255 "parser.yy"
    80068020    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    80078021    break;
     
    80108024
    80118025/* Line 1806 of yacc.c  */
    8012 #line 2263 "parser.yy"
     8026#line 2264 "parser.yy"
    80138027    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    80148028    break;
     
    80178031
    80188032/* Line 1806 of yacc.c  */
    8019 #line 2266 "parser.yy"
     8033#line 2267 "parser.yy"
    80208034    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    80218035    break;
     
    80248038
    80258039/* Line 1806 of yacc.c  */
    8026 #line 2271 "parser.yy"
     8040#line 2272 "parser.yy"
    80278041    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    80288042    break;
     
    80318045
    80328046/* Line 1806 of yacc.c  */
    8033 #line 2273 "parser.yy"
     8047#line 2274 "parser.yy"
    80348048    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    80358049    break;
     
    80388052
    80398053/* Line 1806 of yacc.c  */
    8040 #line 2275 "parser.yy"
     8054#line 2276 "parser.yy"
    80418055    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    80428056    break;
     
    80458059
    80468060/* Line 1806 of yacc.c  */
    8047 #line 2280 "parser.yy"
     8061#line 2281 "parser.yy"
    80488062    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    80498063    break;
     
    80528066
    80538067/* Line 1806 of yacc.c  */
    8054 #line 2282 "parser.yy"
     8068#line 2283 "parser.yy"
    80558069    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    80568070    break;
     
    80598073
    80608074/* Line 1806 of yacc.c  */
    8061 #line 2284 "parser.yy"
     8075#line 2285 "parser.yy"
    80628076    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    80638077    break;
     
    80668080
    80678081/* Line 1806 of yacc.c  */
    8068 #line 2289 "parser.yy"
     8082#line 2290 "parser.yy"
    80698083    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    80708084    break;
     
    80738087
    80748088/* Line 1806 of yacc.c  */
    8075 #line 2291 "parser.yy"
     8089#line 2292 "parser.yy"
    80768090    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    80778091    break;
     
    80808094
    80818095/* Line 1806 of yacc.c  */
    8082 #line 2293 "parser.yy"
     8096#line 2294 "parser.yy"
    80838097    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    80848098    break;
     
    80878101
    80888102/* Line 1806 of yacc.c  */
    8089 #line 2308 "parser.yy"
     8103#line 2309 "parser.yy"
    80908104    { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); }
    80918105    break;
     
    80948108
    80958109/* Line 1806 of yacc.c  */
    8096 #line 2310 "parser.yy"
     8110#line 2311 "parser.yy"
    80978111    { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); }
    80988112    break;
     
    81018115
    81028116/* Line 1806 of yacc.c  */
    8103 #line 2312 "parser.yy"
     8117#line 2313 "parser.yy"
    81048118    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    81058119    break;
     
    81088122
    81098123/* Line 1806 of yacc.c  */
    8110 #line 2317 "parser.yy"
     8124#line 2318 "parser.yy"
    81118125    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    81128126    break;
     
    81158129
    81168130/* Line 1806 of yacc.c  */
    8117 #line 2319 "parser.yy"
     8131#line 2320 "parser.yy"
    81188132    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    81198133    break;
     
    81228136
    81238137/* Line 1806 of yacc.c  */
    8124 #line 2321 "parser.yy"
     8138#line 2322 "parser.yy"
    81258139    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    81268140    break;
     
    81298143
    81308144/* Line 1806 of yacc.c  */
    8131 #line 2326 "parser.yy"
     8145#line 2327 "parser.yy"
    81328146    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    81338147    break;
     
    81368150
    81378151/* Line 1806 of yacc.c  */
    8138 #line 2328 "parser.yy"
     8152#line 2329 "parser.yy"
    81398153    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    81408154    break;
     
    81438157
    81448158/* Line 1806 of yacc.c  */
    8145 #line 2330 "parser.yy"
     8159#line 2331 "parser.yy"
    81468160    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    81478161    break;
     
    81508164
    81518165/* Line 1806 of yacc.c  */
    8152 #line 2345 "parser.yy"
     8166#line 2346 "parser.yy"
    81538167    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    81548168    break;
     
    81578171
    81588172/* Line 1806 of yacc.c  */
    8159 #line 2348 "parser.yy"
     8173#line 2349 "parser.yy"
    81608174    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    81618175    break;
     
    81648178
    81658179/* Line 1806 of yacc.c  */
    8166 #line 2350 "parser.yy"
     8180#line 2351 "parser.yy"
    81678181    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    81688182    break;
     
    81718185
    81728186/* Line 1806 of yacc.c  */
    8173 #line 2356 "parser.yy"
     8187#line 2357 "parser.yy"
    81748188    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    81758189    break;
     
    81788192
    81798193/* Line 1806 of yacc.c  */
    8180 #line 2361 "parser.yy"
     8194#line 2362 "parser.yy"
    81818195    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    81828196    break;
     
    81858199
    81868200/* Line 1806 of yacc.c  */
    8187 #line 2363 "parser.yy"
     8201#line 2364 "parser.yy"
    81888202    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    81898203    break;
     
    81928206
    81938207/* Line 1806 of yacc.c  */
    8194 #line 2365 "parser.yy"
     8208#line 2366 "parser.yy"
    81958209    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    81968210    break;
     
    81998213
    82008214/* Line 1806 of yacc.c  */
    8201 #line 2370 "parser.yy"
     8215#line 2371 "parser.yy"
    82028216    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    82038217    break;
     
    82068220
    82078221/* Line 1806 of yacc.c  */
    8208 #line 2372 "parser.yy"
     8222#line 2373 "parser.yy"
    82098223    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    82108224    break;
     
    82138227
    82148228/* Line 1806 of yacc.c  */
    8215 #line 2374 "parser.yy"
     8229#line 2375 "parser.yy"
    82168230    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    82178231    break;
     
    82208234
    82218235/* Line 1806 of yacc.c  */
    8222 #line 2376 "parser.yy"
     8236#line 2377 "parser.yy"
    82238237    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    82248238    break;
     
    82278241
    82288242/* Line 1806 of yacc.c  */
    8229 #line 2381 "parser.yy"
     8243#line 2382 "parser.yy"
    82308244    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    82318245    break;
     
    82348248
    82358249/* Line 1806 of yacc.c  */
    8236 #line 2383 "parser.yy"
     8250#line 2384 "parser.yy"
    82378251    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    82388252    break;
     
    82418255
    82428256/* Line 1806 of yacc.c  */
    8243 #line 2385 "parser.yy"
     8257#line 2386 "parser.yy"
    82448258    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    82458259    break;
     
    82488262
    82498263/* Line 1806 of yacc.c  */
    8250 #line 2395 "parser.yy"
     8264#line 2396 "parser.yy"
    82518265    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    82528266    break;
     
    82558269
    82568270/* Line 1806 of yacc.c  */
    8257 #line 2398 "parser.yy"
     8271#line 2399 "parser.yy"
    82588272    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    82598273    break;
     
    82628276
    82638277/* Line 1806 of yacc.c  */
    8264 #line 2400 "parser.yy"
     8278#line 2401 "parser.yy"
    82658279    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    82668280    break;
     
    82698283
    82708284/* Line 1806 of yacc.c  */
    8271 #line 2405 "parser.yy"
     8285#line 2406 "parser.yy"
    82728286    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    82738287    break;
     
    82768290
    82778291/* Line 1806 of yacc.c  */
    8278 #line 2407 "parser.yy"
     8292#line 2408 "parser.yy"
    82798293    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    82808294    break;
     
    82838297
    82848298/* Line 1806 of yacc.c  */
    8285 #line 2409 "parser.yy"
     8299#line 2410 "parser.yy"
    82868300    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    82878301    break;
     
    82908304
    82918305/* Line 1806 of yacc.c  */
    8292 #line 2414 "parser.yy"
     8306#line 2415 "parser.yy"
    82938307    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    82948308    break;
     
    82978311
    82988312/* Line 1806 of yacc.c  */
    8299 #line 2416 "parser.yy"
     8313#line 2417 "parser.yy"
    83008314    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    83018315    break;
     
    83048318
    83058319/* Line 1806 of yacc.c  */
    8306 #line 2418 "parser.yy"
     8320#line 2419 "parser.yy"
    83078321    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    83088322    break;
     
    83118325
    83128326/* Line 1806 of yacc.c  */
    8313 #line 2420 "parser.yy"
     8327#line 2421 "parser.yy"
    83148328    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83158329    break;
     
    83188332
    83198333/* Line 1806 of yacc.c  */
    8320 #line 2425 "parser.yy"
     8334#line 2426 "parser.yy"
    83218335    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    83228336    break;
     
    83258339
    83268340/* Line 1806 of yacc.c  */
    8327 #line 2427 "parser.yy"
     8341#line 2428 "parser.yy"
    83288342    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    83298343    break;
     
    83328346
    83338347/* Line 1806 of yacc.c  */
    8334 #line 2429 "parser.yy"
     8348#line 2430 "parser.yy"
    83358349    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83368350    break;
     
    83398353
    83408354/* Line 1806 of yacc.c  */
    8341 #line 2460 "parser.yy"
     8355#line 2461 "parser.yy"
    83428356    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    83438357    break;
     
    83468360
    83478361/* Line 1806 of yacc.c  */
    8348 #line 2463 "parser.yy"
     8362#line 2464 "parser.yy"
    83498363    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    83508364    break;
     
    83538367
    83548368/* Line 1806 of yacc.c  */
    8355 #line 2465 "parser.yy"
     8369#line 2466 "parser.yy"
    83568370    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    83578371    break;
     
    83608374
    83618375/* Line 1806 of yacc.c  */
    8362 #line 2470 "parser.yy"
     8376#line 2471 "parser.yy"
    83638377    {
    83648378                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    83708384
    83718385/* Line 1806 of yacc.c  */
    8372 #line 2475 "parser.yy"
     8386#line 2476 "parser.yy"
    83738387    {
    83748388                        typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) );
     
    83808394
    83818395/* Line 1806 of yacc.c  */
    8382 #line 2483 "parser.yy"
     8396#line 2484 "parser.yy"
    83838397    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    83848398    break;
     
    83878401
    83888402/* Line 1806 of yacc.c  */
    8389 #line 2485 "parser.yy"
     8403#line 2486 "parser.yy"
    83908404    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    83918405    break;
     
    83948408
    83958409/* Line 1806 of yacc.c  */
    8396 #line 2487 "parser.yy"
     8410#line 2488 "parser.yy"
    83978411    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    83988412    break;
     
    84018415
    84028416/* Line 1806 of yacc.c  */
    8403 #line 2492 "parser.yy"
     8417#line 2493 "parser.yy"
    84048418    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    84058419    break;
     
    84088422
    84098423/* Line 1806 of yacc.c  */
    8410 #line 2494 "parser.yy"
     8424#line 2495 "parser.yy"
    84118425    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    84128426    break;
     
    84158429
    84168430/* Line 1806 of yacc.c  */
    8417 #line 2499 "parser.yy"
     8431#line 2500 "parser.yy"
    84188432    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }
    84198433    break;
     
    84228436
    84238437/* Line 1806 of yacc.c  */
    8424 #line 2501 "parser.yy"
     8438#line 2502 "parser.yy"
    84258439    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    84268440    break;
     
    84298443
    84308444/* Line 1806 of yacc.c  */
    8431 #line 2516 "parser.yy"
     8445#line 2517 "parser.yy"
    84328446    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    84338447    break;
     
    84368450
    84378451/* Line 1806 of yacc.c  */
    8438 #line 2518 "parser.yy"
     8452#line 2519 "parser.yy"
    84398453    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    84408454    break;
     
    84438457
    84448458/* Line 1806 of yacc.c  */
    8445 #line 2523 "parser.yy"
     8459#line 2524 "parser.yy"
    84468460    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    84478461    break;
     
    84508464
    84518465/* Line 1806 of yacc.c  */
    8452 #line 2525 "parser.yy"
     8466#line 2526 "parser.yy"
    84538467    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    84548468    break;
     
    84578471
    84588472/* Line 1806 of yacc.c  */
    8459 #line 2527 "parser.yy"
     8473#line 2528 "parser.yy"
    84608474    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    84618475    break;
     
    84648478
    84658479/* Line 1806 of yacc.c  */
    8466 #line 2529 "parser.yy"
     8480#line 2530 "parser.yy"
    84678481    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    84688482    break;
     
    84718485
    84728486/* Line 1806 of yacc.c  */
    8473 #line 2531 "parser.yy"
     8487#line 2532 "parser.yy"
    84748488    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84758489    break;
     
    84788492
    84798493/* Line 1806 of yacc.c  */
    8480 #line 2537 "parser.yy"
     8494#line 2538 "parser.yy"
    84818495    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    84828496    break;
     
    84858499
    84868500/* Line 1806 of yacc.c  */
    8487 #line 2539 "parser.yy"
     8501#line 2540 "parser.yy"
    84888502    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    84898503    break;
     
    84928506
    84938507/* Line 1806 of yacc.c  */
    8494 #line 2541 "parser.yy"
     8508#line 2542 "parser.yy"
    84958509    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    84968510    break;
     
    84998513
    85008514/* Line 1806 of yacc.c  */
    8501 #line 2546 "parser.yy"
     8515#line 2547 "parser.yy"
    85028516    { (yyval.decl) = DeclarationNode::newFunction( nullptr, nullptr, (yyvsp[(3) - (5)].decl), nullptr ); }
    85038517    break;
     
    85068520
    85078521/* Line 1806 of yacc.c  */
    8508 #line 2548 "parser.yy"
     8522#line 2549 "parser.yy"
    85098523    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    85108524    break;
     
    85138527
    85148528/* Line 1806 of yacc.c  */
    8515 #line 2550 "parser.yy"
     8529#line 2551 "parser.yy"
    85168530    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    85178531    break;
     
    85208534
    85218535/* Line 1806 of yacc.c  */
    8522 #line 2556 "parser.yy"
     8536#line 2557 "parser.yy"
    85238537    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
    85248538    break;
     
    85278541
    85288542/* Line 1806 of yacc.c  */
    8529 #line 2558 "parser.yy"
     8543#line 2559 "parser.yy"
    85308544    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[(3) - (3)].decl) ); }
    85318545    break;
     
    85348548
    85358549/* Line 1806 of yacc.c  */
    8536 #line 2564 "parser.yy"
     8550#line 2565 "parser.yy"
    85378551    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); }
    85388552    break;
     
    85418555
    85428556/* Line 1806 of yacc.c  */
    8543 #line 2566 "parser.yy"
     8557#line 2567 "parser.yy"
    85448558    { (yyval.decl) = DeclarationNode::newVarArray( 0 ); }
    85458559    break;
     
    85488562
    85498563/* Line 1806 of yacc.c  */
    8550 #line 2568 "parser.yy"
     8564#line 2569 "parser.yy"
    85518565    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); }
    85528566    break;
     
    85558569
    85568570/* Line 1806 of yacc.c  */
    8557 #line 2570 "parser.yy"
     8571#line 2571 "parser.yy"
    85588572    { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); }
    85598573    break;
     
    85628576
    85638577/* Line 1806 of yacc.c  */
    8564 #line 2585 "parser.yy"
     8578#line 2586 "parser.yy"
    85658579    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    85668580    break;
     
    85698583
    85708584/* Line 1806 of yacc.c  */
    8571 #line 2587 "parser.yy"
     8585#line 2588 "parser.yy"
    85728586    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    85738587    break;
     
    85768590
    85778591/* Line 1806 of yacc.c  */
    8578 #line 2592 "parser.yy"
     8592#line 2593 "parser.yy"
    85798593    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    85808594    break;
     
    85838597
    85848598/* Line 1806 of yacc.c  */
    8585 #line 2594 "parser.yy"
     8599#line 2595 "parser.yy"
    85868600    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    85878601    break;
     
    85908604
    85918605/* Line 1806 of yacc.c  */
    8592 #line 2596 "parser.yy"
     8606#line 2597 "parser.yy"
    85938607    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    85948608    break;
     
    85978611
    85988612/* Line 1806 of yacc.c  */
    8599 #line 2598 "parser.yy"
     8613#line 2599 "parser.yy"
    86008614    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    86018615    break;
     
    86048618
    86058619/* Line 1806 of yacc.c  */
    8606 #line 2600 "parser.yy"
     8620#line 2601 "parser.yy"
    86078621    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86088622    break;
     
    86118625
    86128626/* Line 1806 of yacc.c  */
    8613 #line 2606 "parser.yy"
     8627#line 2607 "parser.yy"
    86148628    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    86158629    break;
     
    86188632
    86198633/* Line 1806 of yacc.c  */
    8620 #line 2608 "parser.yy"
     8634#line 2609 "parser.yy"
    86218635    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    86228636    break;
     
    86258639
    86268640/* Line 1806 of yacc.c  */
    8627 #line 2610 "parser.yy"
     8641#line 2611 "parser.yy"
    86288642    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86298643    break;
     
    86328646
    86338647/* Line 1806 of yacc.c  */
    8634 #line 2615 "parser.yy"
     8648#line 2616 "parser.yy"
    86358649    { (yyval.decl) = DeclarationNode::newFunction( nullptr, nullptr, (yyvsp[(3) - (5)].decl), nullptr ); }
    86368650    break;
     
    86398653
    86408654/* Line 1806 of yacc.c  */
    8641 #line 2617 "parser.yy"
     8655#line 2618 "parser.yy"
    86428656    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    86438657    break;
     
    86468660
    86478661/* Line 1806 of yacc.c  */
    8648 #line 2619 "parser.yy"
     8662#line 2620 "parser.yy"
    86498663    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    86508664    break;
     
    86538667
    86548668/* Line 1806 of yacc.c  */
    8655 #line 2626 "parser.yy"
     8669#line 2627 "parser.yy"
    86568670    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }
    86578671    break;
     
    86608674
    86618675/* Line 1806 of yacc.c  */
    8662 #line 2637 "parser.yy"
     8676#line 2638 "parser.yy"
    86638677    { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }
    86648678    break;
     
    86678681
    86688682/* Line 1806 of yacc.c  */
    8669 #line 2640 "parser.yy"
     8683#line 2641 "parser.yy"
    86708684    { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
    86718685    break;
     
    86748688
    86758689/* Line 1806 of yacc.c  */
    8676 #line 2642 "parser.yy"
     8690#line 2643 "parser.yy"
    86778691    { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[(3) - (5)].decl), false ); }
    86788692    break;
     
    86818695
    86828696/* Line 1806 of yacc.c  */
    8683 #line 2645 "parser.yy"
     8697#line 2646 "parser.yy"
    86848698    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
    86858699    break;
     
    86888702
    86898703/* Line 1806 of yacc.c  */
    8690 #line 2647 "parser.yy"
     8704#line 2648 "parser.yy"
    86918705    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); }
    86928706    break;
     
    86958709
    86968710/* Line 1806 of yacc.c  */
    8697 #line 2649 "parser.yy"
     8711#line 2650 "parser.yy"
    86988712    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(3) - (7)].decl), true ); }
    86998713    break;
     
    87028716
    87038717/* Line 1806 of yacc.c  */
    8704 #line 2663 "parser.yy"
     8718#line 2664 "parser.yy"
    87058719    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    87068720    break;
     
    87098723
    87108724/* Line 1806 of yacc.c  */
    8711 #line 2665 "parser.yy"
     8725#line 2666 "parser.yy"
    87128726    { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }
    87138727    break;
     
    87168730
    87178731/* Line 1806 of yacc.c  */
    8718 #line 2670 "parser.yy"
     8732#line 2671 "parser.yy"
    87198733    { (yyval.decl) = DeclarationNode::newPointer( 0 ); }
    87208734    break;
     
    87238737
    87248738/* Line 1806 of yacc.c  */
    8725 #line 2672 "parser.yy"
     8739#line 2673 "parser.yy"
    87268740    { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }
    87278741    break;
     
    87308744
    87318745/* Line 1806 of yacc.c  */
    8732 #line 2674 "parser.yy"
     8746#line 2675 "parser.yy"
    87338747    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }
    87348748    break;
     
    87378751
    87388752/* Line 1806 of yacc.c  */
    8739 #line 2676 "parser.yy"
     8753#line 2677 "parser.yy"
    87408754    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }
    87418755    break;
     
    87448758
    87458759/* Line 1806 of yacc.c  */
    8746 #line 2678 "parser.yy"
     8760#line 2679 "parser.yy"
    87478761    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    87488762    break;
     
    87518765
    87528766/* Line 1806 of yacc.c  */
    8753 #line 2684 "parser.yy"
     8767#line 2685 "parser.yy"
    87548768    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    87558769    break;
     
    87588772
    87598773/* Line 1806 of yacc.c  */
    8760 #line 2686 "parser.yy"
     8774#line 2687 "parser.yy"
    87618775    { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }
    87628776    break;
     
    87658779
    87668780/* Line 1806 of yacc.c  */
    8767 #line 2688 "parser.yy"
     8781#line 2689 "parser.yy"
    87688782    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    87698783    break;
     
    87728786
    87738787/* Line 1806 of yacc.c  */
    8774 #line 2693 "parser.yy"
     8788#line 2694 "parser.yy"
    87758789    { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }
    87768790    break;
     
    87798793
    87808794/* Line 1806 of yacc.c  */
    8781 #line 2695 "parser.yy"
     8795#line 2696 "parser.yy"
    87828796    { (yyval.decl) = (yyvsp[(2) - (3)].decl); }
    87838797    break;
     
    87868800
    87878801/* Line 1806 of yacc.c  */
    8788 #line 2705 "parser.yy"
     8802#line 2706 "parser.yy"
    87898803    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    87908804    break;
     
    87938807
    87948808/* Line 1806 of yacc.c  */
    8795 #line 2715 "parser.yy"
     8809#line 2716 "parser.yy"
    87968810    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    87978811    break;
     
    88008814
    88018815/* Line 1806 of yacc.c  */
    8802 #line 2717 "parser.yy"
     8816#line 2718 "parser.yy"
    88038817    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    88048818    break;
     
    88078821
    88088822/* Line 1806 of yacc.c  */
    8809 #line 2719 "parser.yy"
     8823#line 2720 "parser.yy"
    88108824    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    88118825    break;
     
    88148828
    88158829/* Line 1806 of yacc.c  */
    8816 #line 2721 "parser.yy"
     8830#line 2722 "parser.yy"
    88178831    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    88188832    break;
     
    88218835
    88228836/* Line 1806 of yacc.c  */
    8823 #line 2723 "parser.yy"
     8837#line 2724 "parser.yy"
    88248838    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    88258839    break;
     
    88288842
    88298843/* Line 1806 of yacc.c  */
    8830 #line 2725 "parser.yy"
     8844#line 2726 "parser.yy"
    88318845    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    88328846    break;
     
    88358849
    88368850/* Line 1806 of yacc.c  */
    8837 #line 2732 "parser.yy"
     8851#line 2733 "parser.yy"
    88388852    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    88398853    break;
     
    88428856
    88438857/* Line 1806 of yacc.c  */
    8844 #line 2734 "parser.yy"
     8858#line 2735 "parser.yy"
    88458859    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    88468860    break;
     
    88498863
    88508864/* Line 1806 of yacc.c  */
    8851 #line 2736 "parser.yy"
     8865#line 2737 "parser.yy"
    88528866    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    88538867    break;
     
    88568870
    88578871/* Line 1806 of yacc.c  */
    8858 #line 2738 "parser.yy"
     8872#line 2739 "parser.yy"
    88598873    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
    88608874    break;
     
    88638877
    88648878/* Line 1806 of yacc.c  */
    8865 #line 2740 "parser.yy"
     8879#line 2741 "parser.yy"
    88668880    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    88678881    break;
     
    88708884
    88718885/* Line 1806 of yacc.c  */
    8872 #line 2743 "parser.yy"
     8886#line 2744 "parser.yy"
    88738887    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    88748888    break;
     
    88778891
    88788892/* Line 1806 of yacc.c  */
    8879 #line 2745 "parser.yy"
     8893#line 2746 "parser.yy"
    88808894    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    88818895    break;
     
    88848898
    88858899/* Line 1806 of yacc.c  */
    8886 #line 2747 "parser.yy"
     8900#line 2748 "parser.yy"
    88878901    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }
    88888902    break;
     
    88918905
    88928906/* Line 1806 of yacc.c  */
    8893 #line 2749 "parser.yy"
     8907#line 2750 "parser.yy"
    88948908    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); }
    88958909    break;
     
    88988912
    88998913/* Line 1806 of yacc.c  */
    8900 #line 2751 "parser.yy"
     8914#line 2752 "parser.yy"
    89018915    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    89028916    break;
     
    89058919
    89068920/* Line 1806 of yacc.c  */
    8907 #line 2756 "parser.yy"
     8921#line 2757 "parser.yy"
    89088922    { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }
    89098923    break;
     
    89128926
    89138927/* Line 1806 of yacc.c  */
    8914 #line 2758 "parser.yy"
     8928#line 2759 "parser.yy"
    89158929    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }
    89168930    break;
     
    89198933
    89208934/* Line 1806 of yacc.c  */
    8921 #line 2763 "parser.yy"
     8935#line 2764 "parser.yy"
    89228936    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); }
    89238937    break;
     
    89268940
    89278941/* Line 1806 of yacc.c  */
    8928 #line 2765 "parser.yy"
     8942#line 2766 "parser.yy"
    89298943    { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); }
    89308944    break;
     
    89338947
    89348948/* Line 1806 of yacc.c  */
    8935 #line 2792 "parser.yy"
     8949#line 2793 "parser.yy"
    89368950    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }
    89378951    break;
     
    89408954
    89418955/* Line 1806 of yacc.c  */
    8942 #line 2803 "parser.yy"
     8956#line 2804 "parser.yy"
    89438957    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    89448958    break;
     
    89478961
    89488962/* Line 1806 of yacc.c  */
    8949 #line 2805 "parser.yy"
     8963#line 2806 "parser.yy"
    89508964    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    89518965    break;
     
    89548968
    89558969/* Line 1806 of yacc.c  */
    8956 #line 2807 "parser.yy"
     8970#line 2808 "parser.yy"
    89578971    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    89588972    break;
     
    89618975
    89628976/* Line 1806 of yacc.c  */
    8963 #line 2809 "parser.yy"
     8977#line 2810 "parser.yy"
    89648978    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    89658979    break;
     
    89688982
    89698983/* Line 1806 of yacc.c  */
    8970 #line 2811 "parser.yy"
     8984#line 2812 "parser.yy"
    89718985    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }
    89728986    break;
     
    89758989
    89768990/* Line 1806 of yacc.c  */
    8977 #line 2813 "parser.yy"
     8991#line 2814 "parser.yy"
    89788992    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }
    89798993    break;
     
    89828996
    89838997/* Line 1806 of yacc.c  */
    8984 #line 2820 "parser.yy"
     8998#line 2821 "parser.yy"
    89858999    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    89869000    break;
     
    89899003
    89909004/* Line 1806 of yacc.c  */
    8991 #line 2822 "parser.yy"
     9005#line 2823 "parser.yy"
    89929006    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    89939007    break;
     
    89969010
    89979011/* Line 1806 of yacc.c  */
    8998 #line 2824 "parser.yy"
     9012#line 2825 "parser.yy"
    89999013    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    90009014    break;
     
    90039017
    90049018/* Line 1806 of yacc.c  */
    9005 #line 2826 "parser.yy"
     9019#line 2827 "parser.yy"
    90069020    { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    90079021    break;
     
    90109024
    90119025/* Line 1806 of yacc.c  */
    9012 #line 2828 "parser.yy"
     9026#line 2829 "parser.yy"
    90139027    { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( nullptr, nullptr, false ) ); }
    90149028    break;
     
    90179031
    90189032/* Line 1806 of yacc.c  */
    9019 #line 2830 "parser.yy"
     9033#line 2831 "parser.yy"
    90209034    { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }
    90219035    break;
     
    90249038
    90259039/* Line 1806 of yacc.c  */
    9026 #line 2835 "parser.yy"
     9040#line 2836 "parser.yy"
    90279041    { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); }
    90289042    break;
     
    90319045
    90329046/* Line 1806 of yacc.c  */
    9033 #line 2842 "parser.yy"
     9047#line 2843 "parser.yy"
    90349048    { (yyval.decl) = DeclarationNode::newFunction( nullptr, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), nullptr ); }
    90359049    break;
     
    90389052
    90399053/* Line 1806 of yacc.c  */
    9040 #line 2844 "parser.yy"
     9054#line 2845 "parser.yy"
    90419055    { (yyval.decl) = DeclarationNode::newFunction( nullptr, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), nullptr ); }
    90429056    break;
     
    90459059
    90469060/* Line 1806 of yacc.c  */
    9047 #line 2868 "parser.yy"
     9061#line 2869 "parser.yy"
    90489062    { (yyval.en) = 0; }
    90499063    break;
     
    90529066
    90539067/* Line 1806 of yacc.c  */
    9054 #line 2870 "parser.yy"
     9068#line 2871 "parser.yy"
    90559069    { (yyval.en) = (yyvsp[(2) - (2)].en); }
    90569070    break;
     
    90599073
    90609074/* Line 1806 of yacc.c  */
    9061 #line 9062 "Parser/parser.cc"
     9075#line 9076 "Parser/parser.cc"
    90629076      default: break;
    90639077    }
     
    92909304
    92919305/* Line 2067 of yacc.c  */
    9292 #line 2873 "parser.yy"
     9306#line 2874 "parser.yy"
    92939307
    92949308// ----end of grammar----
  • src/Parser/parser.yy

    r47a8d17 r3f0c6a5  
    199199
    200200%type<decl> field_declaration field_declaration_list field_declarator field_declaring_list
    201 %type<en> field field_list
    202 %type<tok> field_name
     201%type<en> field field_list field_name
    203202
    204203%type<decl> external_function_definition function_definition function_array function_declarator function_no_ptr function_ptr
     
    384383                { $$ = new ExpressionNode( build_fieldSel( $1, build_varref( $3 ) ) ); }
    385384        | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector
     385                { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
    386386        | postfix_expression REALFRACTIONconstant                       // CFA, tuple index
     387                { $$ = new ExpressionNode( build_fieldSel( $1, build_constantInteger( *$2 ) ) ); }
    387388        | postfix_expression ARROW no_attr_identifier
    388389                { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); }
    389390        | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector
     391                        { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
    390392        | postfix_expression ICR
    391393                { $$ = new ExpressionNode( build_unary_ptr( OperKinds::IncrPost, $1 ) ); }
     
    421423field:                                                                                                  // CFA, tuple field selector
    422424        field_name
     425        | REALDECIMALconstant field
     426                { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_constantInteger( *$1 ) ), maybeMoveBuild<Expression>( $2 ) ) ); }
     427        | REALDECIMALconstant '[' push field_list pop ']'
     428                { $$ = new ExpressionNode( build_fieldSel( new ExpressionNode( build_constantInteger( *$1 ) ), build_tuple( $4 ) ) ); }
     429        | field_name '.' field
     430                { $$ = new ExpressionNode( build_fieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
     431        | field_name '.' '[' push field_list pop ']'
     432                { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $5 ) ) ); }
     433        | field_name ARROW field
     434                { $$ = new ExpressionNode( build_pfieldSel( $1, maybeMoveBuild<Expression>( $3 ) ) ); }
     435        | field_name ARROW '[' push field_list pop ']'
     436                { $$ = new ExpressionNode( build_pfieldSel( $1, build_tuple( $5 ) ) ); }
     437        ;
     438
     439field_name: // ... use $2
     440        INTEGERconstant fraction_constants
     441                { $$ = new ExpressionNode( build_constantInteger( *$1 ) ); }
     442        | FLOATINGconstant fraction_constants
     443                { $$ = new ExpressionNode( build_constantInteger( *$1 ) ); }
     444        | no_attr_identifier fraction_constants
    423445                { $$ = new ExpressionNode( build_varref( $1 ) ); }
    424         | REALDECIMALconstant field
    425                 { $$ = new ExpressionNode( build_fieldSel( $2, build_varref( $1 ) ) ); }
    426         | REALDECIMALconstant '[' push field_list pop ']'
    427                 { $$ = new ExpressionNode( build_fieldSel( $4, build_varref( $1 ) ) ); }
    428         | field_name '.' field
    429                 { $$ = new ExpressionNode( build_fieldSel( $3, build_varref( $1 ) ) ); }
    430         | field_name '.' '[' push field_list pop ']'
    431                 { $$ = new ExpressionNode( build_fieldSel( $5, build_varref( $1 ) ) ); }
    432         | field_name ARROW field
    433                 { $$ = new ExpressionNode( build_pfieldSel( $3, build_varref( $1 ) ) ); }
    434         | field_name ARROW '[' push field_list pop ']'
    435                 { $$ = new ExpressionNode( build_pfieldSel( $5, build_varref( $1 ) ) ); }
    436         ;
    437 
    438 field_name:
    439         INTEGERconstant fraction_constants
    440                 { $$ = $1; }
    441         | FLOATINGconstant fraction_constants
    442                 { $$ = $1; }
    443         | no_attr_identifier fraction_constants
    444                 { $$ = $1; }
    445446        ;
    446447
  • src/ResolvExpr/Alternative.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Alternative.cc -- 
     7// Alternative.cc --
    88//
    99// Author           : Richard C. Bilson
     
    1212// Last Modified On : Sat May 16 23:54:23 2015
    1313// Update Count     : 2
    14 // 
     14//
    1515
    1616#include "Alternative.h"
     
    2020
    2121namespace ResolvExpr {
    22         Alternative::Alternative() : expr( 0 ) {}
     22        Alternative::Alternative() : cost( Cost::zero ), cvtCost( Cost::zero ), expr( 0 ) {}
    2323
    2424        Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost )
     
    3535                if ( &other == this ) return *this;
    3636                initialize( other, *this );
     37                return *this;
     38        }
     39
     40        Alternative::Alternative( Alternative && other ) : cost( other.cost ), cvtCost( other.cvtCost ), expr( other.expr ), env( other.env ) {
     41                other.expr = nullptr;
     42        }
     43
     44        Alternative & Alternative::operator=( Alternative && other ) {
     45                if ( &other == this )  return *this;
     46                delete expr;
     47                cost = other.cost;
     48                cvtCost = other.cvtCost;
     49                expr = other.expr;
     50                env = other.env;
     51                other.expr = nullptr;
    3752                return *this;
    3853        }
     
    5469                        expr->print( os, indent );
    5570                        os << "(types:" << std::endl;
    56                         printAll( expr->get_results(), os, indent + 4 );
    57                         os << ")" << std::endl;
     71                        os << std::string( indent+4, ' ' );
     72                        expr->get_result()->print( os, indent + 4 );
     73                        os << std::endl << ")" << std::endl;
    5874                } else {
    5975                        os << "Null expression!" << std::endl;
  • src/ResolvExpr/Alternative.h

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Alternative.h -- 
     7// Alternative.h --
    88//
    99// Author           : Richard C. Bilson
     
    1212// Last Modified On : Sat May 16 23:54:39 2015
    1313// Update Count     : 2
    14 // 
     14//
    1515
    1616#ifndef ALTERNATIVE_H
     
    3232                Alternative( const Alternative &other );
    3333                Alternative &operator=( const Alternative &other );
     34                Alternative( Alternative && other );
     35                Alternative &operator=( Alternative && other );
    3436                ~Alternative();
    35  
     37
    3638                void initialize( const Alternative &src, Alternative &dest );
    37  
     39
    3840                void print( std::ostream &os, int indent = 0 ) const;
    39  
     41
    4042                Cost cost;
    4143                Cost cvtCost;
  • src/ResolvExpr/AlternativeFinder.cc

    r47a8d17 r3f0c6a5  
    3838#include "SynTree/TypeSubstitution.h"
    3939#include "SymTab/Validate.h"
    40 #include "Tuples/TupleAssignment.h"
    41 #include "Tuples/NameMatcher.h"
     40#include "Tuples/Tuples.h"
    4241#include "Common/utility.h"
    4342#include "InitTweak/InitTweak.h"
     43#include "InitTweak/GenInit.h"
    4444#include "ResolveTypeof.h"
    4545
     
    6464        }
    6565
     66        Cost sumCost( const AltList &in ) {
     67                Cost total;
     68                for ( AltList::const_iterator i = in.begin(); i != in.end(); ++i ) {
     69                        total += i->cost;
     70                }
     71                return total;
     72        }
     73
    6674        namespace {
    6775                void printAlts( const AltList &list, std::ostream &os, int indent = 0 ) {
     
    7684                                out.push_back( i->expr->clone() );
    7785                        }
    78                 }
    79 
    80                 Cost sumCost( const AltList &in ) {
    81                         Cost total;
    82                         for ( AltList::const_iterator i = in.begin(); i != in.end(); ++i ) {
    83                                 total += i->cost;
    84                         }
    85                         return total;
    8686                }
    8787
     
    101101                                PruneStruct current( candidate );
    102102                                std::string mangleName;
    103                                 for ( std::list< Type* >::const_iterator retType = candidate->expr->get_results().begin(); retType != candidate->expr->get_results().end(); ++retType ) {
    104                                         Type *newType = (*retType)->clone();
     103                                {
     104                                        Type * newType = candidate->expr->get_result()->clone();
    105105                                        candidate->env.apply( newType );
    106                                         mangleName += SymTab::Mangler::mangle( newType );
     106                                        mangleName = SymTab::Mangler::mangle( newType );
    107107                                        delete newType;
    108108                                }
     
    133133                                if ( ! target->second.isAmbiguous ) {
    134134                                        Alternative &alt = *target->second.candidate;
    135                                         for ( std::list< Type* >::iterator result = alt.expr->get_results().begin(); result != alt.expr->get_results().end(); ++result ) {
    136                                                 alt.env.applyFree( *result );
    137                                         }
     135                                        alt.env.applyFree( alt.expr->get_result() );
    138136                                        *out++ = alt;
    139137                                }
    140138                        }
    141 
    142                 }
    143 
    144                 template< typename InputIterator, typename OutputIterator >
    145                 void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
    146                         AltList alternatives;
    147 
    148                         // select the alternatives that have the minimum parameter cost
    149                         Cost minCost = Cost::infinity;
    150                         for ( AltList::iterator i = begin; i != end; ++i ) {
    151                                 if ( i->cost < minCost ) {
    152                                         minCost = i->cost;
    153                                         i->cost = i->cvtCost;
    154                                         alternatives.clear();
    155                                         alternatives.push_back( *i );
    156                                 } else if ( i->cost == minCost ) {
    157                                         i->cost = i->cvtCost;
    158                                         alternatives.push_back( *i );
    159                                 }
    160                         }
    161                         std::copy( alternatives.begin(), alternatives.end(), out );
    162                 }
    163 
    164                 template< typename InputIterator >
    165                 void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) {
    166                         while ( begin != end ) {
    167                                 result.simpleCombine( (*begin++).env );
    168                         }
    169139                }
    170140
    171141                void renameTypes( Expression *expr ) {
    172                         for ( std::list< Type* >::iterator i = expr->get_results().begin(); i != expr->get_results().end(); ++i ) {
    173                                 (*i)->accept( global_renamer );
    174                         }
     142                        expr->get_result()->accept( global_renamer );
    175143                }
    176144        }
     
    204172                for ( AltList::iterator i = alternatives.begin(); i != alternatives.end(); ++i ) {
    205173                        if ( adjust ) {
    206                                 adjustExprTypeList( i->expr->get_results().begin(), i->expr->get_results().end(), i->env, indexer );
     174                                adjustExprType( i->expr->get_result(), i->env, indexer );
    207175                        }
    208176                }
     
    240208        }
    241209
     210        // std::unordered_map< Expression *, UniqueExpr * > ;
     211
    242212        template< typename StructOrUnionType >
    243         void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name ) {
     213        void AlternativeFinder::addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
     214                // by this point, member must be a name expr
     215                NameExpr * nameExpr = safe_dynamic_cast< NameExpr * >( member );
     216                const std::string & name = nameExpr->get_name();
    244217                std::list< Declaration* > members;
    245218                aggInst->lookup( name, members );
     
    254227        }
    255228
     229        void AlternativeFinder::addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member ) {
     230                if ( ConstantExpr * constantExpr = dynamic_cast< ConstantExpr * >( member ) ) {
     231                        // get the value of the constant expression as an int, must be between 0 and the length of the tuple type to have meaning
     232                        // xxx - this should be improved by memoizing the value of constant exprs
     233                        // during parsing and reusing that information here.
     234                        std::stringstream ss( constantExpr->get_constant()->get_value() );
     235                        int val;
     236                        std::string tmp;
     237                        if ( ss >> val && ! (ss >> tmp) ) {
     238                                if ( val >= 0 && (unsigned int)val < tupleType->size() ) {
     239                                        alternatives.push_back( Alternative( new TupleIndexExpr( expr->clone(), val ), env, newCost ) );
     240                                } // if
     241                        } // if
     242                } // if
     243        }
     244
    256245        void AlternativeFinder::visit( ApplicationExpr *applicationExpr ) {
    257246                alternatives.push_back( Alternative( applicationExpr->clone(), env, Cost::zero ) );
     
    259248
    260249        Cost computeConversionCost( Alternative &alt, const SymTab::Indexer &indexer ) {
    261                 ApplicationExpr *appExpr = dynamic_cast< ApplicationExpr* >( alt.expr );
    262                 assert( appExpr );
    263                 PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
    264                 assert( pointer );
    265                 FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
    266                 assert( function );
     250                ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( alt.expr );
     251                PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
     252                FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
    267253
    268254                Cost convCost( 0, 0, 0 );
     
    270256                std::list< DeclarationWithType* >::iterator formal = formals.begin();
    271257                std::list< Expression* >& actuals = appExpr->get_args();
     258
     259                std::list< Type * > formalTypes;
     260                std::list< Type * >::iterator formalType = formalTypes.end();
     261
    272262                for ( std::list< Expression* >::iterator actualExpr = actuals.begin(); actualExpr != actuals.end(); ++actualExpr ) {
     263
    273264                        PRINT(
    274265                                std::cerr << "actual expression:" << std::endl;
    275266                                (*actualExpr)->print( std::cerr, 8 );
    276267                                std::cerr << "--- results are" << std::endl;
    277                                 printAll( (*actualExpr)->get_results(), std::cerr, 8 );
     268                                (*actualExpr)->get_result()->print( std::cerr, 8 );
    278269                        )
    279270                        std::list< DeclarationWithType* >::iterator startFormal = formal;
    280271                        Cost actualCost;
    281                         for ( std::list< Type* >::iterator actual = (*actualExpr)->get_results().begin(); actual != (*actualExpr)->get_results().end(); ++actual ) {
    282                                 if ( formal == formals.end() ) {
    283                                         if ( function->get_isVarArgs() ) {
    284                                                 convCost += Cost( 1, 0, 0 );
    285                                                 break;
    286                                         } else {
    287                                                 return Cost::infinity;
     272                        std::list< Type * > flatActualTypes;
     273                        flatten( (*actualExpr)->get_result(), back_inserter( flatActualTypes ) );
     274                        for ( std::list< Type* >::iterator actualType = flatActualTypes.begin(); actualType != flatActualTypes.end(); ++actualType ) {
     275
     276
     277                                // tuple handling code
     278                                if ( formalType == formalTypes.end() ) {
     279                                        // the type of the formal parameter may be a tuple type. To make this easier to work with,
     280                                        // flatten the tuple type and traverse the resulting list of types, incrementing the formal
     281                                        // iterator once its types have been extracted. Once a particular formal parameter's type has
     282                                        // been exhausted load the next formal parameter's type.
     283                                        if ( formal == formals.end() ) {
     284                                                if ( function->get_isVarArgs() ) {
     285                                                        convCost += Cost( 1, 0, 0 );
     286                                                        break;
     287                                                } else {
     288                                                        return Cost::infinity;
     289                                                }
    288290                                        }
     291                                        formalTypes.clear();
     292                                        flatten( (*formal)->get_type(), back_inserter( formalTypes ) );
     293                                        formalType = formalTypes.begin();
     294                                        ++formal;
    289295                                }
     296
    290297                                PRINT(
    291298                                        std::cerr << std::endl << "converting ";
    292                                         (*actual)->print( std::cerr, 8 );
     299                                        (*actualType)->print( std::cerr, 8 );
    293300                                        std::cerr << std::endl << " to ";
    294301                                        (*formal)->get_type()->print( std::cerr, 8 );
    295302                                )
    296                                 Cost newCost = conversionCost( *actual, (*formal)->get_type(), indexer, alt.env );
     303                                Cost newCost = conversionCost( *actualType, *formalType, indexer, alt.env );
    297304                                PRINT(
    298305                                        std::cerr << std::endl << "cost is" << newCost << std::endl;
     
    305312                                actualCost += newCost;
    306313
    307                                 convCost += Cost( 0, polyCost( (*formal)->get_type(), alt.env, indexer ) + polyCost( *actual, alt.env, indexer ), 0 );
    308 
    309                                 formal++;
     314                                convCost += Cost( 0, polyCost( *formalType, alt.env, indexer ) + polyCost( *actualType, alt.env, indexer ), 0 );
     315
     316                                formalType++;
    310317                        }
    311318                        if ( actualCost != Cost( 0, 0, 0 ) ) {
     
    356363        /// Adds type variables to the open variable set and marks their assertions
    357364        void makeUnifiableVars( Type *type, OpenVarSet &unifiableVars, AssertionSet &needAssertions ) {
    358                 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     365                for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    359366                        unifiableVars[ (*tyvar)->get_name() ] = (*tyvar)->get_kind();
    360367                        for ( std::list< DeclarationWithType* >::iterator assert = (*tyvar)->get_assertions().begin(); assert != (*tyvar)->get_assertions().end(); ++assert ) {
     
    365372        }
    366373
    367         bool AlternativeFinder::instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave ) {
     374        /// instantiate a single argument by matching actuals from [actualIt, actualEnd) against formalType,
     375        /// producing expression(s) in out and their total cost in cost.
     376        template< typename AltIterator, typename OutputIterator >
     377        bool instantiateArgument( Type * formalType, Initializer * defaultValue, AltIterator & actualIt, AltIterator actualEnd, OpenVarSet & openVars, TypeEnvironment & resultEnv, AssertionSet & resultNeed, AssertionSet & resultHave, const SymTab::Indexer & indexer, Cost & cost, OutputIterator out ) {
     378                if ( TupleType * tupleType = dynamic_cast< TupleType * >( formalType ) ) {
     379                        // formalType is a TupleType - group actuals into a TupleExpr whose type unifies with the TupleType
     380                        TupleExpr * tupleExpr = new TupleExpr();
     381                        for ( Type * type : *tupleType ) {
     382                                if ( ! instantiateArgument( type, defaultValue, actualIt, actualEnd, openVars, resultEnv, resultNeed, resultHave, indexer, cost, back_inserter( tupleExpr->get_exprs() ) ) ) {
     383                                        delete tupleExpr;
     384                                        return false;
     385                                }
     386                        }
     387                        tupleExpr->set_result( Tuples::makeTupleType( tupleExpr->get_exprs() ) );
     388                        *out++ = tupleExpr;
     389                } else if ( actualIt != actualEnd ) {
     390                        // both actualType and formalType are atomic (non-tuple) types - if they unify
     391                        // then accept actual as an argument, otherwise return false (fail to instantiate argument)
     392                        Expression * actual = actualIt->expr;
     393                        Type * actualType = actual->get_result();
     394                        PRINT(
     395                                std::cerr << "formal type is ";
     396                                formalType->print( std::cerr );
     397                                std::cerr << std::endl << "actual type is ";
     398                                actualType->print( std::cerr );
     399                                std::cerr << std::endl;
     400                        )
     401                        if ( ! unify( formalType, actualType, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
     402                                return false;
     403                        }
     404                        // move the expression from the alternative to the output iterator
     405                        *out++ = actual;
     406                        actualIt->expr = nullptr;
     407                        cost += actualIt->cost;
     408                        ++actualIt;
     409                } else {
     410                        // End of actuals - Handle default values
     411                        if ( SingleInit *si = dynamic_cast<SingleInit *>( defaultValue )) {
     412                                // so far, only constant expressions are accepted as default values
     413                                if ( ConstantExpr *cnstexpr = dynamic_cast<ConstantExpr *>( si->get_value()) ) {
     414                                        if ( Constant *cnst = dynamic_cast<Constant *>( cnstexpr->get_constant() ) ) {
     415                                                if ( unify( formalType, cnst->get_type(), resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
     416                                                        // xxx - Don't know if this is right
     417                                                        *out++ = cnstexpr->clone();
     418                                                        return true;
     419                                                } // if
     420                                        } // if
     421                                } // if
     422                        } // if
     423                        return false;
     424                } // if
     425                return true;
     426        }
     427
     428        bool AlternativeFinder::instantiateFunction( std::list< DeclarationWithType* >& formals, const AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave, AltList & out ) {
    368429                simpleCombineEnvironments( actuals.begin(), actuals.end(), resultEnv );
    369430                // make sure we don't widen any existing bindings
     
    373434                resultEnv.extractOpenVars( openVars );
    374435
    375                 /*
    376                   Tuples::NameMatcher matcher( formals );
    377                   try {
    378                   matcher.match( actuals );
    379                   } catch ( Tuples::NoMatch &e ) {
    380                   std::cerr << "Alternative doesn't match: " << e.message << std::endl;
    381                   }
    382                 */
    383                 std::list< DeclarationWithType* >::iterator formal = formals.begin();
    384                 for ( AltList::const_iterator actualExpr = actuals.begin(); actualExpr != actuals.end(); ++actualExpr ) {
    385                         for ( std::list< Type* >::iterator actual = actualExpr->expr->get_results().begin(); actual != actualExpr->expr->get_results().end(); ++actual ) {
    386                                 if ( formal == formals.end() ) {
    387                                         return isVarArgs;
    388                                 }
    389                                 PRINT(
    390                                         std::cerr << "formal type is ";
    391                                         (*formal)->get_type()->print( std::cerr );
    392                                         std::cerr << std::endl << "actual type is ";
    393                                         (*actual)->print( std::cerr );
    394                                         std::cerr << std::endl;
    395                                 )
    396                                 if ( ! unify( (*formal)->get_type(), *actual, resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
    397                                         return false;
    398                                 }
    399                                 formal++;
    400                         }
    401                 }
    402                 // Handling of default values
    403                 while ( formal != formals.end() ) {
    404                         if ( ObjectDecl *od = dynamic_cast<ObjectDecl *>( *formal ) )
    405                                 if ( SingleInit *si = dynamic_cast<SingleInit *>( od->get_init() ))
    406                                         // so far, only constant expressions are accepted as default values
    407                                         if ( ConstantExpr *cnstexpr = dynamic_cast<ConstantExpr *>( si->get_value()) )
    408                                                 if ( Constant *cnst = dynamic_cast<Constant *>( cnstexpr->get_constant() ) )
    409                                                         if ( unify( (*formal)->get_type(), cnst->get_type(), resultEnv, resultNeed, resultHave, openVars, indexer ) ) {
    410                                                                 // XXX Don't know if this is right
    411                                                                 actuals.push_back( Alternative( cnstexpr->clone(), env, Cost::zero ) );
    412                                                                 formal++;
    413                                                                 if ( formal == formals.end()) break;
    414                                                         }
    415                         return false;
     436                // flatten actuals so that each actual has an atomic (non-tuple) type
     437                AltList exploded;
     438                Tuples::explode( actuals, indexer, back_inserter( exploded ) );
     439
     440                AltList::iterator actualExpr = exploded.begin();
     441                AltList::iterator actualEnd = exploded.end();
     442                for ( DeclarationWithType * formal : formals ) {
     443                        // match flattened actuals with formal parameters - actuals will be grouped to match
     444                        // with formals as appropriate
     445                        Cost cost;
     446                        std::list< Expression * > newExprs;
     447                        ObjectDecl * obj = safe_dynamic_cast< ObjectDecl * >( formal );
     448                        if ( ! instantiateArgument( obj->get_type(), obj->get_init(), actualExpr, actualEnd, openVars, resultEnv, resultNeed, resultHave, indexer, cost, back_inserter( newExprs ) ) ) {
     449                                deleteAll( newExprs );
     450                                return false;
     451                        }
     452                        // success - produce argument as a new alternative
     453                        assert( newExprs.size() == 1 );
     454                        out.push_back( Alternative( newExprs.front(), resultEnv, cost ) );
     455                }
     456                if ( actualExpr != actualEnd ) {
     457                        // there are still actuals remaining, but we've run out of formal parameters to match against
     458                        // this is okay only if the function is variadic
     459                        if ( ! isVarArgs ) {
     460                                return false;
     461                        }
     462                        out.splice( out.end(), exploded, actualExpr, actualEnd );
    416463                }
    417464                return true;
     
    500547                                //if ( newNeedParents[ curDecl->get_uniqueId() ][ candDecl->get_uniqueId() ]++ > recursionParentLimit ) continue;
    501548                                Expression *varExpr = new VariableExpr( candDecl );
    502                                 deleteAll( varExpr->get_results() );
    503                                 varExpr->get_results().clear();
    504                                 varExpr->get_results().push_front( adjType->clone() );
     549                                delete varExpr->get_result();
     550                                varExpr->set_result( adjType->clone() );
    505551                                PRINT(
    506552                                        std::cerr << "satisfying assertion " << curDecl->get_uniqueId() << " ";
     
    545591
    546592        template< typename OutputIterator >
    547         void AlternativeFinder::makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out ) {
     593        void AlternativeFinder::makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const AltList &actualAlt, OutputIterator out ) {
    548594                OpenVarSet openVars;
    549595                AssertionSet resultNeed, resultHave;
    550596                TypeEnvironment resultEnv;
    551597                makeUnifiableVars( funcType, openVars, resultNeed );
    552                 if ( instantiateFunction( funcType->get_parameters(), actualAlt, funcType->get_isVarArgs(), openVars, resultEnv, resultNeed, resultHave ) ) {
     598                AltList instantiatedActuals; // filled by instantiate function
     599                if ( instantiateFunction( funcType->get_parameters(), actualAlt, funcType->get_isVarArgs(), openVars, resultEnv, resultNeed, resultHave, instantiatedActuals ) ) {
    553600                        ApplicationExpr *appExpr = new ApplicationExpr( func.expr->clone() );
    554                         Alternative newAlt( appExpr, resultEnv, sumCost( actualAlt ) );
    555                         makeExprList( actualAlt, appExpr->get_args() );
     601                        Alternative newAlt( appExpr, resultEnv, sumCost( instantiatedActuals ) );
     602                        makeExprList( instantiatedActuals, appExpr->get_args() );
    556603                        PRINT(
    557604                                std::cerr << "need assertions:" << std::endl;
     
    574621                                PointerType pt( Type::Qualifiers(), v.clone() );
    575622                                UntypedExpr *vexpr = untypedExpr->clone();
    576                                 vexpr->get_results().push_front( pt.clone() );
     623                                vexpr->set_result( pt.clone() );
    577624                                alternatives.push_back( Alternative( vexpr, env, Cost()) );
    578625                                return;
     
    587634                combos( argAlternatives.begin(), argAlternatives.end(), back_inserter( possibilities ) );
    588635
    589                 Tuples::TupleAssignSpotter tassign( this );
    590                 if ( tassign.isTupleAssignment( untypedExpr, possibilities ) ) {
    591                         // take care of possible tuple assignments, or discard expression
    592                         return;
    593                 } // else ...
     636                // take care of possible tuple assignments
     637                // if not tuple assignment, assignment is taken care of as a normal function call
     638                Tuples::handleTupleAssignment( *this, untypedExpr, possibilities );
    594639
    595640                AltList candidates;
     
    604649                                // check if the type is pointer to function
    605650                                PointerType *pointer;
    606                                 if ( func->expr->get_results().size() == 1 && ( pointer = dynamic_cast< PointerType* >( func->expr->get_results().front() ) ) ) {
     651                                if ( ( pointer = dynamic_cast< PointerType* >( func->expr->get_result() ) ) ) {
    607652                                        if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
    608653                                                for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
     
    640685                                                // check if the type is pointer to function
    641686                                                PointerType *pointer;
    642                                                 if ( funcOp->expr->get_results().size() == 1
    643                                                         && ( pointer = dynamic_cast< PointerType* >( funcOp->expr->get_results().front() ) ) ) {
     687                                                if ( ( pointer = dynamic_cast< PointerType* >( funcOp->expr->get_result() ) ) ) {
    644688                                                        if ( FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ) ) {
    645689                                                                for ( std::list< AltList >::iterator actualAlt = possibilities.begin(); actualAlt != possibilities.end(); ++actualAlt ) {
     
    665709
    666710                        PRINT(
    667                                 ApplicationExpr *appExpr = dynamic_cast< ApplicationExpr* >( withFunc->expr );
    668                                 assert( appExpr );
    669                                 PointerType *pointer = dynamic_cast< PointerType* >( appExpr->get_function()->get_results().front() );
    670                                 assert( pointer );
    671                                 FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
    672                                 assert( function );
     711                                ApplicationExpr *appExpr = safe_dynamic_cast< ApplicationExpr* >( withFunc->expr );
     712                                PointerType *pointer = safe_dynamic_cast< PointerType* >( appExpr->get_function()->get_result() );
     713                                FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
    673714                                std::cerr << "Case +++++++++++++" << std::endl;
    674715                                std::cerr << "formals are:" << std::endl;
     
    692733
    693734        bool isLvalue( Expression *expr ) {
    694                 for ( std::list< Type* >::const_iterator i = expr->get_results().begin(); i != expr->get_results().end(); ++i ) {
    695                         if ( !(*i)->get_isLvalue() ) return false;
    696                 } // for
    697                 return true;
     735                // xxx - recurse into tuples?
     736                return expr->has_result() && expr->get_result()->get_isLvalue();
    698737        }
    699738
     
    709748
    710749        void AlternativeFinder::visit( CastExpr *castExpr ) {
    711                 for ( std::list< Type* >::iterator i = castExpr->get_results().begin(); i != castExpr->get_results().end(); ++i ) {
    712                         *i = resolveTypeof( *i, indexer );
    713                         SymTab::validateType( *i, &indexer );
    714                         adjustExprType( *i, env, indexer );
    715                 } // for
     750                Type *& toType = castExpr->get_result();
     751                toType = resolveTypeof( toType, indexer );
     752                SymTab::validateType( toType, &indexer );
     753                adjustExprType( toType, env, indexer );
    716754
    717755                AlternativeFinder finder( indexer, env );
     
    727765                        // that are cast directly.  The candidate is invalid if it has fewer results than there are types to cast
    728766                        // to.
    729                         int discardedValues = (*i).expr->get_results().size() - castExpr->get_results().size();
     767                        int discardedValues = (*i).expr->get_result()->size() - castExpr->get_result()->size();
    730768                        if ( discardedValues < 0 ) continue;
    731                         std::list< Type* >::iterator candidate_end = (*i).expr->get_results().begin();
    732                         std::advance( candidate_end, castExpr->get_results().size() );
     769                        // xxx - may need to go into tuple types and extract relavent types and use unifyList
    733770                        // unification run for side-effects
    734                         unifyList( castExpr->get_results().begin(), castExpr->get_results().end(),
    735                                            (*i).expr->get_results().begin(), candidate_end,
    736                                    i->env, needAssertions, haveAssertions, openVars, indexer );
    737                         Cost thisCost = castCostList( (*i).expr->get_results().begin(), candidate_end,
    738                                                                                   castExpr->get_results().begin(), castExpr->get_results().end(),
    739                                                                                   indexer, i->env );
     771                        unify( castExpr->get_result(), (*i).expr->get_result(), i->env, needAssertions, haveAssertions, openVars, indexer );
     772                        Cost thisCost = castCost( (*i).expr->get_result(), castExpr->get_result(), indexer, i->env );
    740773                        if ( thisCost != Cost::infinity ) {
    741774                                // count one safe conversion for each value that is thrown away
     
    760793
    761794                for ( AltList::const_iterator agg = funcFinder.alternatives.begin(); agg != funcFinder.alternatives.end(); ++agg ) {
    762                         if ( agg->expr->get_results().size() == 1 ) {
    763                                 if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_results().front() ) ) {
    764                                         addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
    765                                 } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_results().front() ) ) {
    766                                         addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
    767                                 } // if
     795                        if ( StructInstType *structInst = dynamic_cast< StructInstType* >( agg->expr->get_result() ) ) {
     796                                addAggMembers( structInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     797                        } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( agg->expr->get_result() ) ) {
     798                                addAggMembers( unionInst, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
     799                        } else if ( TupleType * tupleType = dynamic_cast< TupleType * >( agg->expr->get_result() ) ) {
     800                                addTupleMembers( tupleType, agg->expr, agg->cost, agg->env, memberExpr->get_member() );
    768801                        } // if
    769802                } // for
     
    791824                        renameTypes( alternatives.back().expr );
    792825                        if ( StructInstType *structInst = dynamic_cast< StructInstType* >( (*i)->get_type() ) ) {
    793                                 addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, "" );
     826                                NameExpr nameExpr( "" );
     827                                addAggMembers( structInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
    794828                        } else if ( UnionInstType *unionInst = dynamic_cast< UnionInstType* >( (*i)->get_type() ) ) {
    795                                 addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, "" );
     829                                NameExpr nameExpr( "" );
     830                                addAggMembers( unionInst, &newExpr, Cost( 0, 0, 1 ), env, &nameExpr );
    796831                        } // if
    797832                } // for
     
    894929                        alternatives.push_back( Alternative( new AttrExpr( new VariableExpr( funcDecl ), argType->clone() ), env, Cost::zero ) );
    895930                        for ( std::list< DeclarationWithType* >::iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
    896                                 alternatives.back().expr->get_results().push_back( (*i)->get_type()->clone() );
     931                                alternatives.back().expr->set_result( (*i)->get_type()->clone() );
    897932                        } // for
    898933                } // if
     
    917952                                                        finder.find( attrExpr->get_expr() );
    918953                                                        for ( AltList::iterator choice = finder.alternatives.begin(); choice != finder.alternatives.end(); ++choice ) {
    919                                                                 if ( choice->expr->get_results().size() == 1 ) {
    920                                                                         resolveAttr(*i, function, choice->expr->get_results().front(), choice->env );
     954                                                                if ( choice->expr->get_result()->size() == 1 ) {
     955                                                                        resolveAttr(*i, function, choice->expr->get_result(), choice->env );
    921956                                                                } // fi
    922957                                                        } // for
     
    960995                                        AssertionSet needAssertions, haveAssertions;
    961996                                        Alternative newAlt( 0, third->env, first->cost + second->cost + third->cost );
    962                                         std::list< Type* > commonTypes;
    963                                         if ( unifyList( second->expr->get_results().begin(), second->expr->get_results().end(), third->expr->get_results().begin(), third->expr->get_results().end(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonTypes ) ) {
     997                                        Type* commonType;
     998                                        if ( unify( second->expr->get_result(), third->expr->get_result(), newAlt.env, needAssertions, haveAssertions, openVars, indexer, commonType ) ) {
    964999                                                ConditionalExpr *newExpr = new ConditionalExpr( first->expr->clone(), second->expr->clone(), third->expr->clone() );
    965                                                 std::list< Type* >::const_iterator original = second->expr->get_results().begin();
    966                                                 std::list< Type* >::const_iterator commonType = commonTypes.begin();
    967                                                 for ( ; original != second->expr->get_results().end() && commonType != commonTypes.end(); ++original, ++commonType ) {
    968                                                         if ( *commonType ) {
    969                                                                 newExpr->get_results().push_back( *commonType );
    970                                                         } else {
    971                                                                 newExpr->get_results().push_back( (*original)->clone() );
    972                                                         } // if
    973                                                 } // for
     1000                                                newExpr->set_result( commonType ? commonType : second->expr->get_result()->clone() );
    9741001                                                newAlt.expr = newExpr;
    9751002                                                inferParameters( needAssertions, haveAssertions, newAlt, openVars, back_inserter( alternatives ) );
     
    9991026                        TupleExpr *newExpr = new TupleExpr;
    10001027                        makeExprList( *i, newExpr->get_exprs() );
    1001                         for ( std::list< Expression* >::const_iterator resultExpr = newExpr->get_exprs().begin(); resultExpr != newExpr->get_exprs().end(); ++resultExpr ) {
    1002                                 for ( std::list< Type* >::const_iterator resultType = (*resultExpr)->get_results().begin(); resultType != (*resultExpr)->get_results().end(); ++resultType ) {
    1003                                         newExpr->get_results().push_back( (*resultType)->clone() );
    1004                                 } // for
    1005                         } // for
     1028                        newExpr->set_result( Tuples::makeTupleType( newExpr->get_exprs() ) );
    10061029
    10071030                        TypeEnvironment compositeEnv;
     
    10241047                }
    10251048        }
     1049
     1050        void AlternativeFinder::visit( TupleIndexExpr *tupleExpr ) {
     1051                alternatives.push_back( Alternative( tupleExpr->clone(), env, Cost::zero ) );
     1052        }
     1053
     1054        void AlternativeFinder::visit( TupleAssignExpr *tupleAssignExpr ) {
     1055                alternatives.push_back( Alternative( tupleAssignExpr->clone(), env, Cost::zero ) );
     1056        }
     1057
     1058        void AlternativeFinder::visit( UniqueExpr *unqExpr ) {
     1059                // this won't work because the unqExprs wont share an expression anymore...
     1060                AlternativeFinder finder( indexer, env );
     1061                finder.findWithAdjustment( unqExpr->get_expr() );
     1062                for ( Alternative & alt : finder.alternatives ) {
     1063                        // xxx - attach a resolved ConstructorInit node?
     1064                        // xxx - is it possible to make the objDecl's type const?
     1065                        static UniqueName tempNamer( "_unq_expr_" );
     1066                        ObjectDecl * objDecl = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, alt.expr->get_result()->clone(), nullptr );
     1067                        // must be done on two lines because genCtorInit accesses objDecl's fields
     1068                        objDecl->set_init( InitTweak::genCtorInit( objDecl ) );
     1069
     1070                        UniqueExpr * newUnqExpr = new UniqueExpr( alt.expr->clone(), unqExpr->get_id() );
     1071                        newUnqExpr->set_object( objDecl );
     1072
     1073                        resolveObject( indexer, objDecl );
     1074
     1075                        alternatives.push_back( Alternative( newUnqExpr, env, Cost::zero ) );
     1076                }
     1077        }
     1078
    10261079} // namespace ResolvExpr
    10271080
  • src/ResolvExpr/AlternativeFinder.h

    r47a8d17 r3f0c6a5  
    6767                virtual void visit( ImplicitCopyCtorExpr * impCpCtorExpr );
    6868                virtual void visit( ConstructorExpr * ctorExpr );
    69           public:  // xxx - temporary hack - should make Tuples::TupleAssignment a friend
     69                virtual void visit( TupleIndexExpr *tupleExpr );
     70                virtual void visit( TupleAssignExpr *tupleExpr );
     71                virtual void visit( UniqueExpr *unqExpr );
     72                /// Runs a new alternative finder on each element in [begin, end)
     73                /// and writes each alternative finder to out.
    7074                template< typename InputIterator, typename OutputIterator >
    7175                void findSubExprs( InputIterator begin, InputIterator end, OutputIterator out );
    7276
    73           private:
    7477                /// Adds alternatives for member expressions, given the aggregate, conversion cost for that aggregate, and name of the member
    75                 template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, const std::string &name );
     78                template< typename StructOrUnionType > void addAggMembers( StructOrUnionType *aggInst, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
     79                /// Adds alternatives for member expressions where the left side has tuple type
     80                void addTupleMembers( TupleType * tupleType, Expression *expr, const Cost &newCost, const TypeEnvironment & env, Expression * member );
    7681                /// Adds alternatives for offsetof expressions, given the base type and name of the member
    7782                template< typename StructOrUnionType > void addOffsetof( StructOrUnionType *aggInst, const std::string &name );
    78                 bool instantiateFunction( std::list< DeclarationWithType* >& formals, /*const*/ AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave );
     83                bool instantiateFunction( std::list< DeclarationWithType* >& formals, const AltList &actuals, bool isVarArgs, OpenVarSet& openVars, TypeEnvironment &resultEnv, AssertionSet &resultNeed, AssertionSet &resultHave, AltList & out );
    7984                template< typename OutputIterator >
    80                 void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, AltList &actualAlt, OutputIterator out );
     85                void makeFunctionAlternatives( const Alternative &func, FunctionType *funcType, const AltList &actualAlt, OutputIterator out );
    8186                template< typename OutputIterator >
    8287                void inferParameters( const AssertionSet &need, AssertionSet &have, const Alternative &newAlt, OpenVarSet &openVars, OutputIterator out );
     
    8994
    9095        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
     96
     97        void resolveObject( const SymTab::Indexer & indexer, ObjectDecl * objectDecl );
     98
     99        template< typename InputIterator, typename OutputIterator >
     100        void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
     101                AltList alternatives;
     102
     103                // select the alternatives that have the minimum parameter cost
     104                Cost minCost = Cost::infinity;
     105                for ( InputIterator i = begin; i != end; ++i ) {
     106                        if ( i->cost < minCost ) {
     107                                minCost = i->cost;
     108                                i->cost = i->cvtCost;
     109                                alternatives.clear();
     110                                alternatives.push_back( *i );
     111                        } else if ( i->cost == minCost ) {
     112                                i->cost = i->cvtCost;
     113                                alternatives.push_back( *i );
     114                        }
     115                }
     116                std::copy( alternatives.begin(), alternatives.end(), out );
     117        }
     118
     119        Cost sumCost( const AltList &in );
     120
     121        template< typename InputIterator >
     122        void simpleCombineEnvironments( InputIterator begin, InputIterator end, TypeEnvironment &result ) {
     123                while ( begin != end ) {
     124                        result.simpleCombine( (*begin++).env );
     125                }
     126        }
    91127} // namespace ResolvExpr
    92128
  • src/ResolvExpr/AlternativePrinter.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // AlternativePrinter.cc -- 
     7// AlternativePrinter.cc --
    88//
    99// Author           : Richard C. Bilson
     
    3333                for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
    3434                        os << "Alternative " << count++ << " ==============" << std::endl;
    35                         printAll( i->expr->get_results(), os );
     35                        i->expr->get_result()->print( os );
    3636                        //    i->print( os );
    3737                        os << std::endl;
  • src/ResolvExpr/ConversionCost.cc

    r47a8d17 r3f0c6a5  
    240240                        std::list< Type* >::const_iterator srcIt = tupleType->get_types().begin();
    241241                        std::list< Type* >::const_iterator destIt = destAsTuple->get_types().begin();
    242                         while ( srcIt != tupleType->get_types().end() ) {
     242                        while ( srcIt != tupleType->get_types().end() && destIt != destAsTuple->get_types().end() ) {
    243243                                Cost newCost = conversionCost( *srcIt++, *destIt++, indexer, env );
    244244                                if ( newCost == Cost::infinity ) {
  • src/ResolvExpr/FindOpenVars.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // FindOpenVars.cc -- 
     7// FindOpenVars.cc --
    88//
    99// Author           : Richard C. Bilson
     
    4747        void FindOpenVars::common_action( Type *type ) {
    4848                if ( nextIsOpen ) {
    49                         for ( std::list< TypeDecl* >::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     49                        for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    5050                                openVars[ (*i)->get_name() ] = (*i)->get_kind();
    5151                                for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
     
    5656                        }
    5757                } else {
    58                         for ( std::list< TypeDecl* >::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     58                        for ( Type::ForallList::const_iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    5959                                closedVars[ (*i)->get_name() ] = (*i)->get_kind();
    6060                                for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) {
  • src/ResolvExpr/RenameVars.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // RenameVars.cc -- 
     7// RenameVars.cc --
    88//
    99// Author           : Richard C. Bilson
     
    125125                        mapStack.push_front( mapStack.front() );
    126126                        // renames all "forall" type names to `_${level}_${name}'
    127                         for ( std::list< TypeDecl* >::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     127                        for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    128128                                std::ostringstream output;
    129129                                output << "_" << level << "_" << (*i)->get_name();
  • src/ResolvExpr/ResolveTypeof.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ResolveTypeof.cc -- 
     7// ResolveTypeof.cc --
    88//
    99// Author           : Richard C. Bilson
     
    5858                if ( typeofType->get_expr() ) {
    5959                        Expression *newExpr = resolveInVoidContext( typeofType->get_expr(), indexer );
    60                         assert( newExpr->get_results().size() > 0 );
    61                         Type *newType;
    62                         if ( newExpr->get_results().size() > 1 ) {
    63                                 TupleType *tupleType = new TupleType( Type::Qualifiers() );
    64                                 cloneAll( newExpr->get_results(), tupleType->get_types() );
    65                                 newType = tupleType;
    66                         } else {
    67                                 newType = newExpr->get_results().front()->clone();
    68                         } // if
     60                        assert( newExpr->has_result() && ! newExpr->get_result()->isVoid() );
     61                        Type *newType = newExpr->get_result();
    6962                        delete typeofType;
    7063                        return newType;
  • src/ResolvExpr/Resolver.cc

    r47a8d17 r3f0c6a5  
    1919#include "RenameVars.h"
    2020#include "ResolveTypeof.h"
     21#include "typeops.h"
    2122#include "SynTree/Statement.h"
    2223#include "SynTree/Type.h"
     
    3435        class Resolver : public SymTab::Indexer {
    3536          public:
    36                 Resolver() : SymTab::Indexer( false ), switchType( 0 ) {}
     37                Resolver() : SymTab::Indexer( false ) {}
     38                Resolver( const SymTab::Indexer & indexer ) : SymTab::Indexer( indexer ) {}
    3739
    3840                virtual void visit( FunctionDecl *functionDecl );
    39                 virtual void visit( ObjectDecl *functionDecl );
     41                virtual void visit( ObjectDecl *objectDecl );
    4042                virtual void visit( TypeDecl *typeDecl );
    4143                virtual void visit( EnumDecl * enumDecl );
     
    6769          void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator & );
    6870          void fallbackInit( ConstructorInit * ctorInit );
    69                 std::list< Type * > functionReturn;
    70                 Type *initContext;
    71                 Type *switchType;
     71                Type * functionReturn = nullptr;
     72                Type *initContext = nullptr;
     73                Type *switchType = nullptr;
    7274                bool inEnumDecl = false;
    7375        };
     
    157159                        const TypeEnvironment *newEnv = 0;
    158160                        for ( AltList::const_iterator i = finder.get_alternatives().begin(); i != finder.get_alternatives().end(); ++i ) {
    159                                 if ( i->expr->get_results().size() == 1 && isIntegralType( i->expr->get_results().front() ) ) {
     161                                if ( i->expr->get_result()->size() == 1 && isIntegralType( i->expr->get_result() ) ) {
    160162                                        if ( newExpr ) {
    161163                                                throw SemanticError( "Too many interpretations for case control expression", untyped );
     
    234236                Type *new_type = resolveTypeof( functionDecl->get_type(), *this );
    235237                functionDecl->set_type( new_type );
    236                 std::list< Type * > oldFunctionReturn = functionReturn;
    237                 functionReturn.clear();
    238                 for ( std::list< DeclarationWithType * >::const_iterator i = functionDecl->get_functionType()->get_returnVals().begin(); i != functionDecl->get_functionType()->get_returnVals().end(); ++i ) {
    239                         functionReturn.push_back( (*i)->get_type() );
    240                 } // for
     238                ValueGuard< Type * > oldFunctionReturn( functionReturn );
     239                functionReturn = ResolvExpr::extractResultType( functionDecl->get_functionType() );
    241240                SymTab::Indexer::visit( functionDecl );
    242                 functionReturn = oldFunctionReturn;
    243241        }
    244242
     
    338336        void Resolver::visit( ReturnStmt *returnStmt ) {
    339337                if ( returnStmt->get_expr() ) {
    340                         CastExpr *castExpr = new CastExpr( returnStmt->get_expr() );
    341                         cloneAll( functionReturn, castExpr->get_results() );
     338                        CastExpr *castExpr = new CastExpr( returnStmt->get_expr(), functionReturn->clone() );
    342339                        Expression *newExpr = findSingleExpression( castExpr, *this );
    343340                        delete castExpr;
     
    384381                                if ( isCharType( at->get_base() ) ) {
    385382                                        // check if the resolved type is char *
    386                                         if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_results().front() ) ) {
     383                                        if ( PointerType * pt = dynamic_cast< PointerType *>( newExpr->get_result() ) ) {
    387384                                                if ( isCharType( pt->get_base() ) ) {
    388385                                                        // strip cast if we're initializing a char[] with a char *, e.g.  char x[] = "hello";
     
    446443                                (*iter)->accept( *this );
    447444                        } // for
     445                } else if ( TupleType * tt = dynamic_cast< TupleType * > ( initContext ) ) {
     446                        for ( Type * t : *tt ) {
     447                                if ( iter == end ) break;
     448                                initContext = t;
     449                                (*iter++)->accept( *this );
     450                        }
    448451                } else if ( StructInstType * st = dynamic_cast< StructInstType * >( initContext ) ) {
    449452                        resolveAggrInit( st->get_baseStruct(), iter, end );
     
    530533        }
    531534
     535        void resolveObject( const SymTab::Indexer & indexer, ObjectDecl * objectDecl ) {
     536                Resolver resolver( indexer );
     537                objectDecl->accept( resolver );
     538        }
     539
    532540        void Resolver::visit( ConstructorInit *ctorInit ) {
    533541                // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit
  • src/ResolvExpr/TypeEnvironment.cc

    r47a8d17 r3f0c6a5  
    158158        }
    159159
    160         void TypeEnvironment::add( const std::list< TypeDecl* > &tyDecls ) {
    161                 for ( std::list< TypeDecl* >::const_iterator i = tyDecls.begin(); i != tyDecls.end(); ++i ) {
     160        void TypeEnvironment::add( const Type::ForallList &tyDecls ) {
     161                for ( Type::ForallList::const_iterator i = tyDecls.begin(); i != tyDecls.end(); ++i ) {
    162162                        EqvClass newClass;
    163163                        newClass.vars.insert( (*i)->get_name() );
  • src/ResolvExpr/TypeEnvironment.h

    r47a8d17 r3f0c6a5  
    5555                bool lookup( const std::string &var, EqvClass &eqvClass ) const;
    5656                void add( const EqvClass &eqvClass );
    57                 void add( const std::list< TypeDecl* > &tyDecls );
     57                void add( const Type::ForallList &tyDecls );
    5858                template< typename SynTreeClass > int apply( SynTreeClass *&type ) const;
    5959                template< typename SynTreeClass > int applyFree( SynTreeClass *&type ) const;
  • src/ResolvExpr/Unify.cc

    r47a8d17 r3f0c6a5  
    598598        }
    599599
     600        // xxx - compute once and store in the FunctionType?
     601        Type * extractResultType( FunctionType * function ) {
     602                if ( function->get_returnVals().size() == 0 ) {
     603                        return new VoidType( Type::Qualifiers() );
     604                } else if ( function->get_returnVals().size() == 1 ) {
     605                        return function->get_returnVals().front()->get_type()->clone();
     606                } else {
     607                        TupleType * tupleType = new TupleType( Type::Qualifiers() );
     608                        for ( DeclarationWithType * decl : function->get_returnVals() ) {
     609                                tupleType->get_types().push_back( decl->get_type()->clone() );
     610                        } // for
     611                        return tupleType;
     612                }
     613        }
    600614} // namespace ResolvExpr
    601615
  • src/ResolvExpr/typeops.h

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // typeops.h -- 
     7// typeops.h --
    88//
    99// Author           : Richard C. Bilson
     
    3030                typedef typename InputIterator::value_type SetType;
    3131                typedef typename std::list< typename SetType::value_type > ListType;
    32  
     32
    3333                if ( begin == end )     {
    3434                        *out++ = ListType();
    3535                        return;
    3636                } // if
    37  
     37
    3838                InputIterator current = begin;
    3939                begin++;
     
    4141                std::list< ListType > recursiveResult;
    4242                combos( begin, end, back_inserter( recursiveResult ) );
    43  
     43
    4444                for ( typename std::list< ListType >::const_iterator i = recursiveResult.begin(); i != recursiveResult.end(); ++i ) {
    4545                        for ( typename ListType::const_iterator j = current->begin(); j != current->end(); ++j ) {
     
    5252                } // for
    5353        }
    54  
     54
    5555        // in AdjustExprType.cc
    5656        /// Replaces array types with the equivalent pointer, and function types with a pointer-to-function
     
    144144        }
    145145
     146        /// creates the type represented by the list of returnVals in a FunctionType. The caller owns the return value.
     147        Type * extractResultType( FunctionType * functionType );
     148
    146149        // in CommonType.cc
    147150        Type *commonType( Type *type1, Type *type2, bool widenFirst, bool widenSecond, const SymTab::Indexer &indexer, TypeEnvironment &env, const OpenVarSet &openVars );
     
    152155        // in Occurs.cc
    153156        bool occurs( Type *type, std::string varName, const TypeEnvironment &env );
     157
     158        // flatten tuple type into list of types
     159        template< typename OutputIterator >
     160        void flatten( Type * type, OutputIterator out ) {
     161                if ( TupleType * tupleType = dynamic_cast< TupleType * >( type ) ) {
     162                        for ( Type * t : tupleType->get_types() ) {
     163                                flatten( t, out );
     164                        }
     165                } else {
     166                        *out++ = type;
     167                }
     168        }
    154169} // namespace ResolvExpr
    155170
  • src/SymTab/Autogen.cc

    r47a8d17 r3f0c6a5  
    116116                // This happens before function pointer type conversion, so need to do it manually here
    117117                VariableExpr * assignVarExpr = new VariableExpr( assignDecl );
    118                 Type *& assignVarExprType = assignVarExpr->get_results().front();
     118                Type * assignVarExprType = assignVarExpr->get_result();
    119119                assignVarExprType = new PointerType( Type::Qualifiers(), assignVarExprType );
     120                assignVarExpr->set_result( assignVarExprType );
    120121                ApplicationExpr * assignExpr = new ApplicationExpr( assignVarExpr );
    121122                assignExpr->get_args().push_back( new VariableExpr( dstParam ) );
  • src/SymTab/Indexer.cc

    r47a8d17 r3f0c6a5  
    4040
    4141namespace SymTab {
    42         template< typename Container, typename VisitorType >
    43         inline void acceptAllNewScope( Container &container, VisitorType &visitor ) {
     42        template< typename TreeType, typename VisitorType >
     43        inline void acceptNewScope( TreeType *tree, VisitorType &visitor ) {
    4444                visitor.enterScope();
    45                 acceptAll( container, visitor );
     45                maybeAccept( tree, visitor );
    4646                visitor.leaveScope();
    4747        }
     
    143143                for ( DeclarationWithType * decl : copy ) {
    144144                        if ( FunctionDecl * function = dynamic_cast< FunctionDecl * >( decl ) ) {
    145                                 std::list< DeclarationWithType * > params = function->get_functionType()->get_parameters();
     145                                std::list< DeclarationWithType * > & params = function->get_functionType()->get_parameters();
    146146                                assert( ! params.empty() );
    147147                                // use base type of pointer, so that qualifiers on the pointer type aren't considered.
     
    337337
    338338        void Indexer::visit( ApplicationExpr *applicationExpr ) {
    339                 acceptAllNewScope( applicationExpr->get_results(), *this );
     339                acceptNewScope( applicationExpr->get_result(), *this );
    340340                maybeAccept( applicationExpr->get_function(), *this );
    341341                acceptAll( applicationExpr->get_args(), *this );
     
    343343
    344344        void Indexer::visit( UntypedExpr *untypedExpr ) {
    345                 acceptAllNewScope( untypedExpr->get_results(), *this );
     345                acceptNewScope( untypedExpr->get_result(), *this );
    346346                acceptAll( untypedExpr->get_args(), *this );
    347347        }
    348348
    349349        void Indexer::visit( NameExpr *nameExpr ) {
    350                 acceptAllNewScope( nameExpr->get_results(), *this );
     350                acceptNewScope( nameExpr->get_result(), *this );
    351351        }
    352352
    353353        void Indexer::visit( AddressExpr *addressExpr ) {
    354                 acceptAllNewScope( addressExpr->get_results(), *this );
     354                acceptNewScope( addressExpr->get_result(), *this );
    355355                maybeAccept( addressExpr->get_arg(), *this );
    356356        }
    357357
    358358        void Indexer::visit( LabelAddressExpr *labAddressExpr ) {
    359                 acceptAllNewScope( labAddressExpr->get_results(), *this );
     359                acceptNewScope( labAddressExpr->get_result(), *this );
    360360                maybeAccept( labAddressExpr->get_arg(), *this );
    361361        }
    362362
    363363        void Indexer::visit( CastExpr *castExpr ) {
    364                 acceptAllNewScope( castExpr->get_results(), *this );
     364                acceptNewScope( castExpr->get_result(), *this );
    365365                maybeAccept( castExpr->get_arg(), *this );
    366366        }
    367367
    368368        void Indexer::visit( UntypedMemberExpr *memberExpr ) {
    369                 acceptAllNewScope( memberExpr->get_results(), *this );
     369                acceptNewScope( memberExpr->get_result(), *this );
    370370                maybeAccept( memberExpr->get_aggregate(), *this );
    371371        }
    372372
    373373        void Indexer::visit( MemberExpr *memberExpr ) {
    374                 acceptAllNewScope( memberExpr->get_results(), *this );
     374                acceptNewScope( memberExpr->get_result(), *this );
    375375                maybeAccept( memberExpr->get_aggregate(), *this );
    376376        }
    377377
    378378        void Indexer::visit( VariableExpr *variableExpr ) {
    379                 acceptAllNewScope( variableExpr->get_results(), *this );
     379                acceptNewScope( variableExpr->get_result(), *this );
    380380        }
    381381
    382382        void Indexer::visit( ConstantExpr *constantExpr ) {
    383                 acceptAllNewScope( constantExpr->get_results(), *this );
     383                acceptNewScope( constantExpr->get_result(), *this );
    384384                maybeAccept( constantExpr->get_constant(), *this );
    385385        }
    386386
    387387        void Indexer::visit( SizeofExpr *sizeofExpr ) {
    388                 acceptAllNewScope( sizeofExpr->get_results(), *this );
     388                acceptNewScope( sizeofExpr->get_result(), *this );
    389389                if ( sizeofExpr->get_isType() ) {
    390390                        maybeAccept( sizeofExpr->get_type(), *this );
     
    395395
    396396        void Indexer::visit( AlignofExpr *alignofExpr ) {
    397                 acceptAllNewScope( alignofExpr->get_results(), *this );
     397                acceptNewScope( alignofExpr->get_result(), *this );
    398398                if ( alignofExpr->get_isType() ) {
    399399                        maybeAccept( alignofExpr->get_type(), *this );
     
    404404
    405405        void Indexer::visit( UntypedOffsetofExpr *offsetofExpr ) {
    406                 acceptAllNewScope( offsetofExpr->get_results(), *this );
     406                acceptNewScope( offsetofExpr->get_result(), *this );
    407407                maybeAccept( offsetofExpr->get_type(), *this );
    408408        }
    409409
    410410        void Indexer::visit( OffsetofExpr *offsetofExpr ) {
    411                 acceptAllNewScope( offsetofExpr->get_results(), *this );
     411                acceptNewScope( offsetofExpr->get_result(), *this );
    412412                maybeAccept( offsetofExpr->get_type(), *this );
    413413                maybeAccept( offsetofExpr->get_member(), *this );
     
    415415
    416416        void Indexer::visit( OffsetPackExpr *offsetPackExpr ) {
    417                 acceptAllNewScope( offsetPackExpr->get_results(), *this );
     417                acceptNewScope( offsetPackExpr->get_result(), *this );
    418418                maybeAccept( offsetPackExpr->get_type(), *this );
    419419        }
    420420
    421421        void Indexer::visit( AttrExpr *attrExpr ) {
    422                 acceptAllNewScope( attrExpr->get_results(), *this );
     422                acceptNewScope( attrExpr->get_result(), *this );
    423423                if ( attrExpr->get_isType() ) {
    424424                        maybeAccept( attrExpr->get_type(), *this );
     
    429429
    430430        void Indexer::visit( LogicalExpr *logicalExpr ) {
    431                 acceptAllNewScope( logicalExpr->get_results(), *this );
     431                acceptNewScope( logicalExpr->get_result(), *this );
    432432                maybeAccept( logicalExpr->get_arg1(), *this );
    433433                maybeAccept( logicalExpr->get_arg2(), *this );
     
    435435
    436436        void Indexer::visit( ConditionalExpr *conditionalExpr ) {
    437                 acceptAllNewScope( conditionalExpr->get_results(), *this );
     437                acceptNewScope( conditionalExpr->get_result(), *this );
    438438                maybeAccept( conditionalExpr->get_arg1(), *this );
    439439                maybeAccept( conditionalExpr->get_arg2(), *this );
     
    442442
    443443        void Indexer::visit( CommaExpr *commaExpr ) {
    444                 acceptAllNewScope( commaExpr->get_results(), *this );
     444                acceptNewScope( commaExpr->get_result(), *this );
    445445                maybeAccept( commaExpr->get_arg1(), *this );
    446446                maybeAccept( commaExpr->get_arg2(), *this );
     
    448448
    449449        void Indexer::visit( TupleExpr *tupleExpr ) {
    450                 acceptAllNewScope( tupleExpr->get_results(), *this );
     450                acceptNewScope( tupleExpr->get_result(), *this );
    451451                acceptAll( tupleExpr->get_exprs(), *this );
    452452        }
    453453
    454         void Indexer::visit( SolvedTupleExpr *tupleExpr ) {
    455                 acceptAllNewScope( tupleExpr->get_results(), *this );
    456                 acceptAll( tupleExpr->get_exprs(), *this );
     454        void Indexer::visit( TupleAssignExpr *tupleExpr ) {
     455                acceptNewScope( tupleExpr->get_result(), *this );
     456                enterScope();
     457                acceptAll( tupleExpr->get_tempDecls(), *this );
     458                acceptAll( tupleExpr->get_assigns(), *this );
     459                leaveScope();
    457460        }
    458461
    459462        void Indexer::visit( TypeExpr *typeExpr ) {
    460                 acceptAllNewScope( typeExpr->get_results(), *this );
     463                acceptNewScope( typeExpr->get_result(), *this );
    461464                maybeAccept( typeExpr->get_type(), *this );
    462465        }
     
    469472
    470473        void Indexer::visit( UntypedValofExpr *valofExpr ) {
    471                 acceptAllNewScope( valofExpr->get_results(), *this );
     474                acceptNewScope( valofExpr->get_result(), *this );
    472475                maybeAccept( valofExpr->get_body(), *this );
    473476        }
  • src/SymTab/Indexer.h

    r47a8d17 r3f0c6a5  
    6464                virtual void visit( ConditionalExpr *conditionalExpr );
    6565                virtual void visit( CommaExpr *commaExpr );
    66                 virtual void visit( TupleExpr *tupleExpr );
    67                 virtual void visit( SolvedTupleExpr *tupleExpr );
    6866                virtual void visit( TypeExpr *typeExpr );
    6967                virtual void visit( AsmExpr *asmExpr );
    7068                virtual void visit( UntypedValofExpr *valofExpr );
     69                virtual void visit( TupleExpr *tupleExpr );
     70                virtual void visit( TupleAssignExpr *tupleExpr );
    7171
    7272                virtual void visit( TraitInstType *contextInst );
  • src/SymTab/Mangler.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // Mangler.cc -- 
     7// Mangler.cc --
    88//
    99// Author           : Richard C. Bilson
     
    3535                return mangler.get_mangleName();
    3636        }
    37        
     37
    3838        Mangler::Mangler( bool mangleOverridable, bool typeMode )
    3939                : nextVarNum( 0 ), isTopLevel( true ), mangleOverridable( mangleOverridable ), typeMode( typeMode ) {}
    40                
     40
    4141        Mangler::Mangler( const Mangler &rhs ) : mangleName() {
    4242                varNums = rhs.varNums;
     
    115115                        "Ir",   // LongDoubleImaginary
    116116                };
    117  
     117
    118118                printQualifiers( basicType );
    119119                mangleName << btLetter[ basicType->get_kind() ];
     
    253253                // skip if not including qualifiers
    254254                if ( typeMode ) return;
    255                
     255
    256256                if ( ! type->get_forall().empty() ) {
    257257                        std::list< std::string > assertionNames;
    258258                        int tcount = 0, dcount = 0, fcount = 0;
    259259                        mangleName << "A";
    260                         for ( std::list< TypeDecl* >::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
     260                        for ( Type::ForallList::iterator i = type->get_forall().begin(); i != type->get_forall().end(); ++i ) {
    261261                                switch ( (*i)->get_kind() ) {
    262262                                  case TypeDecl::Any:
  • src/SymTab/Validate.cc

    r47a8d17 r3f0c6a5  
    2323// - All enumeration constants have type EnumInstType.
    2424//
    25 // - The type "void" never occurs in lists of function parameter or return types; neither do tuple types.  A function
    26 //   taking no arguments has no argument types, and tuples are flattened.
     25// - The type "void" never occurs in lists of function parameter or return types.  A function
     26//   taking no arguments has no argument types.
    2727//
    2828// - No context instances exist; they are all replaced by the set of declarations signified by the context, instantiated
     
    429429        /// Fix up assertions
    430430        void forallFixer( Type *func ) {
    431                 for ( std::list< TypeDecl * >::iterator type = func->get_forall().begin(); type != func->get_forall().end(); ++type ) {
     431                for ( Type::ForallList::iterator type = func->get_forall().begin(); type != func->get_forall().end(); ++type ) {
    432432                        std::list< DeclarationWithType * > toBeDone, nextRound;
    433433                        toBeDone.splice( toBeDone.end(), (*type )->get_assertions() );
  • src/SynTree/AddressExpr.cc

    r47a8d17 r3f0c6a5  
    1919
    2020AddressExpr::AddressExpr( Expression *arg, Expression *_aname ) : Expression( _aname ), arg( arg ) {
    21         for ( std::list< Type* >::const_iterator i = arg->get_results().begin(); i != arg->get_results().end(); ++i ) {
    22                 get_results().push_back( new PointerType( Type::Qualifiers(), (*i)->clone() ) );
    23         } // for
     21        if ( arg->has_result() ) {
     22                set_result( new PointerType( Type::Qualifiers(), arg->get_result()->clone() ) );
     23        }
    2424}
    2525
     
    3535        if ( arg ) {
    3636                os << std::string( indent+2, ' ' );
    37     arg->print( os, indent+2 );
     37                arg->print( os, indent+2 );
    3838        } // if
    3939}
  • src/SynTree/ApplicationExpr.cc

    r47a8d17 r3f0c6a5  
    2121#include "TypeSubstitution.h"
    2222#include "Common/utility.h"
    23 
     23#include "ResolvExpr/typeops.h"
    2424
    2525ParamEntry::ParamEntry( const ParamEntry &other ) :
     
    4343
    4444ApplicationExpr::ApplicationExpr( Expression *funcExpr ) : function( funcExpr ) {
    45         PointerType *pointer = dynamic_cast< PointerType* >( funcExpr->get_results().front() );
    46         assert( pointer );
    47         FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() );
    48         assert( function );
     45        PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() );
     46        FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() );
    4947
    50         for ( std::list< DeclarationWithType* >::const_iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {
    51                 get_results().push_back( (*i)->get_type()->clone() );
    52         } // for
     48        set_result( ResolvExpr::extractResultType( function ) );
     49
     50        assert( has_result() );
    5351}
    5452
  • src/SynTree/CommaExpr.cc

    r47a8d17 r3f0c6a5  
    2323        // to false on all result types. Actually doing this causes some strange things
    2424        // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into.
    25         cloneAll( arg2->get_results(), get_results() );
    26         // for ( Type *& type : get_results() ) {
    27         //      type->set_isLvalue( false );
    28         // }
     25        set_result( maybeClone( arg2->get_result() ) );
     26        // get_type->set_isLvalue( false );
    2927}
    3028
  • src/SynTree/Expression.cc

    r47a8d17 r3f0c6a5  
    3131
    3232
    33 Expression::Expression( Expression *_aname ) : env( 0 ), argName( _aname ) {}
    34 
    35 Expression::Expression( const Expression &other ) : env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) {
    36         cloneAll( other.results, results );
     33Expression::Expression( Expression *_aname ) : result( 0 ), env( 0 ), argName( _aname ) {}
     34
     35Expression::Expression( const Expression &other ) : result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) {
    3736}
    3837
     
    4039        delete env;
    4140        delete argName; // xxx -- there's a problem in cloning ConstantExpr I still don't know how to fix
    42         deleteAll( results );
    43 }
    44 
    45 void Expression::add_result( Type *t ) {
    46         if ( TupleType *tuple = dynamic_cast< TupleType* >( t ) ) {
    47                 std::copy( tuple->get_types().begin(), tuple->get_types().end(), back_inserter( results ) );
    48         } else {
    49                 results.push_back(t);
    50         } // if
     41        delete result;
    5142}
    5243
     
    6859
    6960ConstantExpr::ConstantExpr( Constant _c, Expression *_aname ) : Expression( _aname ), constant( _c ) {
    70         add_result( constant.get_type()->clone() );
     61        set_result( constant.get_type()->clone() );
    7162}
    7263
     
    8576        assert( var );
    8677        assert( var->get_type() );
    87         add_result( var->get_type()->clone() );
    88         for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
    89                 (*i)->set_isLvalue( true );
    90         } // for
     78        Type * type = var->get_type()->clone();
     79        type->set_isLvalue( true );
     80        set_result( type );
    9181}
    9282
     
    110100SizeofExpr::SizeofExpr( Expression *expr_, Expression *_aname ) :
    111101                Expression( _aname ), expr(expr_), type(0), isType(false) {
    112         add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     102        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    113103}
    114104
    115105SizeofExpr::SizeofExpr( Type *type_, Expression *_aname ) :
    116106                Expression( _aname ), expr(0), type(type_), isType(true) {
    117         add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     107        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    118108}
    119109
     
    141131AlignofExpr::AlignofExpr( Expression *expr_, Expression *_aname ) :
    142132                Expression( _aname ), expr(expr_), type(0), isType(false) {
    143         add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     133        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    144134}
    145135
    146136AlignofExpr::AlignofExpr( Type *type_, Expression *_aname ) :
    147137                Expression( _aname ), expr(0), type(type_), isType(true) {
    148         add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     138        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    149139}
    150140
     
    172162UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type_, const std::string &member_, Expression *_aname ) :
    173163                Expression( _aname ), type(type_), member(member_) {
    174         add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     164        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    175165}
    176166
     
    197187OffsetofExpr::OffsetofExpr( Type *type_, DeclarationWithType *member_, Expression *_aname ) :
    198188                Expression( _aname ), type(type_), member(member_) {
    199         add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
     189        set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );
    200190}
    201191
     
    229219
    230220OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) {
    231         add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
     221        set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );
    232222}
    233223
     
    284274
    285275CastExpr::CastExpr( Expression *arg_, Type *toType, Expression *_aname ) : Expression( _aname ), arg(arg_) {
    286         add_result(toType);
     276        set_result(toType);
    287277}
    288278
    289279CastExpr::CastExpr( Expression *arg_, Expression *_aname ) : Expression( _aname ), arg(arg_) {
     280        set_result( new VoidType( Type::Qualifiers() ) );
    290281}
    291282
     
    303294        arg->print(os, indent+2);
    304295        os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl;
    305         if ( results.empty() ) {
    306                 os << std::string( indent+2, ' ' ) << "nothing" << std::endl;
     296        os << std::string( indent+2, ' ' );
     297        if ( result->isVoid() ) {
     298                os << "nothing";
    307299        } else {
    308                 printAll(results, os, indent+2);
     300                result->print( os, indent+2 );
    309301        } // if
    310         Expression::print( os, indent );
    311 }
    312 
    313 UntypedMemberExpr::UntypedMemberExpr( std::string _member, Expression *_aggregate, Expression *_aname ) :
     302        os << std::endl;
     303        Expression::print( os, indent );
     304}
     305
     306UntypedMemberExpr::UntypedMemberExpr( Expression * _member, Expression *_aggregate, Expression *_aname ) :
    314307                Expression( _aname ), member(_member), aggregate(_aggregate) {}
    315308
    316309UntypedMemberExpr::UntypedMemberExpr( const UntypedMemberExpr &other ) :
    317                 Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) {
     310                Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) {
    318311}
    319312
    320313UntypedMemberExpr::~UntypedMemberExpr() {
    321314        delete aggregate;
     315        delete member;
    322316}
    323317
    324318void UntypedMemberExpr::print( std::ostream &os, int indent ) const {
    325         os << "Untyped Member Expression, with field: " << get_member();
     319        os << "Untyped Member Expression, with field: " << std::endl;
     320        os << std::string( indent+2, ' ' );
     321        get_member()->print(os, indent+4);
     322        os << std::string( indent+2, ' ' );
    326323
    327324        Expression *agg = get_aggregate();
    328         os << ", from aggregate: ";
     325        os << "from aggregate: " << std::endl;
    329326        if (agg != 0) {
    330                 os << std::string( indent + 2, ' ' );
    331                 agg->print(os, indent + 2);
     327                os << std::string( indent + 4, ' ' );
     328                agg->print(os, indent + 4);
    332329        }
    333330        os << std::string( indent+2, ' ' );
     
    338335MemberExpr::MemberExpr( DeclarationWithType *_member, Expression *_aggregate, Expression *_aname ) :
    339336                Expression( _aname ), member(_member), aggregate(_aggregate) {
    340         add_result( member->get_type()->clone() );
    341         for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) {
    342                 (*i)->set_isLvalue( true );
    343         } // for
     337        set_result( member->get_type()->clone() );
     338        get_result()->set_isLvalue( true );
    344339}
    345340
     
    372367}
    373368
    374 
    375 UntypedExpr::UntypedExpr( Expression *_function, Expression *_aname ) : Expression( _aname ), function( _function ) {}
     369UntypedExpr::UntypedExpr( Expression *_function, const std::list<Expression *> &_args, Expression *_aname ) :
     370                Expression( _aname ), function(_function), args(_args) {}
    376371
    377372UntypedExpr::UntypedExpr( const UntypedExpr &other ) :
     
    379374        cloneAll( other.args, args );
    380375}
    381 
    382 UntypedExpr::UntypedExpr( Expression *_function, std::list<Expression *> &_args, Expression *_aname ) :
    383                 Expression( _aname ), function(_function), args(_args) {}
    384376
    385377UntypedExpr::~UntypedExpr() {
     
    419411LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp, Expression *_aname ) :
    420412                Expression( _aname ), arg1(arg1_), arg2(arg2_), isAnd(andp) {
    421         add_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
     413        set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );
    422414}
    423415
     
    477469ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) {
    478470        assert( callExpr );
    479         cloneAll( callExpr->get_results(), results );
     471        assert( callExpr->has_result() );
     472        set_result( callExpr->get_result()->clone() );
    480473}
    481474
     
    510503        Expression * arg = InitTweak::getCallArg( callExpr, 0 );
    511504        assert( arg );
    512         cloneAll( arg->get_results(), results );
     505        set_result( maybeClone( arg->get_result() ) );
    513506}
    514507
     
    530523
    531524CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) {
    532         add_result( type->clone() );
    533 }
    534 
    535 CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( maybeClone( other.type ) ), initializer( maybeClone( other.initializer ) ) {}
     525        assert( type && initializer );
     526        set_result( type->clone() );
     527}
     528
     529CompoundLiteralExpr::CompoundLiteralExpr( const CompoundLiteralExpr &other ) : Expression( other ), type( other.type->clone() ), initializer( other.initializer->clone() ) {}
    536530
    537531CompoundLiteralExpr::~CompoundLiteralExpr() {
     
    542536void CompoundLiteralExpr::print( std::ostream &os, int indent ) const {
    543537        os << "Compound Literal Expression: " << std::endl;
    544         if ( type ) type->print( os, indent + 2 );
    545         if ( initializer ) initializer->print( os, indent + 2 );
     538        os << std::string( indent+2, ' ' );
     539        type->print( os, indent + 2 );
     540        os << std::string( indent+2, ' ' );
     541        initializer->print( os, indent + 2 );
    546542}
    547543
     
    557553
    558554RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {}
    559 RangeExpr::RangeExpr( const RangeExpr &other ) : low( other.low->clone() ), high( other.high->clone() ) {}
     555RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {}
    560556void RangeExpr::print( std::ostream &os, int indent ) const {
    561         os << std::string( indent, ' ' ) << "Range Expression: ";
     557        os << "Range Expression: ";
    562558        low->print( os, indent );
    563559        os << " ... ";
    564560        high->print( os, indent );
     561}
     562
     563StmtExpr::StmtExpr( CompoundStmt *statements ) : statements( statements ) {
     564        assert( statements );
     565        std::list< Statement * > & body = statements->get_kids();
     566        if ( ! body.empty() ) {
     567                if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( body.back() ) ) {
     568                        set_result( maybeClone( exprStmt->get_expr()->get_result() ) );
     569                }
     570        }
     571}
     572StmtExpr::StmtExpr( const StmtExpr &other ) : Expression( other ), statements( other.statements->clone() ) {}
     573StmtExpr::~StmtExpr() {
     574        delete statements;
     575}
     576void StmtExpr::print( std::ostream &os, int indent ) const {
     577        os << "Statement Expression: " << std::endl << std::string( indent, ' ' );
     578        statements->print( os, indent+2 );
     579}
     580
     581
     582long long UniqueExpr::count = 0;
     583UniqueExpr::UniqueExpr( Expression *expr, long long idVal ) : expr( new Expression* ), object( new ObjectDecl* ), id( idVal ) {
     584        assert( count != -1 );
     585        if ( id == -1 ) id = count++;
     586        set_expr( expr );
     587        assert( expr );
     588        if ( expr->get_result() ) {
     589                set_result( expr->get_result()->clone() );
     590        }
     591        set_object( nullptr );
     592}
     593UniqueExpr::UniqueExpr( const UniqueExpr &other ) : Expression( other ), expr( other.expr ), object( other.object ), id( other.id ) {
     594}
     595UniqueExpr::~UniqueExpr() {
     596        if ( expr.unique() ) {
     597                delete *expr;
     598        }
     599        if ( object.unique() ) {
     600                delete *object;
     601        }
     602}
     603void UniqueExpr::print( std::ostream &os, int indent ) const {
     604        os << "Unique Expression with id:" << id << std::endl << std::string( indent+2, ' ' );
     605        get_expr()->print( os, indent+2 );
     606        if ( get_object() ) {
     607                os << " with decl: ";
     608                get_object()->printShort( os, indent+2 );
     609        }
    565610}
    566611
  • src/SynTree/Expression.h

    r47a8d17 r3f0c6a5  
    3232        virtual ~Expression();
    3333
    34         std::list<Type *>& get_results() { return results; }
    35         void add_result( Type *t );
     34        Type *& get_result() { return result; }
     35        void set_result( Type *newValue ) { result = newValue; }
     36        bool has_result() const { return result != nullptr; }
    3637
    3738        TypeSubstitution *get_env() const { return env; }
     
    4748        virtual void print( std::ostream &os, int indent = 0 ) const;
    4849  protected:
    49         std::list<Type *> results;
     50        Type * result;
    5051        TypeSubstitution *env;
    5152        Expression* argName; // if expression is used as an argument, it can be "designated" by this name
     
    9899class UntypedExpr : public Expression {
    99100  public:
    100         UntypedExpr( Expression *function, Expression *_aname = nullptr );
     101        UntypedExpr( Expression *function, const std::list<Expression *> &args = std::list< Expression * >(), Expression *_aname = nullptr );
    101102        UntypedExpr( const UntypedExpr &other );
    102         UntypedExpr( Expression *function, std::list<Expression *> &args, Expression *_aname = nullptr );
    103103        virtual ~UntypedExpr();
    104104
     
    200200class UntypedMemberExpr : public Expression {
    201201  public:
    202         UntypedMemberExpr( std::string member, Expression *aggregate, Expression *_aname = nullptr );
     202        UntypedMemberExpr( Expression *member, Expression *aggregate, Expression *_aname = nullptr );
    203203        UntypedMemberExpr( const UntypedMemberExpr &other );
    204204        virtual ~UntypedMemberExpr();
    205205
    206         std::string get_member() const { return member; }
    207         void set_member( const std::string &newValue ) { member = newValue; }
     206        Expression * get_member() const { return member; }
     207        void set_member( Expression * newValue ) { member = newValue; }
    208208        Expression *get_aggregate() const { return aggregate; }
    209209        void set_aggregate( Expression *newValue ) { aggregate = newValue; }
     
    214214        virtual void print( std::ostream &os, int indent = 0 ) const;
    215215  private:
    216         std::string member;
     216        Expression *member;
    217217        Expression *aggregate;
    218218};
     
    483483};
    484484
    485 /// TupleExpr represents a tuple expression ( [a, b, c] )
    486 class TupleExpr : public Expression {
    487   public:
    488         TupleExpr( Expression *_aname = nullptr );
    489         TupleExpr( const TupleExpr &other );
    490         virtual ~TupleExpr();
    491 
    492         void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; }
    493         std::list<Expression*>& get_exprs() { return exprs; }
    494 
    495         virtual TupleExpr *clone() const { return new TupleExpr( *this ); }
    496         virtual void accept( Visitor &v ) { v.visit( this ); }
    497         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    498         virtual void print( std::ostream &os, int indent = 0 ) const;
    499   private:
    500         std::list<Expression*> exprs;
    501 };
    502 
    503 /// SolvedTupleExpr represents a TupleExpr whose components have been type-resolved. It is effectively a shell for the code generator to work on
    504 class SolvedTupleExpr : public Expression {
    505   public:
    506         SolvedTupleExpr( Expression *_aname = nullptr ) : Expression( _aname ) {}
    507         SolvedTupleExpr( std::list<Expression *> &, Expression *_aname = nullptr );
    508         SolvedTupleExpr( const SolvedTupleExpr &other );
    509         virtual ~SolvedTupleExpr() {}
    510 
    511         std::list<Expression*> &get_exprs() { return exprs; }
    512 
    513         virtual SolvedTupleExpr *clone() const { return new SolvedTupleExpr( *this ); }
    514         virtual void accept( Visitor &v ) { v.visit( this ); }
    515         virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
    516         virtual void print( std::ostream &os, int indent = 0 ) const;
    517   private:
    518         std::list<Expression*> exprs;
    519 };
    520 
    521485/// TypeExpr represents a type used in an expression (e.g. as a type generator parameter)
    522486class TypeExpr : public Expression {
     
    618582        CompoundLiteralExpr( Type * type, Initializer * initializer );
    619583        CompoundLiteralExpr( const CompoundLiteralExpr &other );
    620         ~CompoundLiteralExpr();
     584        virtual ~CompoundLiteralExpr();
    621585
    622586        Type * get_type() const { return type; }
     
    670634  private:
    671635        Expression *low, *high;
     636};
     637
     638/// TupleExpr represents a tuple expression ( [a, b, c] )
     639class TupleExpr : public Expression {
     640  public:
     641        TupleExpr( const std::list< Expression * > & exprs = std::list< Expression * >(), Expression *_aname = nullptr );
     642        TupleExpr( const TupleExpr &other );
     643        virtual ~TupleExpr();
     644
     645        void set_exprs( std::list<Expression*> newValue ) { exprs = newValue; }
     646        std::list<Expression*>& get_exprs() { return exprs; }
     647
     648        virtual TupleExpr *clone() const { return new TupleExpr( *this ); }
     649        virtual void accept( Visitor &v ) { v.visit( this ); }
     650        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     651        virtual void print( std::ostream &os, int indent = 0 ) const;
     652  private:
     653        std::list<Expression*> exprs;
     654};
     655
     656/// TupleIndexExpr represents an element selection operation on a tuple value, e.g. t.3 after processing by the expression analyzer
     657class TupleIndexExpr : public Expression {
     658  public:
     659        TupleIndexExpr( Expression * tuple, unsigned int index );
     660        TupleIndexExpr( const TupleIndexExpr &other );
     661        virtual ~TupleIndexExpr();
     662
     663        Expression * get_tuple() const { return tuple; }
     664        int get_index() const { return index; }
     665        TupleIndexExpr * set_tuple( Expression *newValue ) { tuple = newValue; return this; }
     666        TupleIndexExpr * set_index( unsigned int newValue ) { index = newValue; return this; }
     667
     668        virtual TupleIndexExpr *clone() const { return new TupleIndexExpr( *this ); }
     669        virtual void accept( Visitor &v ) { v.visit( this ); }
     670        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     671        virtual void print( std::ostream &os, int indent = 0 ) const;
     672  private:
     673        Expression * tuple;
     674        unsigned int index;
     675};
     676
     677/// MemberTupleExpr represents a tuple member selection operation on a struct type, e.g. s.[a, b, c] after processing by the expression analyzer
     678class MemberTupleExpr : public Expression {
     679  public:
     680        MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname = nullptr );
     681        MemberTupleExpr( const MemberTupleExpr &other );
     682        virtual ~MemberTupleExpr();
     683
     684        Expression * get_member() const { return member; }
     685        Expression * get_aggregate() const { return aggregate; }
     686        MemberTupleExpr * set_member( Expression *newValue ) { member = newValue; return this; }
     687        MemberTupleExpr * set_aggregate( Expression *newValue ) { aggregate = newValue; return this; }
     688
     689        virtual MemberTupleExpr *clone() const { return new MemberTupleExpr( *this ); }
     690        virtual void accept( Visitor &v ) { v.visit( this ); }
     691        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     692        virtual void print( std::ostream &os, int indent = 0 ) const;
     693  private:
     694        Expression * member;
     695        Expression * aggregate;
     696};
     697
     698/// TupleAssignExpr represents a multiple assignment operation, where both sides of the assignment have tuple type, e.g. [a, b, c] = [d, e, f];, a mass assignment operation, where the left hand side has tuple type and the right hand side does not, e.g. [a, b, c] = 5.0;, or a tuple ctor/dtor expression
     699class TupleAssignExpr : public Expression {
     700  public:
     701        TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr );
     702        TupleAssignExpr( const TupleAssignExpr &other );
     703        virtual ~TupleAssignExpr();
     704
     705        std::list< Expression * > & get_assigns() { return assigns; }
     706        std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }
     707
     708        virtual TupleAssignExpr *clone() const { return new TupleAssignExpr( *this ); }
     709        virtual void accept( Visitor &v ) { v.visit( this ); }
     710        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     711        virtual void print( std::ostream &os, int indent = 0 ) const;
     712  private:
     713        std::list< Expression * > assigns; // assignment expressions that use tempDecls
     714        std::list< ObjectDecl * > tempDecls; // temporaries for address of lhs exprs
     715};
     716
     717/// StmtExpr represents a GCC 'statement expression', e.g. ({ int x = 5; x; })
     718class StmtExpr : public Expression {
     719public:
     720        StmtExpr( CompoundStmt *statements );
     721        StmtExpr( const StmtExpr & other );
     722        virtual ~StmtExpr();
     723
     724        CompoundStmt * get_statements() const { return statements; }
     725        StmtExpr * set_statements( CompoundStmt * newValue ) { statements = newValue; return this; }
     726
     727        virtual StmtExpr *clone() const { return new StmtExpr( *this ); }
     728        virtual void accept( Visitor &v ) { v.visit( this ); }
     729        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     730        virtual void print( std::ostream &os, int indent = 0 ) const;
     731private:
     732        CompoundStmt * statements;
     733};
     734
     735class UniqueExpr : public Expression {
     736public:
     737        UniqueExpr( Expression * expr, long long idVal = -1 );
     738        UniqueExpr( const UniqueExpr & other );
     739        ~UniqueExpr();
     740
     741        Expression * get_expr() const { return *expr; }
     742        UniqueExpr * set_expr( Expression * newValue ) { *expr = newValue; return this; }
     743
     744        ObjectDecl * get_object() const { return *object; }
     745        UniqueExpr * set_object( ObjectDecl * newValue ) { *object = newValue; return this; }
     746
     747        int get_id() const { return id; }
     748
     749        virtual UniqueExpr *clone() const { return new UniqueExpr( *this ); }
     750        virtual void accept( Visitor &v ) { v.visit( this ); }
     751        virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }
     752        virtual void print( std::ostream &os, int indent = 0 ) const;
     753private:
     754        std::shared_ptr< Expression * > expr;
     755        std::shared_ptr< ObjectDecl * > object;
     756        int id;
     757        static long long count;
    672758};
    673759
  • src/SynTree/Initializer.h

    r47a8d17 r3f0c6a5  
    2323
    2424#include <cassert>
     25
     26const std::list<Expression*> noDesignators;
    2527
    2628// Initializer: base class for object initializers (provide default values)
  • src/SynTree/Mutator.cc

    r47a8d17 r3f0c6a5  
    178178
    179179Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) {
    180         mutateAll( applicationExpr->get_results(), *this );
     180        applicationExpr->set_result( maybeMutate( applicationExpr->get_result(), *this ) );
    181181        applicationExpr->set_function( maybeMutate( applicationExpr->get_function(), *this ) );
    182182        mutateAll( applicationExpr->get_args(), *this );
     
    185185
    186186Expression *Mutator::mutate( UntypedExpr *untypedExpr ) {
    187         mutateAll( untypedExpr->get_results(), *this );
     187        untypedExpr->set_result( maybeMutate( untypedExpr->get_result(), *this ) );
    188188        mutateAll( untypedExpr->get_args(), *this );
    189189        return untypedExpr;
     
    191191
    192192Expression *Mutator::mutate( NameExpr *nameExpr ) {
    193         mutateAll( nameExpr->get_results(), *this );
     193        nameExpr->set_result( maybeMutate( nameExpr->get_result(), *this ) );
    194194        return nameExpr;
    195195}
    196196
    197197Expression *Mutator::mutate( AddressExpr *addressExpr ) {
    198         mutateAll( addressExpr->get_results(), *this );
     198        addressExpr->set_result( maybeMutate( addressExpr->get_result(), *this ) );
    199199        addressExpr->set_arg( maybeMutate( addressExpr->get_arg(), *this ) );
    200200        return addressExpr;
     
    202202
    203203Expression *Mutator::mutate( LabelAddressExpr *labelAddressExpr ) {
    204         mutateAll( labelAddressExpr->get_results(), *this );
     204        labelAddressExpr->set_result( maybeMutate( labelAddressExpr->get_result(), *this ) );
    205205        labelAddressExpr->set_arg( maybeMutate( labelAddressExpr->get_arg(), *this ) );
    206206        return labelAddressExpr;
     
    208208
    209209Expression *Mutator::mutate( CastExpr *castExpr ) {
    210         mutateAll( castExpr->get_results(), *this );
     210        castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) );
    211211        castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) );
    212212        return castExpr;
     
    214214
    215215Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) {
    216         mutateAll( memberExpr->get_results(), *this );
     216        memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
     217        memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
     218        memberExpr->set_member( maybeMutate( memberExpr->get_member(), *this ) );
     219        return memberExpr;
     220}
     221
     222Expression *Mutator::mutate( MemberExpr *memberExpr ) {
     223        memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) );
    217224        memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
    218225        return memberExpr;
    219226}
    220227
    221 Expression *Mutator::mutate( MemberExpr *memberExpr ) {
    222         mutateAll( memberExpr->get_results(), *this );
    223         memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) );
    224         return memberExpr;
    225 }
    226 
    227228Expression *Mutator::mutate( VariableExpr *variableExpr ) {
    228         mutateAll( variableExpr->get_results(), *this );
     229        variableExpr->set_result( maybeMutate( variableExpr->get_result(), *this ) );
    229230        return variableExpr;
    230231}
    231232
    232233Expression *Mutator::mutate( ConstantExpr *constantExpr ) {
    233         mutateAll( constantExpr->get_results(), *this );
     234        constantExpr->set_result( maybeMutate( constantExpr->get_result(), *this ) );
    234235//  maybeMutate( constantExpr->get_constant(), *this )
    235236        return constantExpr;
     
    237238
    238239Expression *Mutator::mutate( SizeofExpr *sizeofExpr ) {
    239         mutateAll( sizeofExpr->get_results(), *this );
     240        sizeofExpr->set_result( maybeMutate( sizeofExpr->get_result(), *this ) );
    240241        if ( sizeofExpr->get_isType() ) {
    241242                sizeofExpr->set_type( maybeMutate( sizeofExpr->get_type(), *this ) );
     
    247248
    248249Expression *Mutator::mutate( AlignofExpr *alignofExpr ) {
    249         mutateAll( alignofExpr->get_results(), *this );
     250        alignofExpr->set_result( maybeMutate( alignofExpr->get_result(), *this ) );
    250251        if ( alignofExpr->get_isType() ) {
    251252                alignofExpr->set_type( maybeMutate( alignofExpr->get_type(), *this ) );
     
    257258
    258259Expression *Mutator::mutate( UntypedOffsetofExpr *offsetofExpr ) {
    259         mutateAll( offsetofExpr->get_results(), *this );
     260        offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
    260261        offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) );
    261262        return offsetofExpr;
     
    263264
    264265Expression *Mutator::mutate( OffsetofExpr *offsetofExpr ) {
    265         mutateAll( offsetofExpr->get_results(), *this );
     266        offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) );
    266267        offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) );
    267268        offsetofExpr->set_member( maybeMutate( offsetofExpr->get_member(), *this ) );
     
    270271
    271272Expression *Mutator::mutate( OffsetPackExpr *offsetPackExpr ) {
    272         mutateAll( offsetPackExpr->get_results(), *this );
     273        offsetPackExpr->set_result( maybeMutate( offsetPackExpr->get_result(), *this ) );
    273274        offsetPackExpr->set_type( maybeMutate( offsetPackExpr->get_type(), *this ) );
    274275        return offsetPackExpr;
     
    276277
    277278Expression *Mutator::mutate( AttrExpr *attrExpr ) {
    278         mutateAll( attrExpr->get_results(), *this );
     279        attrExpr->set_result( maybeMutate( attrExpr->get_result(), *this ) );
    279280        if ( attrExpr->get_isType() ) {
    280281                attrExpr->set_type( maybeMutate( attrExpr->get_type(), *this ) );
     
    286287
    287288Expression *Mutator::mutate( LogicalExpr *logicalExpr ) {
    288         mutateAll( logicalExpr->get_results(), *this );
     289        logicalExpr->set_result( maybeMutate( logicalExpr->get_result(), *this ) );
    289290        logicalExpr->set_arg1( maybeMutate( logicalExpr->get_arg1(), *this ) );
    290291        logicalExpr->set_arg2( maybeMutate( logicalExpr->get_arg2(), *this ) );
     
    293294
    294295Expression *Mutator::mutate( ConditionalExpr *conditionalExpr ) {
    295         mutateAll( conditionalExpr->get_results(), *this );
     296        conditionalExpr->set_result( maybeMutate( conditionalExpr->get_result(), *this ) );
    296297        conditionalExpr->set_arg1( maybeMutate( conditionalExpr->get_arg1(), *this ) );
    297298        conditionalExpr->set_arg2( maybeMutate( conditionalExpr->get_arg2(), *this ) );
     
    301302
    302303Expression *Mutator::mutate( CommaExpr *commaExpr ) {
    303         mutateAll( commaExpr->get_results(), *this );
     304        commaExpr->set_result( maybeMutate( commaExpr->get_result(), *this ) );
    304305        commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) );
    305306        commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) );
     
    307308}
    308309
    309 Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
    310         mutateAll( tupleExpr->get_results(), *this );
    311         mutateAll( tupleExpr->get_exprs(), *this );
    312         return tupleExpr;
    313 }
    314 
    315 Expression *Mutator::mutate( SolvedTupleExpr *tupleExpr ) {
    316         mutateAll( tupleExpr->get_results(), *this );
    317         mutateAll( tupleExpr->get_exprs(), *this );
    318         return tupleExpr;
    319 }
    320 
    321310Expression *Mutator::mutate( TypeExpr *typeExpr ) {
    322         mutateAll( typeExpr->get_results(), *this );
     311        typeExpr->set_result( maybeMutate( typeExpr->get_result(), *this ) );
    323312        typeExpr->set_type( maybeMutate( typeExpr->get_type(), *this ) );
    324313        return typeExpr;
     
    340329
    341330Expression* Mutator::mutate( ConstructorExpr *ctorExpr ) {
    342         mutateAll( ctorExpr->get_results(), *this );
     331        ctorExpr->set_result( maybeMutate( ctorExpr->get_result(), *this ) );
    343332        ctorExpr->set_callExpr( maybeMutate( ctorExpr->get_callExpr(), *this ) );
    344333        return ctorExpr;
     
    346335
    347336Expression *Mutator::mutate( CompoundLiteralExpr *compLitExpr ) {
    348         mutateAll( compLitExpr->get_results(), *this );
     337        compLitExpr->set_result( maybeMutate( compLitExpr->get_result(), *this ) );
    349338        compLitExpr->set_type( maybeMutate( compLitExpr->get_type(), *this ) );
    350339        compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) );
     
    353342
    354343Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) {
    355         mutateAll( valofExpr->get_results(), *this );
     344        valofExpr->set_result( maybeMutate( valofExpr->get_result(), *this ) );
    356345        return valofExpr;
    357346}
     
    361350        rangeExpr->set_high( maybeMutate( rangeExpr->get_high(), *this ) );
    362351        return rangeExpr;
     352}
     353
     354Expression *Mutator::mutate( TupleExpr *tupleExpr ) {
     355        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
     356        mutateAll( tupleExpr->get_exprs(), *this );
     357        return tupleExpr;
     358}
     359
     360Expression *Mutator::mutate( TupleIndexExpr *tupleExpr ) {
     361        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
     362        tupleExpr->set_tuple( maybeMutate( tupleExpr->get_tuple(), *this ) );
     363        return tupleExpr;
     364}
     365
     366Expression *Mutator::mutate( MemberTupleExpr *tupleExpr ) {
     367        tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) );
     368        tupleExpr->set_member( maybeMutate( tupleExpr->get_member(), *this ) );
     369        tupleExpr->set_aggregate( maybeMutate( tupleExpr->get_aggregate(), *this ) );
     370        return tupleExpr;
     371}
     372
     373Expression *Mutator::mutate( TupleAssignExpr *assignExpr ) {
     374        assignExpr->set_result( maybeMutate( assignExpr->get_result(), *this ) );
     375        mutateAll( assignExpr->get_tempDecls(), *this );
     376        mutateAll( assignExpr->get_assigns(), *this );
     377        return assignExpr;
     378}
     379
     380Expression *Mutator::mutate( StmtExpr *stmtExpr ) {
     381        stmtExpr->set_result( maybeMutate( stmtExpr->get_result(), *this ) );
     382        stmtExpr->set_statements( maybeMutate( stmtExpr->get_statements(), *this ) );
     383        return stmtExpr;
     384}
     385
     386Expression *Mutator::mutate( UniqueExpr *uniqueExpr ) {
     387        uniqueExpr->set_result( maybeMutate( uniqueExpr->get_result(), *this ) );
     388        uniqueExpr->set_expr( maybeMutate( uniqueExpr->get_expr(), *this ) );
     389        return uniqueExpr;
    363390}
    364391
  • src/SynTree/Mutator.h

    r47a8d17 r3f0c6a5  
    7171        virtual Expression* mutate( ConditionalExpr *conditionalExpr );
    7272        virtual Expression* mutate( CommaExpr *commaExpr );
    73         virtual Expression* mutate( TupleExpr *tupleExpr );
    74         virtual Expression* mutate( SolvedTupleExpr *tupleExpr );
    7573        virtual Expression* mutate( TypeExpr *typeExpr );
    7674        virtual Expression* mutate( AsmExpr *asmExpr );
     
    8078        virtual Expression* mutate( UntypedValofExpr *valofExpr );
    8179        virtual Expression* mutate( RangeExpr *rangeExpr );
     80        virtual Expression* mutate( TupleExpr *tupleExpr );
     81        virtual Expression* mutate( TupleIndexExpr *tupleExpr );
     82        virtual Expression* mutate( MemberTupleExpr *tupleExpr );
     83        virtual Expression* mutate( TupleAssignExpr *assignExpr );
     84        virtual Expression* mutate( StmtExpr * stmtExpr );
     85        virtual Expression* mutate( UniqueExpr * uniqueExpr );
    8286
    8387        virtual Type* mutate( VoidType *basicType );
  • src/SynTree/ReferenceToType.cc

    r47a8d17 r3f0c6a5  
    5656        }
    5757} // namespace
     58
     59StructInstType::StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct ) : Parent( tq, baseStruct->get_name() ), baseStruct( baseStruct ) {}
    5860
    5961std::string StructInstType::typeString() const { return "struct"; }
  • src/SynTree/SynTree.h

    r47a8d17 r3f0c6a5  
    7676class ConditionalExpr;
    7777class CommaExpr;
    78 class TupleExpr;
    79 class SolvedTupleExpr;
    8078class TypeExpr;
    8179class AsmExpr;
     
    8583class UntypedValofExpr;
    8684class RangeExpr;
     85class TupleExpr;
     86class TupleIndexExpr;
     87class MemberTupleExpr;
     88class TupleAssignExpr;
     89class StmtExpr;
     90class UniqueExpr;
    8791
    8892class Type;
  • src/SynTree/TupleExpr.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleExpr.cc -- 
     7// TupleExpr.cc --
    88//
    99// Author           : Richard C. Bilson
     
    1616#include "Expression.h"
    1717#include "Common/utility.h"
     18#include "Type.h"
     19#include "Declaration.h"
     20#include "Tuples/Tuples.h"
    1821
    19 TupleExpr::TupleExpr( Expression *_aname ) : Expression( _aname ) {
     22TupleExpr::TupleExpr( const std::list< Expression * > & exprs, Expression *_aname ) : Expression( _aname ), exprs( exprs ) {
     23        if ( ! exprs.empty() ) {
     24                if ( std::all_of( exprs.begin(), exprs.end(), [](Expression * expr) { return expr->get_result(); } ) ) {
     25                        set_result( Tuples::makeTupleType( exprs ) );
     26                }
     27        }
    2028}
    2129
     
    2937
    3038void TupleExpr::print( std::ostream &os, int indent ) const {
    31         os << std::string( indent, ' ' ) << "Tuple:" << std::endl;
     39        os << "Tuple:" << std::endl;
    3240        printAll( exprs, os, indent+2 );
    3341        Expression::print( os, indent );
    3442}
    3543
    36 SolvedTupleExpr::SolvedTupleExpr( std::list<Expression *> &_exprs, Expression *_aname ) : Expression( _aname ) {
    37         std::copy(_exprs.begin(), _exprs.end(), back_inserter(exprs));
     44TupleIndexExpr::TupleIndexExpr( Expression * tuple, unsigned int index ) : tuple( tuple ), index( index )  {
     45        TupleType * type = safe_dynamic_cast< TupleType * >( tuple->get_result() );
     46        assert( type->size() > index );
     47        set_result( (*std::next( type->get_types().begin(), index ))->clone() );
     48        get_result()->set_isLvalue( type->get_isLvalue() );
    3849}
    3950
    40 SolvedTupleExpr::SolvedTupleExpr( const SolvedTupleExpr &other ) : Expression( other ) {
    41         cloneAll( other.exprs, exprs );
     51TupleIndexExpr::TupleIndexExpr( const TupleIndexExpr &other ) : Expression( other ), tuple( other.tuple->clone() ), index( other.index ) {
    4252}
    4353
    44 void SolvedTupleExpr::print( std::ostream &os, int indent ) const {
    45         os << std::string( indent, ' ' ) << "Solved Tuple:" << std::endl;
    46         printAll( exprs, os, indent+2 );
     54TupleIndexExpr::~TupleIndexExpr() {
     55        delete tuple;
     56}
     57
     58void TupleIndexExpr::print( std::ostream &os, int indent ) const {
     59        os << "Tuple Index Expression, with tuple:" << std::endl;
     60        os << std::string( indent+2, ' ' );
     61        tuple->print( os, indent+2 );
     62        os << std::string( indent+2, ' ' ) << "with index: " << index << std::endl;
    4763        Expression::print( os, indent );
    4864}
     65
     66MemberTupleExpr::MemberTupleExpr( Expression * member, Expression * aggregate, Expression * _aname ) : Expression( _aname ) {
     67        set_result( maybeClone( member->get_result() ) ); // xxx - ???
     68}
     69
     70MemberTupleExpr::MemberTupleExpr( const MemberTupleExpr &other ) : Expression( other ), member( other.member->clone() ), aggregate( other.aggregate->clone() ) {
     71}
     72
     73MemberTupleExpr::~MemberTupleExpr() {
     74        delete member;
     75        delete aggregate;
     76}
     77
     78void MemberTupleExpr::print( std::ostream &os, int indent ) const {
     79        os << "Member Tuple Expression, with aggregate:" << std::endl;
     80        os << std::string( indent+2, ' ' );
     81        aggregate->print( os, indent+2 );
     82        os << std::string( indent+2, ' ' ) << "with member: " << std::endl;
     83        os << std::string( indent+2, ' ' );
     84        member->print( os, indent+2 );
     85        Expression::print( os, indent );
     86}
     87
     88
     89TupleAssignExpr::TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname ) : Expression( _aname ), assigns( assigns ), tempDecls( tempDecls ) {
     90        set_result( Tuples::makeTupleType( assigns ) );
     91}
     92
     93TupleAssignExpr::TupleAssignExpr( const TupleAssignExpr &other ) : Expression( other ), tempDecls( other.tempDecls ) /* temporary */ {
     94        cloneAll( other.assigns, assigns );
     95        // xxx - clone needs to go into assigns and replace tempDecls
     96}
     97
     98TupleAssignExpr::~TupleAssignExpr() {
     99        deleteAll( assigns );
     100        // deleteAll( tempDecls );
     101}
     102
     103void TupleAssignExpr::print( std::ostream &os, int indent ) const {
     104        os << "Tuple Assignment Expression, with temporaries:" << std::endl;
     105        printAll( tempDecls, os, indent+4 );
     106        os << std::string( indent+2, ' ' ) << "with assignments: " << std::endl;
     107        printAll( assigns, os, indent+4 );
     108        Expression::print( os, indent );
     109}
     110
     111
    49112
    50113// Local Variables: //
  • src/SynTree/TupleType.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleType.cc -- 
     7// TupleType.cc --
    88//
    99// Author           : Richard C. Bilson
     
    1717#include "Common/utility.h"
    1818
    19 TupleType::TupleType( const Type::Qualifiers &tq ) : Type( tq ) {
     19TupleType::TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types ) : Type( tq ), types( types ) {
    2020}
    2121
  • src/SynTree/Type.h

    r47a8d17 r3f0c6a5  
    2020#include "Visitor.h"
    2121#include "Mutator.h"
     22#include "Common/utility.h"
    2223
    2324class Type {
     
    2728                Qualifiers( bool isConst, bool isVolatile, bool isRestrict, bool isLvalue, bool isAtomic, bool isAttribute ): isConst( isConst ), isVolatile( isVolatile ), isRestrict( isRestrict ), isLvalue( isLvalue ), isAtomic( isAtomic ), isAttribute( isAttribute ) {}
    2829
     30                Qualifiers &operator&=( const Qualifiers &other );
    2931                Qualifiers &operator+=( const Qualifiers &other );
    3032                Qualifiers &operator-=( const Qualifiers &other );
     
    6365        void set_isAtomic( bool newValue ) { tq.isAtomic = newValue; }
    6466        void set_isAttribute( bool newValue ) { tq.isAttribute = newValue; }
    65         std::list<TypeDecl*>& get_forall() { return forall; }
     67
     68        typedef std::list<TypeDecl *> ForallList;
     69        ForallList& get_forall() { return forall; }
     70
     71        /// How many elemental types are represented by this type
     72        virtual unsigned size() const { return 1; };
     73        virtual bool isVoid() const { return size() == 0; }
    6674
    6775        virtual Type *clone() const = 0;
     
    7179  private:
    7280        Qualifiers tq;
    73         std::list<TypeDecl*> forall;
     81        ForallList forall;
    7482};
    7583
     
    7785  public:
    7886        VoidType( const Type::Qualifiers &tq );
     87
     88        virtual unsigned size() const { return 0; };
    7989
    8090        virtual VoidType *clone() const { return new VoidType( *this ); }
     
    234244  public:
    235245        StructInstType( const Type::Qualifiers &tq, const std::string &name ) : Parent( tq, name ), baseStruct( 0 ) {}
     246        StructInstType( const Type::Qualifiers &tq, StructDecl * baseStruct );
    236247        StructInstType( const StructInstType &other ) : Parent( other ), baseStruct( other.baseStruct ) {}
    237248
     
    348359class TupleType : public Type {
    349360  public:
    350         TupleType( const Type::Qualifiers &tq );
     361        TupleType( const Type::Qualifiers &tq, const std::list< Type * > & types = std::list< Type * >() );
    351362        TupleType( const TupleType& );
    352363        virtual ~TupleType();
    353364
     365        typedef std::list<Type*> value_type;
     366        typedef value_type::iterator iterator;
     367
    354368        std::list<Type*>& get_types() { return types; }
     369        virtual unsigned size() const { return types.size(); };
     370
     371        iterator begin() { return types.begin(); }
     372        iterator end() { return types.end(); }
    355373
    356374        virtual TupleType *clone() const { return new TupleType( *this ); }
     
    442460};
    443461
     462inline Type::Qualifiers &Type::Qualifiers::operator&=( const Type::Qualifiers &other ) {
     463        isConst &= other.isConst;
     464        isVolatile &= other.isVolatile;
     465        isRestrict &= other.isRestrict;
     466        isLvalue &= other.isLvalue;
     467        isAtomic &= other.isAtomic;
     468        return *this;
     469}
     470
    444471inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) {
    445472        isConst |= other.isConst;
  • src/SynTree/TypeSubstitution.cc

    r47a8d17 r3f0c6a5  
    7272Type *TypeSubstitution::lookup( std::string formalType ) const {
    7373        TypeEnvType::const_iterator i = typeEnv.find( formalType );
    74        
     74
    7575        // break on not in substitution set
    7676        if ( i == typeEnv.end() ) return 0;
    77        
     77
    7878        // attempt to transitively follow TypeInstType links.
    7979        while ( TypeInstType *actualType = dynamic_cast< TypeInstType* >( i->second ) ) {
    8080                const std::string& typeName = actualType->get_name();
    81                
     81
    8282                // break cycles in the transitive follow
    8383                if ( formalType == typeName ) break;
    84                
     84
    8585                // Look for the type this maps to, returning previous mapping if none-such
    8686                i = typeEnv.find( typeName );
    8787                if ( i == typeEnv.end() ) return actualType;
    8888        }
    89        
     89
    9090        // return type from substitution set
    9191        return i->second;
    92        
     92
    9393#if 0
    9494        if ( i == typeEnv.end() ) {
     
    149149        // bind type variables from forall-qualifiers
    150150        if ( freeOnly ) {
    151                 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     151                for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    152152                        boundVars.insert( (*tyvar )->get_name() );
    153153                } // for
     
    163163        // bind type variables from forall-qualifiers
    164164        if ( freeOnly ) {
    165                 for ( std::list< TypeDecl* >::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
     165                for ( Type::ForallList::const_iterator tyvar = type->get_forall().begin(); tyvar != type->get_forall().end(); ++tyvar ) {
    166166                        boundVars.insert( (*tyvar )->get_name() );
    167167                } // for
  • src/SynTree/Visitor.cc

    r47a8d17 r3f0c6a5  
    150150
    151151void Visitor::visit( ApplicationExpr *applicationExpr ) {
    152         acceptAll( applicationExpr->get_results(), *this );
     152        maybeAccept( applicationExpr->get_result(), *this );
    153153        maybeAccept( applicationExpr->get_function(), *this );
    154154        acceptAll( applicationExpr->get_args(), *this );
     
    156156
    157157void Visitor::visit( UntypedExpr *untypedExpr ) {
    158         acceptAll( untypedExpr->get_results(), *this );
     158        maybeAccept( untypedExpr->get_result(), *this );
    159159        acceptAll( untypedExpr->get_args(), *this );
    160160}
    161161
    162162void Visitor::visit( NameExpr *nameExpr ) {
    163         acceptAll( nameExpr->get_results(), *this );
     163        maybeAccept( nameExpr->get_result(), *this );
    164164}
    165165
    166166void Visitor::visit( AddressExpr *addressExpr ) {
    167         acceptAll( addressExpr->get_results(), *this );
     167        maybeAccept( addressExpr->get_result(), *this );
    168168        maybeAccept( addressExpr->get_arg(), *this );
    169169}
    170170
    171171void Visitor::visit( LabelAddressExpr *labAddressExpr ) {
    172         acceptAll( labAddressExpr->get_results(), *this );
     172        maybeAccept( labAddressExpr->get_result(), *this );
    173173        maybeAccept( labAddressExpr->get_arg(), *this );
    174174}
    175175
    176176void Visitor::visit( CastExpr *castExpr ) {
    177         acceptAll( castExpr->get_results(), *this );
     177        maybeAccept( castExpr->get_result(), *this );
    178178        maybeAccept( castExpr->get_arg(), *this );
    179179}
    180180
    181181void Visitor::visit( UntypedMemberExpr *memberExpr ) {
    182         acceptAll( memberExpr->get_results(), *this );
     182        maybeAccept( memberExpr->get_result(), *this );
    183183        maybeAccept( memberExpr->get_aggregate(), *this );
     184        maybeAccept( memberExpr->get_member(), *this );
    184185}
    185186
    186187void Visitor::visit( MemberExpr *memberExpr ) {
    187         acceptAll( memberExpr->get_results(), *this );
     188        maybeAccept( memberExpr->get_result(), *this );
    188189        maybeAccept( memberExpr->get_aggregate(), *this );
    189190}
    190191
    191192void Visitor::visit( VariableExpr *variableExpr ) {
    192         acceptAll( variableExpr->get_results(), *this );
     193        maybeAccept( variableExpr->get_result(), *this );
    193194}
    194195
    195196void Visitor::visit( ConstantExpr *constantExpr ) {
    196         acceptAll( constantExpr->get_results(), *this );
     197        maybeAccept( constantExpr->get_result(), *this );
    197198        maybeAccept( constantExpr->get_constant(), *this );
    198199}
    199200
    200201void Visitor::visit( SizeofExpr *sizeofExpr ) {
    201         acceptAll( sizeofExpr->get_results(), *this );
     202        maybeAccept( sizeofExpr->get_result(), *this );
    202203        if ( sizeofExpr->get_isType() ) {
    203204                maybeAccept( sizeofExpr->get_type(), *this );
     
    208209
    209210void Visitor::visit( AlignofExpr *alignofExpr ) {
    210         acceptAll( alignofExpr->get_results(), *this );
     211        maybeAccept( alignofExpr->get_result(), *this );
    211212        if ( alignofExpr->get_isType() ) {
    212213                maybeAccept( alignofExpr->get_type(), *this );
     
    217218
    218219void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) {
    219         acceptAll( offsetofExpr->get_results(), *this );
     220        maybeAccept( offsetofExpr->get_result(), *this );
    220221        maybeAccept( offsetofExpr->get_type(), *this );
    221222}
    222223
    223224void Visitor::visit( OffsetofExpr *offsetofExpr ) {
    224         acceptAll( offsetofExpr->get_results(), *this );
     225        maybeAccept( offsetofExpr->get_result(), *this );
    225226        maybeAccept( offsetofExpr->get_type(), *this );
    226227        maybeAccept( offsetofExpr->get_member(), *this );
     
    228229
    229230void Visitor::visit( OffsetPackExpr *offsetPackExpr ) {
    230         acceptAll( offsetPackExpr->get_results(), *this );
     231        maybeAccept( offsetPackExpr->get_result(), *this );
    231232        maybeAccept( offsetPackExpr->get_type(), *this );
    232233}
    233234
    234235void Visitor::visit( AttrExpr *attrExpr ) {
    235         acceptAll( attrExpr->get_results(), *this );
     236        maybeAccept( attrExpr->get_result(), *this );
    236237        if ( attrExpr->get_isType() ) {
    237238                maybeAccept( attrExpr->get_type(), *this );
     
    242243
    243244void Visitor::visit( LogicalExpr *logicalExpr ) {
    244         acceptAll( logicalExpr->get_results(), *this );
     245        maybeAccept( logicalExpr->get_result(), *this );
    245246        maybeAccept( logicalExpr->get_arg1(), *this );
    246247        maybeAccept( logicalExpr->get_arg2(), *this );
     
    248249
    249250void Visitor::visit( ConditionalExpr *conditionalExpr ) {
    250         acceptAll( conditionalExpr->get_results(), *this );
     251        maybeAccept( conditionalExpr->get_result(), *this );
    251252        maybeAccept( conditionalExpr->get_arg1(), *this );
    252253        maybeAccept( conditionalExpr->get_arg2(), *this );
     
    255256
    256257void Visitor::visit( CommaExpr *commaExpr ) {
    257         acceptAll( commaExpr->get_results(), *this );
     258        maybeAccept( commaExpr->get_result(), *this );
    258259        maybeAccept( commaExpr->get_arg1(), *this );
    259260        maybeAccept( commaExpr->get_arg2(), *this );
    260261}
    261262
    262 void Visitor::visit( TupleExpr *tupleExpr ) {
    263         acceptAll( tupleExpr->get_results(), *this );
    264         acceptAll( tupleExpr->get_exprs(), *this );
    265 }
    266 
    267 void Visitor::visit( SolvedTupleExpr *tupleExpr ) {
    268         acceptAll( tupleExpr->get_results(), *this );
    269         acceptAll( tupleExpr->get_exprs(), *this );
    270 }
    271 
    272263void Visitor::visit( TypeExpr *typeExpr ) {
    273         acceptAll( typeExpr->get_results(), *this );
     264        maybeAccept( typeExpr->get_result(), *this );
    274265        maybeAccept( typeExpr->get_type(), *this );
    275266}
     
    288279
    289280void Visitor::visit( ConstructorExpr * ctorExpr ) {
    290         acceptAll( ctorExpr->get_results(), *this );
     281        maybeAccept( ctorExpr->get_result(), *this );
    291282        maybeAccept( ctorExpr->get_callExpr(), *this );
    292283}
    293284
    294285void Visitor::visit( CompoundLiteralExpr *compLitExpr ) {
    295         acceptAll( compLitExpr->get_results(), *this );
     286        maybeAccept( compLitExpr->get_result(), *this );
    296287        maybeAccept( compLitExpr->get_type(), *this );
    297288        maybeAccept( compLitExpr->get_initializer(), *this );
     
    299290
    300291void Visitor::visit( UntypedValofExpr *valofExpr ) {
    301         acceptAll( valofExpr->get_results(), *this );
     292        maybeAccept( valofExpr->get_result(), *this );
    302293        maybeAccept( valofExpr->get_body(), *this );
    303294}
     
    306297        maybeAccept( rangeExpr->get_low(), *this );
    307298        maybeAccept( rangeExpr->get_high(), *this );
     299}
     300
     301void Visitor::visit( TupleExpr *tupleExpr ) {
     302        maybeAccept( tupleExpr->get_result(), *this );
     303        acceptAll( tupleExpr->get_exprs(), *this );
     304}
     305
     306void Visitor::visit( TupleIndexExpr *tupleExpr ) {
     307        maybeAccept( tupleExpr->get_result(), *this );
     308        maybeAccept( tupleExpr->get_tuple(), *this );
     309}
     310
     311void Visitor::visit( MemberTupleExpr *tupleExpr ) {
     312        maybeAccept( tupleExpr->get_result(), *this );
     313        maybeAccept( tupleExpr->get_member(), *this );
     314        maybeAccept( tupleExpr->get_aggregate(), *this );
     315}
     316
     317void Visitor::visit( TupleAssignExpr *assignExpr ) {
     318        maybeAccept( assignExpr->get_result(), *this );
     319        acceptAll( assignExpr->get_tempDecls(), *this );
     320        acceptAll( assignExpr->get_assigns(), *this );
     321}
     322
     323void Visitor::visit( StmtExpr *stmtExpr ) {
     324        maybeAccept( stmtExpr->get_result(), *this );
     325        maybeAccept( stmtExpr->get_statements(), *this );
     326}
     327
     328void Visitor::visit( UniqueExpr *uniqueExpr ) {
     329        maybeAccept( uniqueExpr->get_result(), *this );
     330        maybeAccept( uniqueExpr->get_expr(), *this );
    308331}
    309332
  • src/SynTree/Visitor.h

    r47a8d17 r3f0c6a5  
    7171        virtual void visit( ConditionalExpr *conditionalExpr );
    7272        virtual void visit( CommaExpr *commaExpr );
    73         virtual void visit( TupleExpr *tupleExpr );
    74         virtual void visit( SolvedTupleExpr *tupleExpr );
    7573        virtual void visit( TypeExpr *typeExpr );
    7674        virtual void visit( AsmExpr *asmExpr );
     
    8078        virtual void visit( UntypedValofExpr *valofExpr );
    8179        virtual void visit( RangeExpr *rangeExpr );
     80        virtual void visit( TupleExpr *tupleExpr );
     81        virtual void visit( TupleIndexExpr *tupleExpr );
     82        virtual void visit( MemberTupleExpr *tupleExpr );
     83        virtual void visit( TupleAssignExpr *assignExpr );
     84        virtual void visit( StmtExpr * stmtExpr );
     85        virtual void visit( UniqueExpr * uniqueExpr );
    8286
    8387        virtual void visit( VoidType *basicType );
  • src/Tuples/TupleAssignment.cc

    r47a8d17 r3f0c6a5  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // TupleAssignment.cc -- 
     7// TupleAssignment.cc --
    88//
    99// Author           : Rodolfo G. Esteves
     
    1818#include "ResolvExpr/typeops.h"
    1919#include "SynTree/Expression.h"
    20 #include "TupleAssignment.h"
     20#include "SynTree/Initializer.h"
     21#include "Tuples.h"
    2122#include "Common/SemanticError.h"
     23#include "InitTweak/InitTweak.h"
    2224
    2325#include <functional>
     
    2729#include <cassert>
    2830#include <set>
     31#include <unordered_set>
    2932
    3033namespace Tuples {
    31         TupleAssignSpotter::TupleAssignSpotter( ResolvExpr::AlternativeFinder *f = 0 )
    32                 : currentFinder(f), matcher(0), hasMatched( false ) {}
    33 
    34         bool TupleAssignSpotter::pointsToTuple( Expression *expr ) {
     34        class TupleAssignSpotter {
     35          public:
     36                // dispatcher for Tuple (multiple and mass) assignment operations
     37                TupleAssignSpotter( ResolvExpr::AlternativeFinder & );
     38                void spot( UntypedExpr * expr, const std::list<ResolvExpr::AltList> &possibilities );
     39
     40          private:
     41                void match();
     42
     43                struct Matcher {
     44                  public:
     45                        Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList & alts );
     46                        virtual ~Matcher() {}
     47                        virtual void match( std::list< Expression * > &out ) = 0;
     48                        ResolvExpr::AltList lhs, rhs;
     49                        TupleAssignSpotter &spotter;
     50                        std::list< ObjectDecl * > tmpDecls;
     51                };
     52
     53                struct MassAssignMatcher : public Matcher {
     54                  public:
     55                        MassAssignMatcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList & alts );
     56                        virtual void match( std::list< Expression * > &out );
     57                };
     58
     59                struct MultipleAssignMatcher : public Matcher {
     60                  public:
     61                        MultipleAssignMatcher( TupleAssignSpotter &spot, const ResolvExpr::AltList & alts );
     62                        virtual void match( std::list< Expression * > &out );
     63                };
     64
     65                ResolvExpr::AlternativeFinder &currentFinder;
     66                std::string fname;
     67                std::unique_ptr< Matcher > matcher;
     68        };
     69
     70        /// true if expr is an expression of tuple type, i.e. a tuple expression, tuple variable, or MRV (multiple-return-value) function
     71        bool isTuple( Expression *expr ) {
     72                if ( ! expr ) return false;
     73                assert( expr->has_result() );
     74                return dynamic_cast<TupleExpr *>(expr) || expr->get_result()->size() > 1;
     75        }
     76
     77        template< typename AltIter >
     78        bool isMultAssign( AltIter begin, AltIter end ) {
     79                // multiple assignment if more than one alternative in the range or if
     80                // the alternative is a tuple
     81                if ( begin == end ) return false;
     82                if ( isTuple( begin->expr ) ) return true;
     83                return ++begin != end;
     84        }
     85
     86        bool pointsToTuple( Expression *expr ) {
    3587                // also check for function returning tuple of reference types
    36                 if (AddressExpr *addr = dynamic_cast<AddressExpr *>(expr) )
    37                         if ( isTuple(addr->get_arg() ) )
    38                                 return true;
     88                if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
     89                        return pointsToTuple( castExpr->get_arg() );
     90                } else if ( AddressExpr *addr = dynamic_cast< AddressExpr * >( expr) ) {
     91                        return isTuple( addr->get_arg() );
     92                }
    3993                return false;
    4094        }
    4195
    42         bool TupleAssignSpotter::isTupleVar( DeclarationWithType *decl ) {
    43                 if ( dynamic_cast<TupleType *>(decl->get_type()) )
    44                         return true;
    45                 return false;
    46         }
    47 
    48         bool TupleAssignSpotter::isTuple( Expression *expr, bool isRight ) {
    49                 // true if `expr' is an expression returning a tuple: tuple, tuple variable or MRV function
    50                 if ( ! expr ) return false;
    51 
    52                 if ( dynamic_cast<TupleExpr *>(expr) )
    53                         return true;
    54                 else if ( VariableExpr *var = dynamic_cast<VariableExpr *>(expr) ) {
    55                         if ( isTupleVar(var->get_var()) )
    56                                 return true;
    57                 }
    58 
    59                 return false;
    60         }
    61 
    62         bool TupleAssignSpotter::match() {
    63                 assert ( matcher != 0 );
    64 
    65                 std::list< Expression * > new_assigns;
    66                 if ( ! matcher->match(new_assigns) )
    67                         return false;
    68 
    69                 if ( new_assigns.empty() ) return false;
    70                 /*return */matcher->solve( new_assigns );
    71                 if ( dynamic_cast<TupleAssignSpotter::MultipleAssignMatcher *>( matcher ) ) {
    72                         // now resolve new assignments
    73                         std::list< Expression * > solved_assigns;
    74                         ResolvExpr::AltList solved_alts;
    75                         assert( currentFinder != 0 );
    76 
    77                         ResolvExpr::AltList current;
    78                         for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
    79                                 //try {
    80                                 ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
    81                                 finder.findWithAdjustment(*i);
    82                                 // prune expressions that don't coincide with
    83                                 ResolvExpr::AltList alts = finder.get_alternatives();
    84                                 assert( alts.size() == 1 );
    85                                 assert(alts.front().expr != 0 );
    86                                 current.push_back( finder.get_alternatives().front() );
    87                                 solved_assigns.push_back( alts.front().expr->clone() );
    88                                 //solved_assigns.back()->print(std::cerr);
    89                                 /*} catch( ... ) {
    90                                   continue; // no reasonable alternative found
    91                                   }*/
    92                         }
    93                         options.add_option( current );
    94 
    95                         return true;
    96                 } else { // mass assignment
    97                         //if ( new_assigns.empty() ) return false;
    98                         std::list< Expression * > solved_assigns;
    99                         ResolvExpr::AltList solved_alts;
    100                         assert( currentFinder != 0 );
    101 
    102                         ResolvExpr::AltList current;
    103                         if ( optMass.empty() ) {
    104                                 for ( std::list< Expression * >::size_type i = 0; i != new_assigns.size(); ++i )
    105                                         optMass.push_back( ResolvExpr::AltList() );
    106                         }
    107                         int cnt = 0;
    108                         for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i, cnt++ ) {
    109 
    110                                 ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
    111                                 finder.findWithAdjustment(*i);
    112                                 ResolvExpr::AltList alts = finder.get_alternatives();
    113                                 assert( alts.size() == 1 );
    114                                 assert(alts.front().expr != 0 );
    115                                 current.push_back( finder.get_alternatives().front() );
    116                                 optMass[cnt].push_back( finder.get_alternatives().front() );
    117                                 solved_assigns.push_back( alts.front().expr->clone() );
    118                         }
    119 
    120                         return true;
    121                 }
    122 
    123                 return false;
    124         }
    125 
    126         bool TupleAssignSpotter::isMVR( Expression *expr ) {
    127                 if ( expr->get_results().size() > 1 ) {
    128                         // MVR processing
    129                         return true;
    130                 }
    131                 return false;
    132         }
    133 
    134         bool TupleAssignSpotter::isTupleAssignment( UntypedExpr * expr, std::list<ResolvExpr::AltList> &possibilities ) {
    135                 if (  NameExpr *assgnop = dynamic_cast< NameExpr * >(expr->get_function()) ) {
    136 
    137                         if ( assgnop->get_name() == std::string("?=?") ) {
    138 
    139                                 for ( std::list<ResolvExpr::AltList>::iterator ali = possibilities.begin(); ali != possibilities.end(); ++ali ) {
    140                                         assert( ali->size() == 2 );
    141                                         ResolvExpr::AltList::iterator opit = ali->begin();
    142                                         ResolvExpr::Alternative op1 = *opit, op2 = *(++opit);
    143 
    144                                         if ( pointsToTuple(op1.expr) ) { // also handles tuple vars
    145                                                 if ( isTuple( op2.expr, true ) )
    146                                                         matcher = new MultipleAssignMatcher(op1.expr, op2.expr);
    147                                                 else if ( isMVR( op2.expr ) ) {
    148                                                         // handle MVR differently
    149                                                 } else
     96        void handleTupleAssignment( ResolvExpr::AlternativeFinder & currentFinder, UntypedExpr * expr, const std::list<ResolvExpr::AltList> &possibilities ) {
     97                TupleAssignSpotter spotter( currentFinder );
     98                spotter.spot( expr, possibilities );
     99        }
     100
     101        TupleAssignSpotter::TupleAssignSpotter( ResolvExpr::AlternativeFinder &f )
     102                : currentFinder(f) {}
     103
     104        void TupleAssignSpotter::spot( UntypedExpr * expr, const std::list<ResolvExpr::AltList> &possibilities ) {
     105                if (  NameExpr *op = dynamic_cast< NameExpr * >(expr->get_function()) ) {
     106                        if ( InitTweak::isCtorDtorAssign( op->get_name() ) ) {
     107                                fname = op->get_name();
     108                                for ( std::list<ResolvExpr::AltList>::const_iterator ali = possibilities.begin(); ali != possibilities.end(); ++ali ) {
     109                                        if ( ali->size() == 0 ) continue; // AlternativeFinder will natrually handle this case, if it's legal
     110                                        if ( ali->size() <= 1 && InitTweak::isAssignment( op->get_name() ) ) {
     111                                                // what does it mean if an assignment takes 1 argument? maybe someone defined such a function, in which case AlternativeFinder will naturally handle it
     112                                                continue;
     113                                        }
     114
     115                                        assert( ! ali->empty() );
     116                                        // grab args 2-N and group into a TupleExpr
     117                                        const ResolvExpr::Alternative & alt1 = ali->front();
     118                                        auto begin = std::next(ali->begin(), 1), end = ali->end();
     119                                        if ( pointsToTuple(alt1.expr) ) {
     120                                                if ( isMultAssign( begin, end ) ) {
     121                                                        matcher.reset( new MultipleAssignMatcher( *this, *ali ) );
     122                                                } else {
    150123                                                        // mass assignment
    151                                                         matcher = new MassAssignMatcher(op1.expr, op2.expr);
    152 
    153                                                 std::list< ResolvExpr::AltList > options;
    154                                                 if ( match() )
    155                                                         /*
    156                                                           if ( hasMatched ) {
    157                                                           // throw SemanticError("Ambiguous tuple assignment");
    158                                                           } else {*/
    159                                                         // Matched for the first time
    160                                                         hasMatched = true;
    161                                                 /*} */
    162                                         } /* else if ( isTuple( op2 ) )
    163                                                  throw SemanticError("Inapplicable tuple assignment.");
    164                                           */
    165                                 }
    166 
    167                                 if ( hasMatched ) {
    168                                         if ( dynamic_cast<TupleAssignSpotter::MultipleAssignMatcher *>( matcher ) ) {
    169                                                 //options.print( std::cerr );
    170                                                 std::list< ResolvExpr::AltList >best = options.get_best();
    171                                                 if ( best.size() == 1 ) {
    172                                                         std::list<Expression *> solved_assigns;
    173                                                         for ( ResolvExpr::AltList::iterator i = best.front().begin(); i != best.front().end(); ++i ) {
    174                                                                 solved_assigns.push_back( i->expr );
    175                                                         }
    176                                                         /* assigning cost zero? */
    177                                                         currentFinder->get_alternatives().push_front( ResolvExpr::Alternative(new SolvedTupleExpr(solved_assigns/*, SolvedTupleExpr::MULTIPLE*/), currentFinder->get_environ(), ResolvExpr::Cost() ) );
     124                                                        matcher.reset( new MassAssignMatcher( *this,  *ali ) );
    178125                                                }
    179                                         } else {
    180                                                 assert( ! optMass.empty() );
    181                                                 ResolvExpr::AltList winners;
    182                                                 for ( std::vector< ResolvExpr::AltList >::iterator i = optMass.begin(); i != optMass.end(); ++i )
    183                                                         findMinCostAlt( i->begin(), i->end(), back_inserter(winners) );
    184 
    185                                                 std::list< Expression *> solved_assigns;
    186                                                 for ( ResolvExpr::AltList::iterator i = winners.begin(); i != winners.end(); ++i )
    187                                                         solved_assigns.push_back( i->expr );
    188                                                 currentFinder->get_alternatives().push_front( ResolvExpr::Alternative(new SolvedTupleExpr(solved_assigns/*, SolvedTupleExpr::MASS*/), currentFinder->get_environ(), ResolvExpr::Cost() ) );
     126                                                match();
    189127                                        }
    190128                                }
    191129                        }
    192130                }
    193                 return hasMatched;
    194         }
    195 
    196         void TupleAssignSpotter::Matcher::init( Expression *_lhs, Expression *_rhs ) {
    197                 lhs.clear();
    198                 if (AddressExpr *addr = dynamic_cast<AddressExpr *>(_lhs) )
    199                         if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(addr->get_arg()) )
    200                                 std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(lhs) );
    201 
    202                 rhs.clear();
    203         }
    204 
    205         TupleAssignSpotter::Matcher::Matcher( /*TupleAssignSpotter &spot,*/ Expression *_lhs, Expression *_rhs ) /*: own_spotter(spot) */{
    206                 init(_lhs,_rhs);
    207         }
    208 
    209         TupleAssignSpotter::MultipleAssignMatcher::MultipleAssignMatcher( Expression *_lhs, Expression *_rhs )/* : own_spotter(spot) */{
    210                 init(_lhs,_rhs);
    211 
    212                 if ( TupleExpr *tuple = dynamic_cast<TupleExpr *>(_rhs) )
    213                         std::copy( tuple->get_exprs().begin(), tuple->get_exprs().end(), back_inserter(rhs) );
    214         }
    215 
    216         UntypedExpr *TupleAssignSpotter::Matcher::createAssgn( Expression *left, Expression *right ) {
    217                 if ( left && right ) {
    218                         std::list< Expression * > args;
    219                         args.push_back(new AddressExpr(left->clone()));  args.push_back(right->clone());
    220                         return new UntypedExpr(new NameExpr("?=?"), args);
    221                 } else
    222                         throw 0; // xxx - diagnose the problem
    223         }
    224 
    225         bool TupleAssignSpotter::MassAssignMatcher::match( std::list< Expression * > &out ) {
    226                 if ( lhs.empty() || (rhs.size() != 1) ) return false;
    227 
    228                 for ( std::list< Expression * >::iterator l = lhs.begin(); l != lhs.end(); l++ ) {
    229                         std::list< Expression * > args;
    230                         args.push_back( new AddressExpr(*l) );
    231                         args.push_back( rhs.front() );
    232                         out.push_back( new UntypedExpr(new NameExpr("?=?"), args) );
    233                 }
    234 
    235                 return true;
    236         }
    237 
    238         bool TupleAssignSpotter::MassAssignMatcher::solve( std::list< Expression * > &assigns ) {
    239                 /*
    240                   std::list< Expression * > solved_assigns;
    241                   ResolvExpr::AltList solved_alts;
    242                   assert( currentFinder != 0 );
    243 
    244                   ResolvExpr::AltList current;
    245                   if ( optMass.empty() ) {
    246                   for ( std::list< Expression * >::size_type i = 0; i != new_assigns.size(); ++i )
    247                   optMass.push_back( ResolvExpr::AltList() );
    248                   }
    249                   int cnt = 0;
    250                   for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i, cnt++ ) {
    251 
    252                   ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
    253                   finder.findWithAdjustment(*i);
    254                   ResolvExpr::AltList alts = finder.get_alternatives();
    255                   assert( alts.size() == 1 );
    256                   assert(alts.front().expr != 0 );
    257                   current.push_back( finder.get_alternatives().front() );
    258                   optMass[cnt].push_back( finder.get_alternatives().front() );
    259                   solved_assigns.push_back( alts.front().expr->clone() );
    260                   }
    261                 */
    262                 return true;
    263         }
    264 
    265         bool TupleAssignSpotter::MultipleAssignMatcher::match( std::list< Expression * > &out ) {
    266                 // need more complicated matching
     131        }
     132
     133        void TupleAssignSpotter::match() {
     134                assert ( matcher != 0 );
     135
     136                std::list< Expression * > new_assigns;
     137                matcher->match( new_assigns );
     138
     139                if ( new_assigns.empty() ) return;
     140                ResolvExpr::AltList current;
     141                // now resolve new assignments
     142                for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
     143                        ResolvExpr::AlternativeFinder finder( currentFinder.get_indexer(), currentFinder.get_environ() );
     144                        try {
     145                                finder.findWithAdjustment(*i);
     146                        } catch (...) {
     147                                return; // xxx - no match should not mean failure, it just means this particular tuple assignment isn't valid
     148                        }
     149                        // prune expressions that don't coincide with
     150                        ResolvExpr::AltList alts = finder.get_alternatives();
     151                        assert( alts.size() == 1 );
     152                        assert( alts.front().expr != 0 );
     153                        current.push_back( alts.front() );
     154                }
     155
     156                // extract expressions from the assignment alternatives to produce a list of assignments that
     157                // together form a single alternative
     158                std::list< Expression *> solved_assigns;
     159                for ( ResolvExpr::Alternative & alt : current ) {
     160                        solved_assigns.push_back( alt.expr->clone() );
     161                }
     162                // xxx - need to do this??
     163                ResolvExpr::TypeEnvironment compositeEnv;
     164                simpleCombineEnvironments( current.begin(), current.end(), compositeEnv );
     165                currentFinder.get_alternatives().push_front( ResolvExpr::Alternative(new TupleAssignExpr(solved_assigns, matcher->tmpDecls), compositeEnv, ResolvExpr::sumCost( current ) ) );
     166        }
     167
     168        TupleAssignSpotter::Matcher::Matcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList &alts ) : spotter(spotter) {
     169                assert( ! alts.empty() );
     170                ResolvExpr::Alternative lhsAlt = alts.front();
     171                // peel off the cast that exists on ctor/dtor expressions
     172                bool isCast = false;
     173                if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( lhsAlt.expr ) ) {
     174                        lhsAlt.expr = castExpr->get_arg();
     175                        castExpr->set_arg( nullptr );
     176                        delete castExpr;
     177                        isCast = true;
     178                }
     179
     180                // explode the lhs so that each field of the tuple-valued-expr is assigned.
     181                explode( lhsAlt, spotter.currentFinder.get_indexer(), back_inserter(lhs) );
     182                // and finally, re-add the cast to each lhs expr, so that qualified tuple fields can be constructed
     183                if ( isCast ) {
     184                        for ( ResolvExpr::Alternative & alt : lhs ) {
     185                                Expression *& expr = alt.expr;
     186                                Type * castType = expr->get_result()->clone();
     187                                Type * type = InitTweak::getPointerBase( castType );
     188                                assert( type );
     189                                type->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true, true);
     190                                type->set_isLvalue( true ); // xxx - might not need this
     191                                expr = new CastExpr( expr, castType );
     192                        }
     193                }
     194                // }
     195        }
     196
     197        TupleAssignSpotter::MassAssignMatcher::MassAssignMatcher( TupleAssignSpotter &spotter,const ResolvExpr::AltList & alts ) : Matcher( spotter, alts ) {
     198                assert( alts.size() == 1 || alts.size() == 2 );
     199                if ( alts.size() == 2 ) {
     200                        rhs.push_back( alts.back() );
     201                }
     202        }
     203
     204        TupleAssignSpotter::MultipleAssignMatcher::MultipleAssignMatcher( TupleAssignSpotter &spotter, const ResolvExpr::AltList & alts ) : Matcher( spotter, alts ) {
     205                // explode the rhs so that each field of the tuple-valued-expr is assigned.
     206                explode( std::next(alts.begin(), 1), alts.end(), spotter.currentFinder.get_indexer(), back_inserter(rhs) );
     207        }
     208
     209        UntypedExpr * createFunc( const std::string &fname, ObjectDecl *left, ObjectDecl *right ) {
     210                assert( left );
     211                std::list< Expression * > args;
     212                args.push_back( new AddressExpr( new UntypedExpr( new NameExpr("*?"), std::list< Expression * >{ new VariableExpr( left ) } ) ) );
     213                // args.push_back( new AddressExpr( new VariableExpr( left ) ) );
     214                if ( right ) args.push_back( new VariableExpr( right ) );
     215                return new UntypedExpr( new NameExpr( fname ), args );
     216        }
     217
     218        ObjectDecl * newObject( UniqueName & namer, Expression * expr ) {
     219                assert( expr->has_result() && ! expr->get_result()->isVoid() );
     220                return new ObjectDecl( namer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) );
     221        }
     222
     223        void TupleAssignSpotter::MassAssignMatcher::match( std::list< Expression * > &out ) {
     224                static UniqueName lhsNamer( "__massassign_L" );
     225                static UniqueName rhsNamer( "__massassign_R" );
     226                assert ( ! lhs.empty() && rhs.size() <= 1);
     227
     228                ObjectDecl * rtmp = rhs.size() == 1 ? newObject( rhsNamer, rhs.front().expr ) : nullptr;
     229                for ( ResolvExpr::Alternative & lhsAlt : lhs ) {
     230                        ObjectDecl * ltmp = newObject( lhsNamer, lhsAlt.expr );
     231                        out.push_back( createFunc( spotter.fname, ltmp, rtmp ) );
     232                        tmpDecls.push_back( ltmp );
     233                }
     234                if ( rtmp ) tmpDecls.push_back( rtmp );
     235        }
     236
     237        void TupleAssignSpotter::MultipleAssignMatcher::match( std::list< Expression * > &out ) {
     238                static UniqueName lhsNamer( "__multassign_L" );
     239                static UniqueName rhsNamer( "__multassign_R" );
     240                // xxx - need more complicated matching?
    267241                if ( lhs.size() == rhs.size() ) {
    268                         zipWith( lhs.begin(), lhs.end(), rhs.begin(), rhs.end(), back_inserter(out), TupleAssignSpotter::Matcher::createAssgn );
    269                         return true;
    270                 } //else
    271                 //std::cerr << "The length of (left, right) is: (" << lhs.size() << "," << rhs.size() << ")" << std::endl;*/
    272                 return false;
    273         }
    274 
    275         bool TupleAssignSpotter::MultipleAssignMatcher::solve( std::list< Expression * > &assigns ) {
    276                 /*
    277                   std::list< Expression * > solved_assigns;
    278                   ResolvExpr::AltList solved_alts;
    279                   assert( currentFinder != 0 );
    280 
    281                   ResolvExpr::AltList current;
    282                   for ( std::list< Expression * >::iterator i = new_assigns.begin(); i != new_assigns.end(); ++i ) {
    283                   //try {
    284                   ResolvExpr::AlternativeFinder finder( currentFinder->get_indexer(), currentFinder->get_environ() );
    285                   finder.findWithAdjustment(*i);
    286                   // prune expressions that don't coincide with
    287                   ResolvExpr::AltList alts = finder.get_alternatives();
    288                   assert( alts.size() == 1 );
    289                   assert(alts.front().expr != 0 );
    290                   current.push_back( finder.get_alternatives().front() );
    291                   solved_assigns.push_back( alts.front().expr->clone() );
    292                   //solved_assigns.back()->print(std::cerr);
    293                   //} catch( ... ) {
    294                   //continue; // no reasonable alternative found
    295                   //}
    296                   }
    297                   options.add_option( current );
    298                 */
    299 
    300                 return true;
    301         }
    302 
    303         void TupleAssignSpotter::Options::add_option( ResolvExpr::AltList &opt ) {
    304                 using namespace std;
    305 
    306                 options.push_back( opt );
    307                 /*
    308                   vector< Cost > costs;
    309                   costs.reserve( opt.size() );
    310                   transform( opt.begin(), opt.end(), back_inserter(costs), ptr_fun(extract_cost) );
    311                 */
    312                 // transpose matrix
    313                 if ( costMatrix.empty() )
    314                         for ( unsigned int i = 0; i< opt.size(); ++i)
    315                                 costMatrix.push_back( vector<ResolvExpr::Cost>() );
    316 
    317                 int cnt = 0;
    318                 for ( ResolvExpr::AltList::iterator i = opt.begin(); i != opt.end(); ++i, cnt++ )
    319                         costMatrix[cnt].push_back( i->cost );
    320 
    321                 return;
    322         }
    323 
    324         std::list< ResolvExpr::AltList > TupleAssignSpotter::Options::get_best() {
    325                 using namespace std;
    326                 using namespace ResolvExpr;
    327                 list< ResolvExpr::AltList > ret;
    328                 list< multiset<int> > solns;
    329                 for ( vector< vector<Cost> >::iterator i = costMatrix.begin(); i != costMatrix.end(); ++i ) {
    330                         list<int> current;
    331                         findMinCost( i->begin(), i->end(), back_inserter(current) );
    332                         solns.push_back( multiset<int>(current.begin(), current.end()) );
    333                 }
    334                 // need to combine
    335                 multiset<int> result;
    336                 lift_intersection( solns.begin(), solns.end(), inserter( result, result.begin() ) );
    337                 if ( result.size() != 1 )
    338                         throw SemanticError("Ambiguous tuple expression");
    339                 ret.push_back(get_option( *(result.begin() )));
    340                 return ret;
    341         }
    342 
    343         void TupleAssignSpotter::Options::print( std::ostream &ostr ) {
    344                 using namespace std;
    345 
    346                 for ( vector< vector < ResolvExpr::Cost > >::iterator i = costMatrix.begin(); i != costMatrix.end(); ++i ) {
    347                         for ( vector < ResolvExpr::Cost >::iterator j = i->begin(); j != i->end(); ++j )
    348                                 ostr << *j << " " ;
    349                         ostr << std::endl;
    350                 } // for
    351                 return;
    352         }
    353 
    354         ResolvExpr::Cost extract_cost( ResolvExpr::Alternative &alt ) {
    355                 return alt.cost;
    356         }
    357 
    358         template< typename InputIterator, typename OutputIterator >
    359         void TupleAssignSpotter::Options::findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
    360                 using namespace ResolvExpr;
    361                 std::list<int> alternatives;
    362 
    363                 // select the alternatives that have the minimum parameter cost
    364                 Cost minCost = Cost::infinity;
    365                 unsigned int index = 0;
    366                 for ( InputIterator i = begin; i != end; ++i, index++ ) {
    367                         if ( *i < minCost ) {
    368                                 minCost = *i;
    369                                 alternatives.clear();
    370                                 alternatives.push_back( index );
    371                         } else if ( *i == minCost ) {
    372                                 alternatives.push_back( index );
    373                         }
    374                 }
    375                 std::copy( alternatives.begin(), alternatives.end(), out );
    376         }
    377 
    378         template< class InputIterator, class OutputIterator >
    379         void TupleAssignSpotter::Options::lift_intersection( InputIterator begin, InputIterator end, OutputIterator out ) {
    380                 if ( begin == end ) return;
    381                 InputIterator test = begin;
    382 
    383                 if (++test == end)
    384                         { copy(begin->begin(), begin->end(), out); return; }
    385 
    386 
    387                 std::multiset<int> cur; // InputIterator::value_type::value_type
    388                 copy( begin->begin(), begin->end(), inserter( cur, cur.begin() ) );
    389 
    390                 while ( test != end ) {
    391                         std::multiset<int> temp;
    392                         set_intersection( cur.begin(), cur.end(), test->begin(), test->end(), inserter(temp,temp.begin()) );
    393                         cur.clear();
    394                         copy( temp.begin(), temp.end(), inserter(cur,cur.begin()));
    395                         ++test;
    396                 }
    397 
    398                 copy( cur.begin(), cur.end(), out );
    399                 return;
    400         }
    401 
    402         ResolvExpr::AltList TupleAssignSpotter::Options::get_option( std::list< ResolvExpr::AltList >::size_type index ) {
    403                 if ( index >= options.size() )
    404                         throw 0; // XXX
    405                 std::list< ResolvExpr::AltList >::iterator it = options.begin();
    406                 for ( std::list< ResolvExpr::AltList >::size_type i = 0; i < index; ++i, ++it );
    407                 return *it;
     242                        std::list< ObjectDecl * > ltmp;
     243                        std::list< ObjectDecl * > rtmp;
     244                        std::transform( lhs.begin(), lhs.end(), back_inserter( ltmp ), []( ResolvExpr::Alternative & alt ){
     245                                return newObject( lhsNamer, alt.expr );
     246                        });
     247                        std::transform( rhs.begin(), rhs.end(), back_inserter( rtmp ), []( ResolvExpr::Alternative & alt ){
     248                                return newObject( rhsNamer, alt.expr );
     249                        });
     250                        zipWith( ltmp.begin(), ltmp.end(), rtmp.begin(), rtmp.end(), back_inserter(out), [&](ObjectDecl * obj1, ObjectDecl * obj2 ) { return createFunc(spotter.fname, obj1, obj2); } );
     251                        tmpDecls.splice( tmpDecls.end(), ltmp );
     252                        tmpDecls.splice( tmpDecls.end(), rtmp );
     253                }
    408254        }
    409255} // namespace Tuples
  • src/Tuples/module.mk

    r47a8d17 r3f0c6a5  
    66## file "LICENCE" distributed with Cforall.
    77##
    8 ## module.mk -- 
     8## module.mk --
    99##
    1010## Author           : Richard C. Bilson
     
    1616
    1717SRC +=  Tuples/TupleAssignment.cc \
    18         Tuples/NameMatcher.cc
     18        Tuples/TupleExpansion.cc
  • src/main.cc

    r47a8d17 r3f0c6a5  
    4242#include "Common/UnimplementedError.h"
    4343#include "../config.h"
     44#include "Tuples/Tuples.h"
    4445
    4546using namespace std;
     
    231232                OPTPRINT( "tweakInit" )
    232233                InitTweak::genInit( translationUnit );
    233 
     234                OPTPRINT( "expandMemberTuples" );
     235                Tuples::expandMemberTuples( translationUnit );
    234236                if ( libcfap ) {
    235237                        // generate the bodies of cfa library functions
     
    248250                        return 0;
    249251                } // if
     252
     253                OPTPRINT( "expandUniqueExpr" ); // xxx - is this the right place for this? want to expand ASAP so that subsequent passes don't need to worry about double-visiting a unique expr
     254                Tuples::expandUniqueExpr( translationUnit );
    250255
    251256                // fix ObjectDecl - replaces ConstructorInit nodes
     
    272277                OPTPRINT( "box" )
    273278                GenPoly::box( translationUnit );
     279                OPTPRINT( "expandTuples" ); // xxx - is this the right place for this?
     280                Tuples::expandTuples( translationUnit );
    274281
    275282                // print tree right before code generation
Note: See TracChangeset for help on using the changeset viewer.