Changes in / [c331406:5070fe4]
- Files:
-
- 2 added
- 2 deleted
- 60 edited
-
doc/aaron_comp_II/comp_II.tex (modified) (1 diff)
-
src/CodeGen/CodeGenerator.cc (modified) (45 diffs)
-
src/CodeGen/CodeGenerator.h (modified) (2 diffs)
-
src/ControlStruct/CaseRangeMutator.cc (added)
-
src/ControlStruct/CaseRangeMutator.h (added)
-
src/ControlStruct/MLEMutator.cc (modified) (3 diffs)
-
src/ControlStruct/Mutate.cc (modified) (4 diffs)
-
src/ControlStruct/module.mk (modified) (2 diffs)
-
src/GenPoly/DeclMutator.cc (modified) (2 diffs)
-
src/GenPoly/DeclMutator.h (modified) (2 diffs)
-
src/GenPoly/PolyMutator.cc (modified) (2 diffs)
-
src/GenPoly/Specialize.cc (modified) (2 diffs)
-
src/InitTweak/FixGlobalInit.cc (modified) (3 diffs)
-
src/InitTweak/FixInit.cc (modified) (11 diffs)
-
src/InitTweak/FixInit.h (modified) (1 diff)
-
src/InitTweak/GenInit.cc (modified) (5 diffs)
-
src/InitTweak/InitTweak.cc (modified) (7 diffs)
-
src/InitTweak/InitTweak.h (modified) (1 diff)
-
src/Makefile.in (modified) (6 diffs)
-
src/Parser/ExpressionNode.cc (modified) (12 diffs)
-
src/Parser/ParseNode.h (modified) (6 diffs)
-
src/Parser/StatementNode.cc (modified) (2 diffs)
-
src/Parser/TypeData.cc (modified) (1 diff)
-
src/Parser/parser.cc (modified) (289 diffs)
-
src/Parser/parser.h (modified) (2 diffs)
-
src/Parser/parser.yy (modified) (27 diffs)
-
src/ResolvExpr/Resolver.cc (modified) (7 diffs)
-
src/SymTab/AddVisit.h (modified) (2 diffs)
-
src/SymTab/Autogen.cc (modified) (3 diffs)
-
src/SymTab/Autogen.h (modified) (1 diff)
-
src/SymTab/FixFunction.cc (modified) (2 diffs)
-
src/SymTab/Validate.cc (modified) (4 diffs)
-
src/SynTree/AddStmtVisitor.cc (modified) (2 diffs)
-
src/SynTree/Declaration.cc (modified) (2 diffs)
-
src/SynTree/Declaration.h (modified) (6 diffs)
-
src/SynTree/DeclarationWithType.cc (modified) (1 diff)
-
src/SynTree/Expression.cc (modified) (3 diffs)
-
src/SynTree/Expression.h (modified) (3 diffs)
-
src/SynTree/FunctionDecl.cc (modified) (4 diffs)
-
src/SynTree/Initializer.h (modified) (1 diff)
-
src/SynTree/Label.h (modified) (1 diff)
-
src/SynTree/Mutator.cc (modified) (3 diffs)
-
src/SynTree/Mutator.h (modified) (2 diffs)
-
src/SynTree/ObjectDecl.cc (modified) (3 diffs)
-
src/SynTree/Statement.cc (modified) (4 diffs)
-
src/SynTree/Statement.h (modified) (4 diffs)
-
src/SynTree/SynTree.h (modified) (2 diffs)
-
src/SynTree/Visitor.cc (modified) (3 diffs)
-
src/SynTree/Visitor.h (modified) (2 diffs)
-
src/examples/gc_no_raii/bug-repro/return_template.c (modified) (1 diff)
-
src/examples/gc_no_raii/src/gc.h (modified) (1 diff)
-
src/examples/gc_no_raii/src/gcpointers.c (modified) (1 diff)
-
src/examples/gc_no_raii/src/gcpointers.h (modified) (2 diffs)
-
src/examples/gc_no_raii/src/internal/memory_pool.h (modified) (1 diff)
-
src/examples/gc_no_raii/src/internal/state.h (modified) (1 diff)
-
src/examples/gc_no_raii/src/tools/worklist.h (modified) (1 diff)
-
src/examples/gc_no_raii/test/badlll.c (modified) (2 diffs)
-
src/examples/gc_no_raii/test/gctest.c (modified) (1 diff)
-
src/main.cc (modified) (3 diffs)
-
src/tests/.expect/64/extension.txt (modified) (1 diff)
-
src/tests/.expect/multiDimension.txt (deleted)
-
src/tests/init_once.c (modified) (2 diffs)
-
src/tests/multiDimension.c (deleted)
-
src/tests/switch.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
doc/aaron_comp_II/comp_II.tex
rc331406 r5070fe4 156 156 157 157 forall(otype M | has_magnitude(M)) 158 M abs( M m ) {158 int sgn( M m ) { 159 159 M zero = 0; // uses zero_t constructor from trait 160 return m < zero ? -m : m; 161 } 162 163 forall(otype M | has_magnitude(M)) 164 M max_magnitude( M a, M b ) { 165 M aa = abs(a), ab = abs(b); 166 return aa < ab ? b : a; 167 } 168 \end{lstlisting} 169 170 Semantically, a trait is merely a named list of type assertions, but they can be used in many of the same situations where an interface in Java or an abstract base class in \CC would be used. 171 Unlike Java interfaces or \CC base classes, \CFA types do not explicitly state any inheritance relationship to traits they satisfy; this can be considered a form of structural inheritance, similar to interface implementation in Go, as opposed to the nominal inheritance model of Java and \CC. 172 % TODO talk about modelling of nominal inheritance with structural inheritance, possibility of investigating some resolver algorithms that require nominal 160 if ( m < zero ) return -1; 161 if ( zero < m ) return 1; 162 return 0; 163 } 164 165 // TODO write another function 166 \end{lstlisting} 173 167 174 168 \subsection{Name Overloading} -
src/CodeGen/CodeGenerator.cc
rc331406 r5070fe4 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Aug 4 13:35:30201613 // Update Count : 3 5211 // Last Modified By : 12 // Last Modified On : Sun Jul 31 08:42:18 2016 13 // Update Count : 345 14 14 // 15 15 … … 48 48 } 49 49 50 void CodeGenerator::extension( Expression * expr ) {50 void CodeGenerator::extension( Expression *expr ) { 51 51 if ( expr->get_extension() ) { 52 52 output << "__extension__ "; … … 54 54 } // extension 55 55 56 void CodeGenerator::extension( Declaration * decl ) {56 void CodeGenerator::extension( Declaration *decl ) { 57 57 if ( decl->get_extension() ) { 58 58 output << "__extension__ "; … … 73 73 } 74 74 75 ostream & operator<<( ostream & output, CodeGenerator::LabelPrinter & printLabels ) {75 ostream & operator<<( ostream & output, CodeGenerator::LabelPrinter &printLabels ) { 76 76 std::list< Label > & labs = *printLabels.labels; 77 77 // l.unique(); // assumes a sorted list. Why not use set? Does order matter? … … 79 79 output << l.get_name() + ": "; 80 80 printLabels.cg.genAttributes( l.get_attributes() ); 81 } // for81 } 82 82 return output; 83 83 } 84 84 85 CodeGenerator::CodeGenerator( std::ostream & os ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ) {}86 87 CodeGenerator::CodeGenerator( std::ostream & os, std::string init, int indentation, bool infunp )85 CodeGenerator::CodeGenerator( std::ostream &os ) : indent( *this), cur_indent( 0 ), insideFunction( false ), output( os ), printLabels( *this ) {} 86 87 CodeGenerator::CodeGenerator( std::ostream &os, std::string init, int indentation, bool infunp ) 88 88 : indent( *this), cur_indent( indentation ), insideFunction( infunp ), output( os ), printLabels( *this ) { 89 89 //output << std::string( init ); 90 90 } 91 91 92 CodeGenerator::CodeGenerator( std::ostream & os, char *init, int indentation, bool infunp )92 CodeGenerator::CodeGenerator( std::ostream &os, char *init, int indentation, bool infunp ) 93 93 : indent( *this ), cur_indent( indentation ), insideFunction( infunp ), output( os ), printLabels( *this ) { 94 94 //output << std::string( init ); 95 95 } 96 96 97 string mangleName( DeclarationWithType * decl ) {97 string mangleName( DeclarationWithType *decl ) { 98 98 if ( decl->get_mangleName() != "" ) { 99 99 // need to incorporate scope level in order to differentiate names for destructors … … 112 112 genCommaList( attr->get_parameters().begin(), attr->get_parameters().end() ); 113 113 output << ")"; 114 } // if114 } 115 115 output << ","; 116 } // for116 } 117 117 output << ")) "; 118 } // if118 } 119 119 } 120 120 121 121 122 122 //*** Declarations 123 void CodeGenerator::visit( FunctionDecl * functionDecl ) {123 void CodeGenerator::visit( FunctionDecl *functionDecl ) { 124 124 extension( functionDecl ); 125 125 genAttributes( functionDecl->get_attributes() ); … … 146 146 } 147 147 148 void CodeGenerator::visit( ObjectDecl * objectDecl ) {148 void CodeGenerator::visit( ObjectDecl *objectDecl ) { 149 149 extension( objectDecl ); 150 genAttributes( objectDecl->get_attributes() );151 152 150 handleStorageClass( objectDecl ); 153 151 output << genType( objectDecl->get_type(), mangleName( objectDecl ) ); … … 164 162 } 165 163 166 void CodeGenerator::handleAggregate( AggregateDecl * aggDecl ) {164 void CodeGenerator::handleAggregate( AggregateDecl *aggDecl ) { 167 165 if ( aggDecl->get_name() != "" ) 168 166 output << aggDecl->get_name(); 169 167 170 std::list< Declaration * > & memb = aggDecl->get_members();168 std::list< Declaration * > &memb = aggDecl->get_members(); 171 169 if ( ! memb.empty() ) { 172 170 // if ( aggDecl->has_body() ) { 173 // std::list< Declaration * > & memb = aggDecl->get_members();171 // std::list< Declaration * > &memb = aggDecl->get_members(); 174 172 output << " {" << endl; 175 173 … … 187 185 } 188 186 189 void CodeGenerator::visit( StructDecl * structDecl ) {187 void CodeGenerator::visit( StructDecl *structDecl ) { 190 188 extension( structDecl ); 191 189 output << "struct "; … … 193 191 } 194 192 195 void CodeGenerator::visit( UnionDecl * unionDecl ) {193 void CodeGenerator::visit( UnionDecl *unionDecl ) { 196 194 extension( unionDecl ); 197 195 output << "union "; … … 199 197 } 200 198 201 void CodeGenerator::visit( EnumDecl * enumDecl ) {199 void CodeGenerator::visit( EnumDecl *enumDecl ) { 202 200 extension( enumDecl ); 203 201 output << "enum "; … … 213 211 cur_indent += CodeGenerator::tabsize; 214 212 for ( std::list< Declaration* >::iterator i = memb.begin(); i != memb.end(); i++) { 215 ObjectDecl * obj = dynamic_cast< ObjectDecl* >( *i );213 ObjectDecl *obj = dynamic_cast< ObjectDecl* >( *i ); 216 214 assert( obj ); 217 215 output << indent << mangleName( obj ); … … 229 227 } 230 228 231 void CodeGenerator::visit( TraitDecl * traitDecl ) {}232 233 void CodeGenerator::visit( TypedefDecl * typeDecl ) {229 void CodeGenerator::visit( TraitDecl *traitDecl ) {} 230 231 void CodeGenerator::visit( TypedefDecl *typeDecl ) { 234 232 assert( false && "Typedefs are removed and substituted in earlier passes." ); 235 233 //output << "typedef "; … … 237 235 } 238 236 239 void CodeGenerator::visit( TypeDecl * typeDecl ) {237 void CodeGenerator::visit( TypeDecl *typeDecl ) { 240 238 // really, we should mutate this into something that isn't a TypeDecl but that requires large-scale changes, 241 239 // still to be done … … 265 263 } 266 264 267 void CodeGenerator::visit( SingleInit * init ) {265 void CodeGenerator::visit( SingleInit *init ) { 268 266 printDesignators( init->get_designators() ); 269 267 init->get_value()->accept( *this ); 270 268 } 271 269 272 void CodeGenerator::visit( ListInit * init ) {270 void CodeGenerator::visit( ListInit *init ) { 273 271 printDesignators( init->get_designators() ); 274 272 output << "{ "; 275 if ( init->begin () == init->end() ) {273 if ( init->begin_initializers() == init->end_initializers() ) { 276 274 // illegal to leave initializer list empty for scalar initializers, but always legal to have 0 277 275 output << "0"; 278 276 } else { 279 genCommaList( init->begin (), init->end() );280 } // if277 genCommaList( init->begin_initializers(), init->end_initializers() ); 278 } 281 279 output << " }"; 282 280 } 283 281 284 void CodeGenerator::visit( Constant * constant ) {282 void CodeGenerator::visit( Constant *constant ) { 285 283 output << constant->get_value() ; 286 284 } 287 285 288 286 //*** Expressions 289 void CodeGenerator::visit( ApplicationExpr * applicationExpr ) {287 void CodeGenerator::visit( ApplicationExpr *applicationExpr ) { 290 288 extension( applicationExpr ); 291 if ( VariableExpr * varExpr = dynamic_cast< VariableExpr* >( applicationExpr->get_function() ) ) {289 if ( VariableExpr *varExpr = dynamic_cast< VariableExpr* >( applicationExpr->get_function() ) ) { 292 290 OperatorInfo opInfo; 293 291 if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic && operatorLookup( varExpr->get_var()->get_name(), opInfo ) ) { … … 301 299 { 302 300 assert( arg != applicationExpr->get_args().end() ); 303 if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) {301 if ( AddressExpr *addrExpr = dynamic_cast< AddressExpr * >( *arg ) ) { 304 302 // remove & from first assignment/ctor argument 305 303 *arg = addrExpr->get_arg(); 306 304 } else { 307 305 // no address-of operator, so must be a pointer - add dereference 308 UntypedExpr * newExpr = new UntypedExpr( new NameExpr( "*?" ) );306 UntypedExpr *newExpr = new UntypedExpr( new NameExpr( "*?" ) ); 309 307 newExpr->get_args().push_back( *arg ); 310 308 assert( (*arg)->get_results().size() == 1 ); … … 354 352 // no constructors with 0 or more than 2 parameters 355 353 assert( false ); 356 } // if354 } 357 355 break; 358 356 … … 403 401 } 404 402 405 void CodeGenerator::visit( UntypedExpr * untypedExpr ) {403 void CodeGenerator::visit( UntypedExpr *untypedExpr ) { 406 404 extension( untypedExpr ); 407 if ( NameExpr * nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) {405 if ( NameExpr *nameExpr = dynamic_cast< NameExpr* >( untypedExpr->get_function() ) ) { 408 406 OperatorInfo opInfo; 409 407 if ( operatorLookup( nameExpr->get_name(), opInfo ) ) { … … 474 472 } // switch 475 473 } else { 476 if ( nameExpr->get_name() == " ..." ) { // case V1 ... V2 or case V1~V2474 if ( nameExpr->get_name() == "Range" ) { // case V1 ... V2 or case V1~V2 477 475 assert( untypedExpr->get_args().size() == 2 ); 478 476 (*untypedExpr->get_args().begin())->accept( *this ); … … 494 492 } 495 493 496 void CodeGenerator::visit( RangeExpr * rangeExpr ) { 497 rangeExpr->get_low()->accept( *this ); 498 output << " ... "; 499 rangeExpr->get_high()->accept( *this ); 500 } 501 502 void CodeGenerator::visit( NameExpr * nameExpr ) { 494 void CodeGenerator::visit( NameExpr *nameExpr ) { 503 495 extension( nameExpr ); 504 496 OperatorInfo opInfo; … … 511 503 } 512 504 513 void CodeGenerator::visit( AddressExpr * addressExpr ) {505 void CodeGenerator::visit( AddressExpr *addressExpr ) { 514 506 extension( addressExpr ); 515 507 output << "(&"; 516 508 // this hack makes sure that we don't convert "constant_zero" to "0" if we're taking its address 517 if ( VariableExpr * variableExpr = dynamic_cast< VariableExpr* >( addressExpr->get_arg() ) ) {509 if ( VariableExpr *variableExpr = dynamic_cast< VariableExpr* >( addressExpr->get_arg() ) ) { 518 510 output << mangleName( variableExpr->get_var() ); 519 511 } else { … … 523 515 } 524 516 525 void CodeGenerator::visit( CastExpr * castExpr ) {517 void CodeGenerator::visit( CastExpr *castExpr ) { 526 518 extension( castExpr ); 527 519 output << "("; … … 541 533 } 542 534 543 void CodeGenerator::visit( UntypedMemberExpr * memberExpr ) {535 void CodeGenerator::visit( UntypedMemberExpr *memberExpr ) { 544 536 assert( false ); 545 537 } 546 538 547 void CodeGenerator::visit( MemberExpr * memberExpr ) {539 void CodeGenerator::visit( MemberExpr *memberExpr ) { 548 540 extension( memberExpr ); 549 541 memberExpr->get_aggregate()->accept( *this ); … … 551 543 } 552 544 553 void CodeGenerator::visit( VariableExpr * variableExpr ) {545 void CodeGenerator::visit( VariableExpr *variableExpr ) { 554 546 extension( variableExpr ); 555 547 OperatorInfo opInfo; … … 561 553 } 562 554 563 void CodeGenerator::visit( ConstantExpr * constantExpr ) {555 void CodeGenerator::visit( ConstantExpr *constantExpr ) { 564 556 assert( constantExpr->get_constant() ); 565 557 extension( constantExpr ); … … 567 559 } 568 560 569 void CodeGenerator::visit( SizeofExpr * sizeofExpr ) {561 void CodeGenerator::visit( SizeofExpr *sizeofExpr ) { 570 562 extension( sizeofExpr ); 571 563 output << "sizeof("; … … 578 570 } 579 571 580 void CodeGenerator::visit( AlignofExpr * alignofExpr ) {572 void CodeGenerator::visit( AlignofExpr *alignofExpr ) { 581 573 // use GCC extension to avoid bumping std to C11 582 574 extension( alignofExpr ); … … 590 582 } 591 583 592 void CodeGenerator::visit( UntypedOffsetofExpr * offsetofExpr ) {584 void CodeGenerator::visit( UntypedOffsetofExpr *offsetofExpr ) { 593 585 assert( false && "UntypedOffsetofExpr should not reach code generation." ); 594 586 } 595 587 596 void CodeGenerator::visit( OffsetofExpr * offsetofExpr ) {588 void CodeGenerator::visit( OffsetofExpr *offsetofExpr ) { 597 589 // use GCC builtin 598 590 output << "__builtin_offsetof("; … … 602 594 } 603 595 604 void CodeGenerator::visit( OffsetPackExpr * offsetPackExpr ) {596 void CodeGenerator::visit( OffsetPackExpr *offsetPackExpr ) { 605 597 assert( false && "OffsetPackExpr should not reach code generation." ); 606 598 } 607 599 608 void CodeGenerator::visit( LogicalExpr * logicalExpr ) {600 void CodeGenerator::visit( LogicalExpr *logicalExpr ) { 609 601 extension( logicalExpr ); 610 602 output << "("; … … 619 611 } 620 612 621 void CodeGenerator::visit( ConditionalExpr * conditionalExpr ) {613 void CodeGenerator::visit( ConditionalExpr *conditionalExpr ) { 622 614 extension( conditionalExpr ); 623 615 output << "("; … … 630 622 } 631 623 632 void CodeGenerator::visit( CommaExpr * commaExpr ) {624 void CodeGenerator::visit( CommaExpr *commaExpr ) { 633 625 extension( commaExpr ); 634 626 output << "("; … … 639 631 } 640 632 641 void CodeGenerator::visit( TupleExpr * tupleExpr ) {}642 643 void CodeGenerator::visit( TypeExpr * typeExpr ) {}644 645 void CodeGenerator::visit( AsmExpr * asmExpr ) {633 void CodeGenerator::visit( TupleExpr *tupleExpr ) {} 634 635 void CodeGenerator::visit( TypeExpr *typeExpr ) {} 636 637 void CodeGenerator::visit( AsmExpr *asmExpr ) { 646 638 if ( asmExpr->get_inout() ) { 647 639 output << "[ "; … … 656 648 657 649 //*** Statements 658 void CodeGenerator::visit( CompoundStmt * compoundStmt ) {650 void CodeGenerator::visit( CompoundStmt *compoundStmt ) { 659 651 std::list<Statement*> ks = compoundStmt->get_kids(); 660 652 output << "{" << endl; … … 670 662 output << endl; 671 663 } // if 672 } // for664 } 673 665 cur_indent -= CodeGenerator::tabsize; 674 666 … … 676 668 } 677 669 678 void CodeGenerator::visit( ExprStmt * exprStmt ) {670 void CodeGenerator::visit( ExprStmt *exprStmt ) { 679 671 assert( exprStmt ); 680 672 // cast the top-level expression to void to reduce gcc warnings. … … 684 676 } 685 677 686 void CodeGenerator::visit( AsmStmt * asmStmt ) {678 void CodeGenerator::visit( AsmStmt *asmStmt ) { 687 679 output << "asm "; 688 680 if ( asmStmt->get_voltile() ) output << "volatile "; … … 707 699 } 708 700 709 void CodeGenerator::visit( IfStmt * ifStmt ) {701 void CodeGenerator::visit( IfStmt *ifStmt ) { 710 702 output << "if ( "; 711 703 ifStmt->get_condition()->accept( *this ); … … 720 712 } 721 713 722 void CodeGenerator::visit( SwitchStmt * switchStmt ) {714 void CodeGenerator::visit( SwitchStmt *switchStmt ) { 723 715 output << "switch ( " ; 724 716 switchStmt->get_condition()->accept( *this ); … … 727 719 output << "{" << std::endl; 728 720 cur_indent += CodeGenerator::tabsize; 729 acceptAll( switchStmt->get_statements(), *this ); 721 722 acceptAll( switchStmt->get_branches(), *this ); 723 730 724 cur_indent -= CodeGenerator::tabsize; 725 731 726 output << indent << "}"; 732 727 } 733 728 734 void CodeGenerator::visit( CaseStmt * caseStmt ) {729 void CodeGenerator::visit( CaseStmt *caseStmt ) { 735 730 output << indent; 736 731 if ( caseStmt->isDefault()) { … … 753 748 } 754 749 755 void CodeGenerator::visit( BranchStmt * branchStmt ) {750 void CodeGenerator::visit( BranchStmt *branchStmt ) { 756 751 switch ( branchStmt->get_type()) { 757 752 case BranchStmt::Goto: … … 776 771 777 772 778 void CodeGenerator::visit( ReturnStmt * returnStmt ) {773 void CodeGenerator::visit( ReturnStmt *returnStmt ) { 779 774 output << "return "; 780 775 maybeAccept( returnStmt->get_expr(), *this ); … … 782 777 } 783 778 784 void CodeGenerator::visit( WhileStmt * whileStmt ) {779 void CodeGenerator::visit( WhileStmt *whileStmt ) { 785 780 if ( whileStmt->get_isDoWhile() ) { 786 781 output << "do" ; … … 804 799 } 805 800 806 void CodeGenerator::visit( ForStmt * forStmt ) {801 void CodeGenerator::visit( ForStmt *forStmt ) { 807 802 // initialization is always hoisted, so don't bother doing anything with that 808 803 output << "for (;"; … … 826 821 } 827 822 828 void CodeGenerator::visit( NullStmt * nullStmt ) {823 void CodeGenerator::visit( NullStmt *nullStmt ) { 829 824 //output << indent << CodeGenerator::printLabels( nullStmt->get_labels() ); 830 825 output << "/* null statement */ ;"; 831 826 } 832 827 833 void CodeGenerator::visit( DeclStmt * declStmt ) {828 void CodeGenerator::visit( DeclStmt *declStmt ) { 834 829 declStmt->get_decl()->accept( *this ); 835 830 … … 839 834 } 840 835 841 void CodeGenerator::handleStorageClass( Declaration * decl ) {836 void CodeGenerator::handleStorageClass( Declaration *decl ) { 842 837 switch ( decl->get_storageClass() ) { 843 838 case DeclarationNode::Extern: -
src/CodeGen/CodeGenerator.h
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 4 13:37:07201613 // Update Count : 3 812 // Last Modified On : Sat Jul 30 11:10:42 2016 13 // Update Count : 37 14 14 // 15 15 … … 54 54 virtual void visit( ApplicationExpr *applicationExpr ); 55 55 virtual void visit( UntypedExpr *untypedExpr ); 56 virtual void visit( RangeExpr * rangeExpr );57 56 virtual void visit( NameExpr *nameExpr ); 58 57 virtual void visit( AddressExpr *addressExpr ); -
src/ControlStruct/MLEMutator.cc
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:21:32201613 // Update Count : 20212 // Last Modified On : Tue Jul 12 17:36:51 2016 13 // Update Count : 197 14 14 // 15 15 … … 128 128 Label brkLabel = generator->newLabel("switchBreak"); 129 129 enclosingControlStructures.push_back( Entry(switchStmt, brkLabel) ); 130 mutateAll( switchStmt->get_ statements(), *this );130 mutateAll( switchStmt->get_branches(), *this ); 131 131 132 132 Entry &e = enclosingControlStructures.back(); … … 138 138 // switch should be CastStmts), append the exit label + break to the last case statement; create a default 139 139 // case if there are no cases 140 std::list< Statement * > & statements = switchStmt->get_statements();141 if ( statements.empty() ) {142 statements.push_back( CaseStmt::makeDefault() );143 } // if 144 145 if ( CaseStmt * c = dynamic_cast< CaseStmt * >( statements.back() ) ) {140 std::list< Statement * > &branches = switchStmt->get_branches(); 141 if ( branches.empty() ) { 142 branches.push_back( CaseStmt::makeDefault() ); 143 } // if 144 145 if ( CaseStmt * c = dynamic_cast< CaseStmt * >( branches.back() ) ) { 146 146 std::list<Label> temp; temp.push_back( brkLabel ); 147 147 c->get_statements().push_back( new BranchStmt( temp, Label("brkLabel"), BranchStmt::Break ) ); 148 } else assert(0); // as of this point, all statements of a switch are still CaseStmts148 } else assert(0); // as of this point, all branches of a switch are still CaseStmts 149 149 } // if 150 150 -
src/ControlStruct/Mutate.cc
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:39:08201613 // Update Count : 912 // Last Modified On : Tue Jul 12 17:37:45 2016 13 // Update Count : 8 14 14 // 15 15 … … 22 22 #include "LabelFixer.h" 23 23 #include "MLEMutator.h" 24 #include "CaseRangeMutator.h" 24 25 #include "ForExprMutator.h" 25 26 #include "LabelTypeChecker.h" … … 40 41 LabelFixer lfix; 41 42 43 // expand case ranges and turn fallthru into a null statement 44 CaseRangeMutator ranges; 45 42 46 //ExceptMutator exc; 43 47 // LabelTypeChecker lbl; … … 45 49 mutateAll( translationUnit, formut ); 46 50 acceptAll( translationUnit, lfix ); 51 mutateAll( translationUnit, ranges ); 47 52 //mutateAll( translationUnit, exc ); 48 53 //acceptAll( translationUnit, lbl ); -
src/ControlStruct/module.mk
rc331406 r5070fe4 11 11 ## Created On : Mon Jun 1 17:49:17 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : T hu Aug 4 11:38:06201614 ## Update Count : 313 ## Last Modified On : Tue Jul 12 17:40:31 2016 14 ## Update Count : 2 15 15 ############################################################################### 16 16 … … 18 18 ControlStruct/LabelFixer.cc \ 19 19 ControlStruct/MLEMutator.cc \ 20 ControlStruct/CaseRangeMutator.cc \ 20 21 ControlStruct/Mutate.cc \ 21 22 ControlStruct/ForExprMutator.cc \ -
src/GenPoly/DeclMutator.cc
rc331406 r5070fe4 10 10 // Created On : Fri Nov 27 14:44:00 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:16:43201613 // Update Count : 312 // Last Modified On : Tue Jul 12 17:38:46 2016 13 // Update Count : 2 14 14 // 15 15 … … 163 163 Statement* DeclMutator::mutate(SwitchStmt *switchStmt) { 164 164 switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) ); 165 mutateAll( switchStmt->get_ statements(), *this );165 mutateAll( switchStmt->get_branches(), *this ); 166 166 return switchStmt; 167 167 } -
src/GenPoly/DeclMutator.h
rc331406 r5070fe4 28 28 class DeclMutator : public Mutator { 29 29 public: 30 typedef Mutator Parent;31 32 30 DeclMutator(); 33 31 virtual ~DeclMutator(); 34 35 using Parent::mutate; 32 36 33 virtual CompoundStmt* mutate(CompoundStmt *compoundStmt); 37 34 virtual Statement* mutate(IfStmt *ifStmt); … … 45 42 /// Mutates a list of declarations with this visitor 46 43 void mutateDeclarationList(std::list< Declaration* >& decls); 47 44 48 45 /// Called on entry to a new scope; overriders should call this as a super-class call 49 46 virtual void doBeginScope(); -
src/GenPoly/PolyMutator.cc
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:26:22 201613 // Update Count : 1 612 // Last Modified On : Tue Jul 12 17:39:32 2016 13 // Update Count : 12 14 14 // 15 15 … … 99 99 100 100 Statement * PolyMutator::mutate(SwitchStmt *switchStmt) { 101 mutateStatementList( switchStmt->get_ statements() );101 mutateStatementList( switchStmt->get_branches() ); 102 102 switchStmt->set_condition( mutateExpression( switchStmt->get_condition() ) ); 103 103 return switchStmt; -
src/GenPoly/Specialize.cc
rc331406 r5070fe4 31 31 #include "Common/UniqueName.h" 32 32 #include "Common/utility.h" 33 #include "InitTweak/InitTweak.h"34 33 35 34 namespace GenPoly { … … 185 184 mutateAll( appExpr->get_args(), *this ); 186 185 187 if ( ! InitTweak::isIntrinsicCallExpr( appExpr ) ) { 188 // create thunks for the inferred parameters 189 // don't need to do this for intrinsic calls, because they aren't actually passed 190 for ( InferredParams::iterator inferParam = appExpr->get_inferParams().begin(); inferParam != appExpr->get_inferParams().end(); ++inferParam ) { 191 inferParam->second.expr = doSpecialization( inferParam->second.formalType, inferParam->second.expr, &appExpr->get_inferParams() ); 192 } 193 194 handleExplicitParams( appExpr ); 195 } 186 // create thunks for the inferred parameters 187 for ( InferredParams::iterator inferParam = appExpr->get_inferParams().begin(); inferParam != appExpr->get_inferParams().end(); ++inferParam ) { 188 inferParam->second.expr = doSpecialization( inferParam->second.formalType, inferParam->second.expr, &appExpr->get_inferParams() ); 189 } 190 191 handleExplicitParams( appExpr ); 196 192 197 193 return appExpr; -
src/InitTweak/FixGlobalInit.cc
rc331406 r5070fe4 46 46 FunctionDecl * destroyFunction; 47 47 }; 48 49 class ConstExprChecker : public Visitor { 50 public: 51 ConstExprChecker() : isConstExpr( true ) {} 52 53 virtual void visit( ApplicationExpr *applicationExpr ) { isConstExpr = false; } 54 virtual void visit( UntypedExpr *untypedExpr ) { isConstExpr = false; } 55 virtual void visit( NameExpr *nameExpr ) { isConstExpr = false; } 56 virtual void visit( CastExpr *castExpr ) { isConstExpr = false; } 57 virtual void visit( LabelAddressExpr *labAddressExpr ) { isConstExpr = false; } 58 virtual void visit( UntypedMemberExpr *memberExpr ) { isConstExpr = false; } 59 virtual void visit( MemberExpr *memberExpr ) { isConstExpr = false; } 60 virtual void visit( VariableExpr *variableExpr ) { isConstExpr = false; } 61 virtual void visit( ConstantExpr *constantExpr ) { /* bottom out */ } 62 // these might be okay? 63 // virtual void visit( SizeofExpr *sizeofExpr ); 64 // virtual void visit( AlignofExpr *alignofExpr ); 65 // virtual void visit( UntypedOffsetofExpr *offsetofExpr ); 66 // virtual void visit( OffsetofExpr *offsetofExpr ); 67 // virtual void visit( OffsetPackExpr *offsetPackExpr ); 68 // virtual void visit( AttrExpr *attrExpr ); 69 // virtual void visit( CommaExpr *commaExpr ); 70 // virtual void visit( LogicalExpr *logicalExpr ); 71 // virtual void visit( ConditionalExpr *conditionalExpr ); 72 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; } 73 virtual void visit( SolvedTupleExpr *tupleExpr ) { isConstExpr = false; } 74 virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; } 75 virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; } 76 virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; } 77 virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; } 78 79 bool isConstExpr; 80 }; 81 82 bool isConstExpr( Initializer * init ) { 83 if ( init ) { 84 ConstExprChecker checker; 85 init->accept( checker ); 86 return checker.isConstExpr; 87 } // if 88 // for all intents and purposes, no initializer means const expr 89 return true; 90 } 48 91 49 92 void fixGlobalInit( std::list< Declaration * > & translationUnit, const std::string & name, bool inLibrary ) { … … 97 140 std::list< Statement * > & destroyStatements = destroyFunction->get_statements()->get_kids(); 98 141 142 if ( ! tryConstruct( objDecl ) ) return; // don't construct @= or designated objects 143 if ( objDecl->get_storageClass() == DeclarationNode::Extern ) return; 99 144 // C allows you to initialize objects with constant expressions 100 145 // xxx - this is an optimization. Need to first resolve constructors before we decide … … 102 147 // if ( isConstExpr( objDecl->get_init() ) ) return; 103 148 104 if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) { 105 // a decision should have been made by the resolver, so ctor and init are not both non-NULL 106 assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() ); 149 if ( dynamic_cast< ArrayType * > ( objDecl->get_type() ) ) { 150 // xxx - initialize each element of the array 151 } else { 152 // steal initializer from object and attach it to a new temporary 153 ObjectDecl *newObj = new ObjectDecl( tempNamer.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, objDecl->get_type()->clone(), objDecl->get_init() ); 154 objDecl->set_init( NULL ); 155 initStatements.push_back( new DeclStmt( noLabels, newObj ) ); 107 156 108 Statement * dtor = ctorInit->get_dtor(); 109 if ( dtor && ! isIntrinsicSingleArgCallStmt( dtor ) ) { 110 // don't need to call intrinsic dtor, because it does nothing, but 111 // non-intrinsic dtors must be called 112 destroyStatements.push_front( dtor ); 113 ctorInit->set_dtor( NULL ); 114 } // if 115 if ( Statement * ctor = ctorInit->get_ctor() ) { 116 initStatements.push_back( ctor ); 117 objDecl->set_init( NULL ); 118 ctorInit->set_ctor( NULL ); 119 } else if ( Initializer * init = ctorInit->get_init() ) { 120 objDecl->set_init( init ); 121 ctorInit->set_init( NULL ); 122 } else { 123 // no constructor and no initializer, which is okay 124 objDecl->set_init( NULL ); 125 } // if 126 delete ctorInit; 157 // copy construct objDecl using temporary 158 UntypedExpr * init = new UntypedExpr( new NameExpr( "?{}" ) ); 159 init->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 160 init->get_args().push_back( new VariableExpr( newObj ) ); 161 initStatements.push_back( new ImplicitCtorDtorStmt( new ExprStmt( noLabels, init ) ) ); 162 163 // add destructor calls to global destroy function 164 UntypedExpr * destroy = new UntypedExpr( new NameExpr( "^?{}" ) ); 165 destroy->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 166 destroyStatements.push_front( new ImplicitCtorDtorStmt( new ExprStmt( noLabels, destroy ) ) ); 127 167 } // if 128 168 } -
src/InitTweak/FixInit.cc
rc331406 r5070fe4 18 18 #include <iterator> 19 19 #include <algorithm> 20 #include "FixInit.h" 20 21 #include "InitTweak.h" 21 #include "FixInit.h"22 #include "FixGlobalInit.h"23 22 #include "ResolvExpr/Resolver.h" 24 23 #include "ResolvExpr/typeops.h" … … 26 25 #include "SynTree/Type.h" 27 26 #include "SynTree/Expression.h" 28 #include "SynTree/Attribute.h"29 27 #include "SynTree/Statement.h" 30 28 #include "SynTree/Initializer.h" … … 85 83 }; 86 84 87 // debug88 85 struct printSet { 89 86 typedef ObjDeclCollector::ObjectSet ObjectSet; … … 162 159 163 160 virtual DeclarationWithType * mutate( ObjectDecl *objDecl ); 164 165 std::list< Declaration * > staticDtorDecls;166 161 }; 167 162 … … 176 171 } // namespace 177 172 178 void fix( std::list< Declaration * > & translationUnit, const std::string & filename, bool inLibrary ) { 179 // fixes ConstructorInit for global variables. should happen before fixInitializers. 180 InitTweak::fixGlobalInit( translationUnit, filename, inLibrary ); 181 173 void fix( std::list< Declaration * > & translationUnit ) { 182 174 InsertImplicitCalls::insert( translationUnit ); 183 175 ResolveCopyCtors::resolveImplicitCalls( translationUnit ); … … 202 194 void FixInit::fixInitializers( std::list< Declaration * > & translationUnit ) { 203 195 FixInit fixer; 204 205 // can't use mutateAll, because need to insert declarations at top-level 206 // can't use DeclMutator, because sometimes need to insert IfStmt, etc. 207 SemanticError errors; 208 for ( std::list< Declaration * >::iterator i = translationUnit.begin(); i != translationUnit.end(); ++i ) { 209 try { 210 *i = maybeMutate( *i, fixer ); 211 translationUnit.splice( i, fixer.staticDtorDecls ); 212 } catch( SemanticError &e ) { 213 errors.append( e ); 214 } // try 215 } // for 216 if ( ! errors.isEmpty() ) { 217 throw errors; 218 } // if 196 mutateAll( translationUnit, fixer ); 219 197 } 220 198 … … 444 422 if ( Statement * ctor = ctorInit->get_ctor() ) { 445 423 if ( objDecl->get_storageClass() == DeclarationNode::Static ) { 446 // originally wanted to take advantage of gcc nested functions, but447 // we get memory errors with this approach. To remedy this, the static448 // variable is hoisted when the destructor needs to be called.449 //450 424 // generate: 451 // static T __objName_static_varN; 452 // void __objName_dtor_atexitN() { 453 // __dtor__...; 425 // static bool __objName_uninitialized = true; 426 // if (__objName_uninitialized) { 427 // __ctor(__objName); 428 // void dtor_atexit() { 429 // __dtor(__objName); 430 // } 431 // on_exit(dtorOnExit, &__objName); 432 // __objName_uninitialized = false; 454 433 // } 455 // int f(...) { 456 // ... 457 // static bool __objName_uninitialized = true; 458 // if (__objName_uninitialized) { 459 // __ctor(__objName); 460 // __objName_uninitialized = false; 461 // atexit(__objName_dtor_atexitN); 462 // } 463 // ... 464 // } 465 466 static UniqueName dtorCallerNamer( "_dtor_atexit" ); 467 468 // static bool __objName_uninitialized = true 434 435 // generate first line 469 436 BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool ); 470 437 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant( boolType->clone(), "1" ) ), noDesignators ); … … 472 439 isUninitializedVar->fixUniqueId(); 473 440 441 // void dtor_atexit(...) {...} 442 FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + "_dtor_atexit", DeclarationNode::NoStorageClass, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ), false, false ); 443 dtorCaller->fixUniqueId(); 444 dtorCaller->get_statements()->get_kids().push_back( ctorInit->get_dtor()->clone() ); 445 446 // on_exit(dtor_atexit); 447 UntypedExpr * callAtexit = new UntypedExpr( new NameExpr( "atexit" ) ); 448 callAtexit->get_args().push_back( new VariableExpr( dtorCaller ) ); 449 474 450 // __objName_uninitialized = false; 475 451 UntypedExpr * setTrue = new UntypedExpr( new NameExpr( "?=?" ) ); … … 481 457 std::list< Statement * > & body = initStmts->get_kids(); 482 458 body.push_back( ctor ); 459 body.push_back( new DeclStmt( noLabels, dtorCaller ) ); 460 body.push_back( new ExprStmt( noLabels, callAtexit ) ); 483 461 body.push_back( new ExprStmt( noLabels, setTrue ) ); 484 462 … … 487 465 stmtsToAddAfter.push_back( new DeclStmt( noLabels, isUninitializedVar ) ); 488 466 stmtsToAddAfter.push_back( ifStmt ); 489 490 if ( ctorInit->get_dtor() ) {491 // if the object has a non-trivial destructor, have to492 // hoist it and the object into the global space and493 // call the destructor function with atexit.494 495 Statement * dtorStmt = ctorInit->get_dtor()->clone();496 497 // void __objName_dtor_atexitN(...) {...}498 FunctionDecl * dtorCaller = new FunctionDecl( objDecl->get_mangleName() + dtorCallerNamer.newName(), DeclarationNode::Static, LinkageSpec::C, new FunctionType( Type::Qualifiers(), false ), new CompoundStmt( noLabels ), false, false );499 dtorCaller->fixUniqueId();500 dtorCaller->get_statements()->get_kids().push_back( dtorStmt );501 502 // atexit(dtor_atexit);503 UntypedExpr * callAtexit = new UntypedExpr( new NameExpr( "atexit" ) );504 callAtexit->get_args().push_back( new VariableExpr( dtorCaller ) );505 506 body.push_back( new ExprStmt( noLabels, callAtexit ) );507 508 // hoist variable and dtor caller decls to list of decls that will be added into global scope509 staticDtorDecls.push_back( objDecl );510 staticDtorDecls.push_back( dtorCaller );511 512 // need to rename object uniquely since it now appears513 // at global scope and there could be multiple function-scoped514 // static variables with the same name in different functions.515 static UniqueName staticNamer( "_static_var" );516 objDecl->set_mangleName( objDecl->get_mangleName() + staticNamer.newName() );517 518 objDecl->set_init( NULL );519 ctorInit->set_ctor( NULL );520 delete ctorInit;521 522 // xxx - temporary hack: need to return a declaration, but want to hoist the current object out of this scope523 // create a new object which is never used524 static UniqueName dummyNamer( "_dummy" );525 ObjectDecl * dummy = new ObjectDecl( dummyNamer.newName(), DeclarationNode::Static, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new VoidType( Type::Qualifiers() ) ), 0, std::list< Attribute * >{ new Attribute("unused") } );526 return dummy;527 }528 467 } else { 529 468 stmtsToAddAfter.push_back( ctor ); … … 585 524 assert( ! ctorInit->get_ctor() || ! ctorInit->get_init() ); 586 525 Statement * dtor = ctorInit->get_dtor(); 587 if ( dtor && ! isIn trinsicSingleArgCallStmt( dtor ) ) {526 if ( dtor && ! isInstrinsicSingleArgCallStmt( dtor ) ) { 588 527 // don't need to call intrinsic dtor, because it does nothing, but 589 528 // non-intrinsic dtors must be called -
src/InitTweak/FixInit.h
rc331406 r5070fe4 27 27 /// replace constructor initializers with expression statements 28 28 /// and unwrap basic C-style initializers 29 void fix( std::list< Declaration * > & translationUnit , const std::string & name, bool inLibrary);29 void fix( std::list< Declaration * > & translationUnit ); 30 30 } // namespace 31 31 -
src/InitTweak/GenInit.cc
rc331406 r5070fe4 26 26 #include "SymTab/Autogen.h" 27 27 #include "GenPoly/PolyMutator.h" 28 #include "GenPoly/DeclMutator.h"29 28 30 29 namespace InitTweak { … … 56 55 public: 57 56 /// create constructor and destructor statements for object declarations. 58 /// the actual call statements will be added in after the resolver has run59 /// so that the initializer expression is only removed if a constructor is found60 /// and the same destructor call is inserted in all of the appropriate locations.57 /// Destructors are inserted directly into the code, whereas constructors 58 /// will be added in after the resolver has run so that the initializer expression 59 /// is only removed if a constructor is found 61 60 static void generateCtorDtor( std::list< Declaration * > &translationUnit ); 61 62 CtorDtor() : inFunction( false ) {} 62 63 63 64 virtual DeclarationWithType * mutate( ObjectDecl * ); 64 65 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ); 65 // should not traverse into any of these declarations to find objects 66 // that need to be constructed or destructed 67 virtual Declaration* mutate( StructDecl *aggregateDecl ) { return aggregateDecl; } 68 virtual Declaration* mutate( UnionDecl *aggregateDecl ) { return aggregateDecl; } 69 virtual Declaration* mutate( EnumDecl *aggregateDecl ) { return aggregateDecl; } 70 virtual Declaration* mutate( TraitDecl *aggregateDecl ) { return aggregateDecl; } 71 virtual TypeDecl* mutate( TypeDecl *typeDecl ) { return typeDecl; } 72 virtual Declaration* mutate( TypedefDecl *typeDecl ) { return typeDecl; } 73 74 virtual Type * mutate( FunctionType *funcType ) { return funcType; } 66 virtual Declaration* mutate( StructDecl *aggregateDecl ); 67 virtual Declaration* mutate( UnionDecl *aggregateDecl ); 68 virtual Declaration* mutate( EnumDecl *aggregateDecl ); 69 virtual Declaration* mutate( TraitDecl *aggregateDecl ); 70 virtual TypeDecl* mutate( TypeDecl *typeDecl ); 71 virtual Declaration* mutate( TypedefDecl *typeDecl ); 72 73 virtual Type * mutate( FunctionType *funcType ); 75 74 76 75 protected: 77 }; 78 79 class HoistArrayDimension : public GenPoly::DeclMutator { 80 public: 81 typedef GenPoly::DeclMutator Parent; 82 83 /// hoist dimension from array types in object declaration so that it uses a single 84 /// const variable of type size_t, so that side effecting array dimensions are only 85 /// computed once. 86 static void hoistArrayDimension( std::list< Declaration * > & translationUnit ); 87 88 private: 89 virtual DeclarationWithType * mutate( ObjectDecl * objectDecl ); 90 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ); 91 // should not traverse into any of these declarations to find objects 92 // that need to be constructed or destructed 93 virtual Declaration* mutate( StructDecl *aggregateDecl ) { return aggregateDecl; } 94 virtual Declaration* mutate( UnionDecl *aggregateDecl ) { return aggregateDecl; } 95 virtual Declaration* mutate( EnumDecl *aggregateDecl ) { return aggregateDecl; } 96 virtual Declaration* mutate( TraitDecl *aggregateDecl ) { return aggregateDecl; } 97 virtual TypeDecl* mutate( TypeDecl *typeDecl ) { return typeDecl; } 98 virtual Declaration* mutate( TypedefDecl *typeDecl ) { return typeDecl; } 99 100 virtual Type* mutate( FunctionType *funcType ) { return funcType; } 101 102 void hoist( Type * type ); 103 104 DeclarationNode::StorageClass storageclass = DeclarationNode::NoStorageClass; 105 bool inFunction = false; 76 bool inFunction; 106 77 }; 107 78 108 79 void genInit( std::list< Declaration * > & translationUnit ) { 109 80 ReturnFixer::makeReturnTemp( translationUnit ); 110 HoistArrayDimension::hoistArrayDimension( translationUnit );111 81 CtorDtor::generateCtorDtor( translationUnit ); 112 82 } … … 154 124 } 155 125 156 // precompute array dimension expression, because constructor generation may duplicate it,157 // which would be incorrect if it is a side-effecting computation.158 void HoistArrayDimension::hoistArrayDimension( std::list< Declaration * > & translationUnit ) {159 HoistArrayDimension hoister;160 hoister.mutateDeclarationList( translationUnit );161 }162 163 DeclarationWithType * HoistArrayDimension::mutate( ObjectDecl * objectDecl ) {164 storageclass = objectDecl->get_storageClass();165 DeclarationWithType * temp = Parent::mutate( objectDecl );166 hoist( objectDecl->get_type() );167 storageclass = DeclarationNode::NoStorageClass;168 return temp;169 }170 171 void HoistArrayDimension::hoist( Type * type ) {172 // if in function, generate const size_t var173 static UniqueName dimensionName( "_array_dim" );174 175 // C doesn't allow variable sized arrays at global scope or for static variables,176 // so don't hoist dimension.177 if ( ! inFunction ) return;178 if ( storageclass == DeclarationNode::Static ) return;179 180 if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) {181 if ( ! arrayType->get_dimension() ) return; // xxx - recursive call to hoist?182 183 // don't need to hoist dimension if it's a constexpr - only need to if there's potential184 // for side effects.185 if ( isConstExpr( arrayType->get_dimension() ) ) return;186 187 ObjectDecl * arrayDimension = new ObjectDecl( dimensionName.newName(), storageclass, LinkageSpec::C, 0, SymTab::SizeType->clone(), new SingleInit( arrayType->get_dimension() ) );188 arrayDimension->get_type()->set_isConst( true );189 190 arrayType->set_dimension( new VariableExpr( arrayDimension ) );191 addDeclaration( arrayDimension );192 193 hoist( arrayType->get_base() );194 return;195 }196 }197 198 DeclarationWithType * HoistArrayDimension::mutate( FunctionDecl *functionDecl ) {199 bool oldInFunc = inFunction;200 inFunction = true;201 DeclarationWithType * decl = Parent::mutate( functionDecl );202 inFunction = oldInFunc;203 return decl;204 }205 126 206 127 void CtorDtor::generateCtorDtor( std::list< Declaration * > & translationUnit ) { … … 209 130 } 210 131 132 namespace { 133 Expression * makeCtorDtorExpr( std::string name, ObjectDecl * objDecl, std::list< Expression * > args ) { 134 UntypedExpr * expr = new UntypedExpr( new NameExpr( name ) ); 135 expr->get_args().push_back( new AddressExpr( new VariableExpr( objDecl ) ) ); 136 expr->get_args().splice( expr->get_args().end(), args ); 137 return expr; 138 } 139 } 140 211 141 DeclarationWithType * CtorDtor::mutate( ObjectDecl * objDecl ) { 212 // hands off if designated , if @=, or if extern142 // hands off if designated or if @= 213 143 if ( tryConstruct( objDecl ) ) { 214 // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor 215 // for each constructable object 216 std::list< Statement * > ctor; 217 std::list< Statement * > dtor; 218 219 InitExpander srcParam( objDecl->get_init() ); 220 InitExpander nullParam( (Initializer *)NULL ); 221 SymTab::genImplicitCall( srcParam, new VariableExpr( objDecl ), "?{}", back_inserter( ctor ), objDecl ); 222 SymTab::genImplicitCall( nullParam, new VariableExpr( objDecl ), "^?{}", front_inserter( dtor ), objDecl, false ); 223 224 // Currently genImplicitCall produces a single Statement - a CompoundStmt 225 // which wraps everything that needs to happen. As such, it's technically 226 // possible to use a Statement ** in the above calls, but this is inherently 227 // unsafe, so instead we take the slightly less efficient route, but will be 228 // immediately informed if somehow the above assumption is broken. In this case, 229 // we could always wrap the list of statements at this point with a CompoundStmt, 230 // but it seems reasonable at the moment for this to be done by genImplicitCall 231 // itself. It is possible that genImplicitCall produces no statements (e.g. if 232 // an array type does not have a dimension). In this case, it's fine to ignore 233 // the object for the purposes of construction. 234 assert( ctor.size() == dtor.size() && ctor.size() <= 1 ); 235 if ( ctor.size() == 1 ) { 236 // need to remember init expression, in case no ctors exist 237 // if ctor does exist, want to use ctor expression instead of init 238 // push this decision to the resolver 239 assert( dynamic_cast< ImplicitCtorDtorStmt * > ( ctor.front() ) && dynamic_cast< ImplicitCtorDtorStmt * > ( dtor.front() ) ); 240 objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) ); 144 if ( inFunction ) { 145 if ( ArrayType * at = dynamic_cast< ArrayType * >( objDecl->get_type() ) ) { 146 // call into makeArrayFunction from validate.cc to generate calls to ctor/dtor for each element of array 147 // TODO: walk initializer and generate appropriate copy ctor if element has initializer 148 std::list< Expression * > args = makeInitList( objDecl->get_init() ); 149 if ( args.empty() ) { 150 std::list< Statement * > ctor; 151 std::list< Statement * > dtor; 152 153 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "?{}", back_inserter( ctor ) ); 154 SymTab::makeArrayFunction( NULL, new VariableExpr( objDecl ), at, "^?{}", front_inserter( dtor ), false ); 155 156 // Currently makeArrayFunction produces a single Statement - a CompoundStmt 157 // which wraps everything that needs to happen. As such, it's technically 158 // possible to use a Statement ** in the above calls, but this is inherently 159 // unsafe, so instead we take the slightly less efficient route, but will be 160 // immediately informed if somehow the above assumption is broken. In this case, 161 // we could always wrap the list of statements at this point with a CompoundStmt, 162 // but it seems reasonable at the moment for this to be done by makeArrayFunction 163 // itself 164 assert( ctor.size() == 1 && dynamic_cast< ImplicitCtorDtorStmt * >( ctor.front() ) ); 165 assert( dtor.size() == 1 && dynamic_cast< ImplicitCtorDtorStmt * >( dtor.front() ) ); 166 objDecl->set_init( new ConstructorInit( ctor.front(), dtor.front(), objDecl->get_init() ) ); 167 } else { 168 // array came with an initializer list: initialize each element 169 // may have more initializers than elements in the array - need to check at each index that 170 // we haven't exceeded size. This requires precomputing the size because it might be a side-effecting 171 // computation. 172 // may have fewer initializers than eleemnts in the array - need to default construct 173 // remaining elements. 174 // might be able to merge this with the case above. 175 } 176 } else { 177 // it's sufficient to attempt to call the ctor/dtor for the given object and its initializer 178 Expression * ctor = makeCtorDtorExpr( "?{}", objDecl, makeInitList( objDecl->get_init() ) ); 179 Expression * dtor = makeCtorDtorExpr( "^?{}", objDecl, std::list< Expression * >() ); 180 181 // need to remember init expression, in case no ctors exist 182 // if ctor does exist, want to use ctor expression instead of init 183 // push this decision to the resolver 184 ExprStmt * ctorStmt = new ExprStmt( noLabels, ctor ); 185 ExprStmt * dtorStmt = new ExprStmt( noLabels, dtor ); 186 objDecl->set_init( new ConstructorInit( new ImplicitCtorDtorStmt( ctorStmt ), new ImplicitCtorDtorStmt( dtorStmt ), objDecl->get_init() ) ); 187 } 241 188 } 242 189 } … … 246 193 DeclarationWithType * CtorDtor::mutate( FunctionDecl *functionDecl ) { 247 194 // parameters should not be constructed and destructed, so don't mutate FunctionType 195 bool oldInFunc = inFunction; 248 196 mutateAll( functionDecl->get_oldDecls(), *this ); 197 inFunction = true; 249 198 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) ); 199 inFunction = oldInFunc; 250 200 return functionDecl; 251 201 } 202 203 // should not traverse into any of these declarations to find objects 204 // that need to be constructed or destructed 205 Declaration* CtorDtor::mutate( StructDecl *aggregateDecl ) { return aggregateDecl; } 206 Declaration* CtorDtor::mutate( UnionDecl *aggregateDecl ) { return aggregateDecl; } 207 Declaration* CtorDtor::mutate( EnumDecl *aggregateDecl ) { return aggregateDecl; } 208 Declaration* CtorDtor::mutate( TraitDecl *aggregateDecl ) { return aggregateDecl; } 209 TypeDecl* CtorDtor::mutate( TypeDecl *typeDecl ) { return typeDecl; } 210 Declaration* CtorDtor::mutate( TypedefDecl *typeDecl ) { return typeDecl; } 211 Type* CtorDtor::mutate( FunctionType *funcType ) { return funcType; } 212 252 213 } // namespace InitTweak 253 214 -
src/InitTweak/InitTweak.cc
rc331406 r5070fe4 1 #include <algorithm>2 1 #include "InitTweak.h" 3 2 #include "SynTree/Visitor.h" … … 5 4 #include "SynTree/Initializer.h" 6 5 #include "SynTree/Expression.h" 7 #include "SynTree/Attribute.h"8 6 #include "GenPoly/GenPoly.h" 9 7 … … 22 20 }; 23 21 24 class Init Flattener : public Visitor {22 class InitExpander : public Visitor { 25 23 public: 24 InitExpander() {} 26 25 virtual void visit( SingleInit * singleInit ); 27 26 virtual void visit( ListInit * listInit ); … … 29 28 }; 30 29 31 void Init Flattener::visit( SingleInit * singleInit ) {30 void InitExpander::visit( SingleInit * singleInit ) { 32 31 argList.push_back( singleInit->get_value()->clone() ); 33 32 } 34 33 35 void Init Flattener::visit( ListInit * listInit ) {36 // flattennested list inits37 std::list<Initializer*>::iterator it = listInit->begin ();38 for ( ; it != listInit->end (); ++it ) {34 void InitExpander::visit( ListInit * listInit ) { 35 // xxx - for now, assume no nested list inits 36 std::list<Initializer*>::iterator it = listInit->begin_initializers(); 37 for ( ; it != listInit->end_initializers(); ++it ) { 39 38 (*it)->accept( *this ); 40 39 } … … 43 42 44 43 std::list< Expression * > makeInitList( Initializer * init ) { 45 Init Flattener flattener;46 maybeAccept( init, flattener );47 return flattener.argList;44 InitExpander expander; 45 maybeAccept( init, expander ); 46 return expander.argList; 48 47 } 49 48 … … 54 53 } 55 54 56 class InitExpander::ExpanderImpl {57 public:58 virtual std::list< Expression * > next( std::list< Expression * > & indices ) = 0;59 virtual Statement * buildListInit( UntypedExpr * callExpr, std::list< Expression * > & indices ) = 0;60 };61 62 class InitImpl : public InitExpander::ExpanderImpl {63 public:64 InitImpl( Initializer * init ) : init( init ) {}65 66 virtual std::list< Expression * > next( std::list< Expression * > & indices ) {67 // this is wrong, but just a placeholder for now68 // if ( ! flattened ) flatten( indices );69 // return ! inits.empty() ? makeInitList( inits.front() ) : std::list< Expression * >();70 return makeInitList( init );71 }72 73 virtual Statement * buildListInit( UntypedExpr * callExpr, std::list< Expression * > & indices );74 private:75 Initializer * init;76 };77 78 class ExprImpl : public InitExpander::ExpanderImpl {79 public:80 ExprImpl( Expression * expr ) : arg( expr ) {}81 82 virtual std::list< Expression * > next( std::list< Expression * > & indices ) {83 std::list< Expression * > ret;84 Expression * expr = maybeClone( arg );85 if ( expr ) {86 for ( std::list< Expression * >::reverse_iterator it = indices.rbegin(); it != indices.rend(); ++it ) {87 // go through indices and layer on subscript exprs ?[?]88 ++it;89 UntypedExpr * subscriptExpr = new UntypedExpr( new NameExpr( "?[?]") );90 subscriptExpr->get_args().push_back( expr );91 subscriptExpr->get_args().push_back( (*it)->clone() );92 expr = subscriptExpr;93 }94 ret.push_back( expr );95 }96 return ret;97 }98 99 virtual Statement * buildListInit( UntypedExpr * callExpr, std::list< Expression * > & indices );100 private:101 Expression * arg;102 };103 104 InitExpander::InitExpander( Initializer * init ) : expander( new InitImpl( init ) ) {}105 106 InitExpander::InitExpander( Expression * expr ) : expander( new ExprImpl( expr ) ) {}107 108 std::list< Expression * > InitExpander::operator*() {109 return cur;110 }111 112 InitExpander & InitExpander::operator++() {113 cur = expander->next( indices );114 return *this;115 }116 117 // use array indices list to build switch statement118 void InitExpander::addArrayIndex( Expression * index, Expression * dimension ) {119 indices.push_back( index );120 indices.push_back( dimension );121 }122 123 void InitExpander::clearArrayIndices() {124 indices.clear();125 }126 127 namespace {128 /// given index i, dimension d, initializer init, and callExpr f, generates129 /// if (i < d) f(..., init)130 /// ++i;131 /// so that only elements within the range of the array are constructed132 template< typename OutIterator >133 void buildCallExpr( UntypedExpr * callExpr, Expression * index, Expression * dimension, Initializer * init, OutIterator out ) {134 UntypedExpr * cond = new UntypedExpr( new NameExpr( "?<?") );135 cond->get_args().push_back( index->clone() );136 cond->get_args().push_back( dimension->clone() );137 138 std::list< Expression * > args = makeInitList( init );139 callExpr->get_args().splice( callExpr->get_args().end(), args );140 141 *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), NULL );142 143 UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) );144 increment->get_args().push_back( new AddressExpr( index->clone() ) );145 *out++ = new ExprStmt( noLabels, increment );146 }147 148 template< typename OutIterator >149 void build( UntypedExpr * callExpr, InitExpander::IndexList::iterator idx, InitExpander::IndexList::iterator idxEnd, Initializer * init, OutIterator out ) {150 if ( idx == idxEnd ) return;151 Expression * index = *idx++;152 assert( idx != idxEnd );153 Expression * dimension = *idx++;154 155 // xxx - may want to eventually issue a warning here if we can detect156 // that the number of elements exceeds to dimension of the array157 if ( idx == idxEnd ) {158 if ( ListInit * listInit = dynamic_cast< ListInit * >( init ) ) {159 for ( Initializer * init : *listInit ) {160 buildCallExpr( callExpr->clone(), index, dimension, init, out );161 }162 } else {163 buildCallExpr( callExpr->clone(), index, dimension, init, out );164 }165 } else {166 std::list< Statement * > branches;167 168 unsigned long cond = 0;169 ListInit * listInit = dynamic_cast< ListInit * >( init );170 if ( ! listInit ) {171 // xxx - this shouldn't be an error, but need a way to172 // terminate without creating output, so should catch this error173 throw SemanticError( "unbalanced list initializers" );174 }175 176 static UniqueName targetLabel( "L__autogen__" );177 Label switchLabel( targetLabel.newName(), 0, std::list< Attribute * >{ new Attribute("unused") } );178 for ( Initializer * init : *listInit ) {179 Expression * condition;180 // check for designations181 // if ( init-> ) {182 condition = new ConstantExpr( Constant::from_ulong( cond ) );183 ++cond;184 // } else {185 // condition = // ... take designation186 // cond = // ... take designation+1187 // }188 std::list< Statement * > stmts;189 build( callExpr, idx, idxEnd, init, back_inserter( stmts ) );190 stmts.push_back( new BranchStmt( noLabels, switchLabel, BranchStmt::Break ) );191 CaseStmt * caseStmt = new CaseStmt( noLabels, condition, stmts );192 branches.push_back( caseStmt );193 }194 *out++ = new SwitchStmt( noLabels, index->clone(), branches );195 *out++ = new NullStmt( std::list<Label>{ switchLabel } );196 }197 }198 }199 200 // if array came with an initializer list: initialize each element201 // may have more initializers than elements in the array - need to check at each index that202 // we haven't exceeded size.203 // may have fewer initializers than elements in the array - need to default construct204 // remaining elements.205 // To accomplish this, generate switch statement, consuming all of expander's elements206 Statement * InitImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) {207 if ( ! init ) return NULL;208 CompoundStmt * block = new CompoundStmt( noLabels );209 build( dst, indices.begin(), indices.end(), init, back_inserter( block->get_kids() ) );210 if ( block->get_kids().empty() ) {211 delete block;212 return NULL;213 } else {214 init = NULL; // init was consumed in creating the list init215 return block;216 }217 }218 219 Statement * ExprImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) {220 return NULL;221 }222 223 Statement * InitExpander::buildListInit( UntypedExpr * dst ) {224 return expander->buildListInit( dst, indices );225 }226 227 55 bool tryConstruct( ObjectDecl * objDecl ) { 228 56 return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) && 229 57 (objDecl->get_init() == NULL || 230 58 ( objDecl->get_init() != NULL && objDecl->get_init()->get_maybeConstructed() )) && 231 ! isDesignated( objDecl->get_init() ) 232 && objDecl->get_storageClass() != DeclarationNode::Extern; 233 } 234 235 class CallFinder : public Visitor { 236 public: 237 typedef Visitor Parent; 238 CallFinder( const std::list< std::string > & names ) : names( names ) {} 239 240 virtual void visit( ApplicationExpr * appExpr ) { 241 handleCallExpr( appExpr ); 242 } 243 244 virtual void visit( UntypedExpr * untypedExpr ) { 245 handleCallExpr( untypedExpr ); 246 } 247 248 std::list< Expression * > * matches; 249 private: 250 const std::list< std::string > names; 251 252 template< typename CallExpr > 253 void handleCallExpr( CallExpr * expr ) { 254 Parent::visit( expr ); 255 std::string fname = getFunctionName( expr ); 256 if ( std::find( names.begin(), names.end(), fname ) != names.end() ) { 257 matches->push_back( expr ); 258 } 259 } 260 }; 261 262 void collectCtorDtorCalls( Statement * stmt, std::list< Expression * > & matches ) { 263 static CallFinder finder( std::list< std::string >{ "?{}", "^?{}" } ); 264 finder.matches = &matches; 265 maybeAccept( stmt, finder ); 59 ! isDesignated( objDecl->get_init() ); 266 60 } 267 61 268 62 Expression * getCtorDtorCall( Statement * stmt ) { 269 std::list< Expression * > matches; 270 collectCtorDtorCalls( stmt, matches ); 271 assert( matches.size() <= 1 ); 272 return matches.size() == 1 ? matches.front() : NULL; 273 } 274 275 namespace { 276 VariableExpr * getCalledFunction( ApplicationExpr * appExpr ) { 277 assert( appExpr ); 278 // xxx - it's possible this can be other things, e.g. MemberExpr, so this is insufficient 279 return dynamic_cast< VariableExpr * >( appExpr->get_function() ); 63 if ( stmt == NULL ) return NULL; 64 if ( ExprStmt * exprStmt = dynamic_cast< ExprStmt * >( stmt ) ) { 65 return exprStmt->get_expr(); 66 } else if ( CompoundStmt * compoundStmt = dynamic_cast< CompoundStmt * >( stmt ) ) { 67 // could also be a compound statement with a loop, in the case of an array 68 if( compoundStmt->get_kids().size() == 2 ) { 69 // loop variable and loop 70 ForStmt * forStmt = dynamic_cast< ForStmt * >( compoundStmt->get_kids().back() ); 71 assert( forStmt && forStmt->get_body() ); 72 return getCtorDtorCall( forStmt->get_body() ); 73 } else if ( compoundStmt->get_kids().size() == 1 ) { 74 // should be the call statement, but in any case there's only one option 75 return getCtorDtorCall( compoundStmt->get_kids().front() ); 76 } else { 77 assert( false && "too many statements in compoundStmt for getCtorDtorCall" ); 78 } 79 } if ( ImplicitCtorDtorStmt * impCtorDtorStmt = dynamic_cast< ImplicitCtorDtorStmt * > ( stmt ) ) { 80 return getCtorDtorCall( impCtorDtorStmt->get_callStmt() ); 81 } else { 82 // should never get here 83 assert( false && "encountered unknown call statement" ); 280 84 } 281 85 } 282 86 283 ApplicationExpr * isIntrinsicCallExpr( Expression * expr ) { 284 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ); 285 if ( ! appExpr ) return NULL; 286 VariableExpr * function = getCalledFunction( appExpr ); 87 bool isInstrinsicSingleArgCallStmt( Statement * stmt ) { 88 Expression * callExpr = getCtorDtorCall( stmt ); 89 if ( ! callExpr ) return false; 90 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( callExpr ); 91 assert( appExpr ); 92 VariableExpr * function = dynamic_cast< VariableExpr * >( appExpr->get_function() ); 287 93 assert( function ); 288 94 // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor 289 95 // will call all member dtors, and some members may have a user defined dtor. 290 return function->get_var()->get_linkage() == LinkageSpec::Intrinsic ? appExpr : NULL; 291 } 292 293 bool isIntrinsicSingleArgCallStmt( Statement * stmt ) { 294 std::list< Expression * > callExprs; 295 collectCtorDtorCalls( stmt, callExprs ); 296 // if ( callExprs.empty() ) return false; // xxx - do I still need this check? 297 return std::all_of( callExprs.begin(), callExprs.end(), []( Expression * callExpr ){ 298 if ( ApplicationExpr * appExpr = isIntrinsicCallExpr( callExpr ) ) { 299 assert( ! appExpr->get_function()->get_results().empty() ); 300 FunctionType *funcType = GenPoly::getFunctionType( appExpr->get_function()->get_results().front() ); 301 assert( funcType ); 302 return funcType->get_parameters().size() == 1; 303 } 304 return false; 305 }); 96 FunctionType * funcType = GenPoly::getFunctionType( function->get_var()->get_type() ); 97 assert( funcType ); 98 return function->get_var()->get_linkage() == LinkageSpec::Intrinsic && funcType->get_parameters().size() == 1; 306 99 } 307 100 … … 367 160 else return NULL; 368 161 } 369 370 class ConstExprChecker : public Visitor {371 public:372 ConstExprChecker() : isConstExpr( true ) {}373 374 virtual void visit( ApplicationExpr *applicationExpr ) { isConstExpr = false; }375 virtual void visit( UntypedExpr *untypedExpr ) { isConstExpr = false; }376 virtual void visit( NameExpr *nameExpr ) { isConstExpr = false; }377 virtual void visit( CastExpr *castExpr ) { isConstExpr = false; }378 virtual void visit( LabelAddressExpr *labAddressExpr ) { isConstExpr = false; }379 virtual void visit( UntypedMemberExpr *memberExpr ) { isConstExpr = false; }380 virtual void visit( MemberExpr *memberExpr ) { isConstExpr = false; }381 virtual void visit( VariableExpr *variableExpr ) { isConstExpr = false; }382 virtual void visit( ConstantExpr *constantExpr ) { /* bottom out */ }383 // these might be okay?384 // virtual void visit( SizeofExpr *sizeofExpr );385 // virtual void visit( AlignofExpr *alignofExpr );386 // virtual void visit( UntypedOffsetofExpr *offsetofExpr );387 // virtual void visit( OffsetofExpr *offsetofExpr );388 // virtual void visit( OffsetPackExpr *offsetPackExpr );389 // virtual void visit( AttrExpr *attrExpr );390 // virtual void visit( CommaExpr *commaExpr );391 // virtual void visit( LogicalExpr *logicalExpr );392 // virtual void visit( ConditionalExpr *conditionalExpr );393 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }394 virtual void visit( SolvedTupleExpr *tupleExpr ) { isConstExpr = false; }395 virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; }396 virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; }397 virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; }398 virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; }399 400 bool isConstExpr;401 };402 403 bool isConstExpr( Expression * expr ) {404 if ( expr ) {405 ConstExprChecker checker;406 expr->accept( checker );407 return checker.isConstExpr;408 }409 return true;410 }411 412 bool isConstExpr( Initializer * init ) {413 if ( init ) {414 ConstExprChecker checker;415 init->accept( checker );416 return checker.isConstExpr;417 } // if418 // for all intents and purposes, no initializer means const expr419 return true;420 }421 422 162 } -
src/InitTweak/InitTweak.h
rc331406 r5070fe4 26 26 // helper functions for initialization 27 27 namespace InitTweak { 28 /// transform Initializer into an argument list that can be passed to a call expression29 std::list< Expression * > makeInitList( Initializer * init );28 /// transform Initializer into an argument list that can be passed to a call expression 29 std::list< Expression * > makeInitList( Initializer * init ); 30 30 31 /// True if the resolver should try to construct objDecl32 bool tryConstruct( ObjectDecl * objDecl );31 /// True if the resolver should try to construct objDecl 32 bool tryConstruct( ObjectDecl * objDecl ); 33 33 34 /// True if the Initializer contains designations35 bool isDesignated( Initializer * init );34 /// True if the Initializer contains designations 35 bool isDesignated( Initializer * init ); 36 36 37 /// Non-Null if expr is a call expression whose target function is intrinsic 38 ApplicationExpr * isIntrinsicCallExpr( Expression * expr ); 37 /// True if stmt is a call statement where the function called is intrinsic and takes one parameter. 38 /// Intended to be used for default ctor/dtor calls, but might have use elsewhere. 39 /// Currently has assertions that make it less than fully general. 40 bool isInstrinsicSingleArgCallStmt( Statement * expr ); 39 41 40 /// True if stmt is a call statement where the function called is intrinsic and takes one parameter. 41 /// Intended to be used for default ctor/dtor calls, but might have use elsewhere. 42 /// Currently has assertions that make it less than fully general. 43 bool isIntrinsicSingleArgCallStmt( Statement * expr ); 42 /// get the Ctor/Dtor call expression from a Statement that looks like a generated ctor/dtor call 43 Expression * getCtorDtorCall( Statement * stmt ); 44 44 45 /// get all Ctor/Dtor call expressions from a Statement 46 void collectCtorDtorCalls( Statement * stmt, std::list< Expression * > & matches);45 /// returns the name of the function being called 46 std::string getFunctionName( Expression * expr ); 47 47 48 /// get the Ctor/Dtor call expression from a Statement that looks like a generated ctor/dtor call 49 Expression * getCtorDtorCall( Statement * stmt);48 /// returns the argument to a call expression in position N indexed from 0 49 Expression *& getCallArg( Expression * callExpr, unsigned int pos ); 50 50 51 /// returns the name of the function being called 52 std::string getFunctionName( Expression * expr);51 /// returns the base type of a PointerType or ArrayType, else returns NULL 52 Type * getPointerBase( Type * ); 53 53 54 /// returns the argument to a call expression in position N indexed from 0 55 Expression *& getCallArg( Expression * callExpr, unsigned int pos ); 56 57 /// returns the base type of a PointerType or ArrayType, else returns NULL 58 Type * getPointerBase( Type * ); 59 60 /// returns the argument if it is a PointerType or ArrayType, else returns NULL 61 Type * isPointerType( Type * ); 62 63 /// returns true if expr is trivially a compile-time constant 64 bool isConstExpr( Expression * expr ); 65 bool isConstExpr( Initializer * init ); 66 67 class InitExpander { 68 public: 69 // expand by stepping through init to get each list of arguments 70 InitExpander( Initializer * init ); 71 72 // always expand to expr 73 InitExpander( Expression * expr ); 74 75 // iterator-like interface 76 std::list< Expression * > operator*(); 77 InitExpander & operator++(); 78 79 // builds statement which has the same semantics as a C-style list initializer 80 // (for array initializers) using callExpr as the base expression to perform initialization 81 Statement * buildListInit( UntypedExpr * callExpr ); 82 void addArrayIndex( Expression * index, Expression * dimension ); 83 void clearArrayIndices(); 84 85 class ExpanderImpl; 86 private: 87 std::shared_ptr< ExpanderImpl > expander; 88 std::list< Expression * > cur; 89 90 // invariant: list of size 2N (elements come in pairs [index, dimension]) 91 typedef std::list< Expression * > IndexList; 92 IndexList indices; 93 }; 54 /// returns the argument if it is a PointerType or ArrayType, else returns NULL 55 Type * isPointerType( Type * ); 94 56 } // namespace 95 57 -
src/Makefile.in
rc331406 r5070fe4 108 108 ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) \ 109 109 ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT) \ 110 ControlStruct/driver_cfa_cpp-CaseRangeMutator.$(OBJEXT) \ 110 111 ControlStruct/driver_cfa_cpp-Mutate.$(OBJEXT) \ 111 112 ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) \ … … 372 373 Common/SemanticError.cc Common/UniqueName.cc \ 373 374 ControlStruct/LabelGenerator.cc ControlStruct/LabelFixer.cc \ 374 ControlStruct/MLEMutator.cc ControlStruct/ Mutate.cc \375 ControlStruct/ ForExprMutator.cc \375 ControlStruct/MLEMutator.cc ControlStruct/CaseRangeMutator.cc \ 376 ControlStruct/Mutate.cc ControlStruct/ForExprMutator.cc \ 376 377 ControlStruct/LabelTypeChecker.cc Designators/Processor.cc \ 377 378 GenPoly/Box.cc GenPoly/GenPoly.cc GenPoly/PolyMutator.cc \ … … 542 543 ControlStruct/$(DEPDIR)/$(am__dirstamp) 543 544 ControlStruct/driver_cfa_cpp-MLEMutator.$(OBJEXT): \ 545 ControlStruct/$(am__dirstamp) \ 546 ControlStruct/$(DEPDIR)/$(am__dirstamp) 547 ControlStruct/driver_cfa_cpp-CaseRangeMutator.$(OBJEXT): \ 544 548 ControlStruct/$(am__dirstamp) \ 545 549 ControlStruct/$(DEPDIR)/$(am__dirstamp) … … 819 823 -rm -f Common/driver_cfa_cpp-SemanticError.$(OBJEXT) 820 824 -rm -f Common/driver_cfa_cpp-UniqueName.$(OBJEXT) 825 -rm -f ControlStruct/driver_cfa_cpp-CaseRangeMutator.$(OBJEXT) 821 826 -rm -f ControlStruct/driver_cfa_cpp-ForExprMutator.$(OBJEXT) 822 827 -rm -f ControlStruct/driver_cfa_cpp-LabelFixer.$(OBJEXT) … … 929 934 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-SemanticError.Po@am__quote@ 930 935 @AMDEP_TRUE@@am__include@ @am__quote@Common/$(DEPDIR)/driver_cfa_cpp-UniqueName.Po@am__quote@ 936 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Po@am__quote@ 931 937 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-ForExprMutator.Po@am__quote@ 932 938 @AMDEP_TRUE@@am__include@ @am__quote@ControlStruct/$(DEPDIR)/driver_cfa_cpp-LabelFixer.Po@am__quote@ … … 1211 1217 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-MLEMutator.obj `if test -f 'ControlStruct/MLEMutator.cc'; then $(CYGPATH_W) 'ControlStruct/MLEMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/MLEMutator.cc'; fi` 1212 1218 1219 ControlStruct/driver_cfa_cpp-CaseRangeMutator.o: ControlStruct/CaseRangeMutator.cc 1220 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-CaseRangeMutator.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Tpo -c -o ControlStruct/driver_cfa_cpp-CaseRangeMutator.o `test -f 'ControlStruct/CaseRangeMutator.cc' || echo '$(srcdir)/'`ControlStruct/CaseRangeMutator.cc 1221 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Po 1222 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ControlStruct/CaseRangeMutator.cc' object='ControlStruct/driver_cfa_cpp-CaseRangeMutator.o' libtool=no @AMDEPBACKSLASH@ 1223 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1224 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-CaseRangeMutator.o `test -f 'ControlStruct/CaseRangeMutator.cc' || echo '$(srcdir)/'`ControlStruct/CaseRangeMutator.cc 1225 1226 ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj: ControlStruct/CaseRangeMutator.cc 1227 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Tpo -c -o ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj `if test -f 'ControlStruct/CaseRangeMutator.cc'; then $(CYGPATH_W) 'ControlStruct/CaseRangeMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/CaseRangeMutator.cc'; fi` 1228 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Tpo ControlStruct/$(DEPDIR)/driver_cfa_cpp-CaseRangeMutator.Po 1229 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='ControlStruct/CaseRangeMutator.cc' object='ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj' libtool=no @AMDEPBACKSLASH@ 1230 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 1231 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o ControlStruct/driver_cfa_cpp-CaseRangeMutator.obj `if test -f 'ControlStruct/CaseRangeMutator.cc'; then $(CYGPATH_W) 'ControlStruct/CaseRangeMutator.cc'; else $(CYGPATH_W) '$(srcdir)/ControlStruct/CaseRangeMutator.cc'; fi` 1232 1213 1233 ControlStruct/driver_cfa_cpp-Mutate.o: ControlStruct/Mutate.cc 1214 1234 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT ControlStruct/driver_cfa_cpp-Mutate.o -MD -MP -MF ControlStruct/$(DEPDIR)/driver_cfa_cpp-Mutate.Tpo -c -o ControlStruct/driver_cfa_cpp-Mutate.o `test -f 'ControlStruct/Mutate.cc' || echo '$(srcdir)/'`ControlStruct/Mutate.cc -
src/Parser/ExpressionNode.cc
rc331406 r5070fe4 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 5 07:56:23201613 // Update Count : 3 7512 // Last Modified On : Tue Jul 5 13:41:55 2016 13 // Update Count : 320 14 14 // 15 15 … … 83 83 } 84 84 85 //CommaExprNode *ExpressionNode::add_to_list( ExpressionNode *exp ) {86 //return new CommaExprNode( this, exp );87 //}85 CommaExprNode *ExpressionNode::add_to_list( ExpressionNode *exp ) { 86 return new CommaExprNode( this, exp ); 87 } 88 88 89 89 //############################################################################## … … 246 246 "?|?", "?&?", "?^?", "Cast", "?<<?", "?>>?", "?<?", "?>?", "?<=?", "?>=?", "?==?", "?!=?", 247 247 "?=?", "?*=?", "?/=?", "?%=?", "?+=?", "?-=?", "?<<=?", "?>>=?", "?&=?", "?^=?", "?|=?", 248 "?[?]", "FieldSel", "PFieldSel", " ...",248 "?[?]", "FieldSel", "PFieldSel", "Range", 249 249 // monadic 250 250 "+?", "-?", "AddressOf", "*?", "!?", "~?", "++?", "?++", "--?", "?--", "&&" … … 258 258 OperatorNode::~OperatorNode() {} 259 259 260 OperatorNode::Type OperatorNode::get_type( void ) const {260 OperatorNode::Type OperatorNode::get_type( void ) const{ 261 261 return type; 262 262 } … … 311 311 } 312 312 313 314 Expression *build_cast( TypeValueNode * arg, ExpressionNode *expr_node ) { 315 DeclarationNode *decl_node = arg->get_decl(); 316 317 Type *targetType = decl_node->buildType(); 318 if ( dynamic_cast< VoidType* >( targetType ) ) { 319 delete targetType; 320 return new CastExpr( maybeBuild<Expression>(expr_node) ); 321 } else { 322 return new CastExpr( maybeBuild<Expression>(expr_node), targetType ); 323 } // if 324 } 325 326 Expression *build_fieldSel( ExpressionNode *expr_node, VarRefNode *member ) { 327 NameExpr* memberExpr = dynamic_cast<NameExpr*> ( maybeBuild<Expression>( member) ); 328 assert( memberExpr ); 329 UntypedMemberExpr *ret = new UntypedMemberExpr( memberExpr->get_name(), maybeBuild<Expression>(expr_node) ); 330 delete member; 331 return ret; 332 } 333 334 Expression *build_pfieldSel( ExpressionNode *expr_node, VarRefNode *member ) { 335 NameExpr* memberExpr = dynamic_cast<NameExpr*> ( maybeBuild<Expression>( member) ); 336 assert( memberExpr ); 337 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 338 deref->get_args().push_back( maybeBuild<Expression>(expr_node) ); 339 UntypedMemberExpr *ret = new UntypedMemberExpr( memberExpr->get_name(), deref ); 340 delete member; 341 return ret; 342 } 343 344 Expression *build_addressOf( ExpressionNode *expr_node ) { 345 return new AddressExpr( maybeBuild<Expression>(expr_node) ); 346 } 347 Expression *build_sizeOf( ExpressionNode *expr_node ) { 348 if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( expr_node ) ) { 349 return new SizeofExpr( arg->get_decl()->buildType() ); 350 } else { 351 return new SizeofExpr( maybeBuild<Expression>(expr_node) ); 352 } // if 353 } 354 Expression *build_alignOf( ExpressionNode *expr_node ) { 355 if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( expr_node ) ) { 356 return new AlignofExpr( arg->get_decl()->buildType() ); 357 } else { 358 return new AlignofExpr( maybeBuild<Expression>(expr_node) ); 359 } // if 360 } 361 Expression *build_offsetOf( TypeValueNode * arg, VarRefNode *member ) { 362 NameExpr *memberExpr = dynamic_cast<NameExpr *>( maybeBuild<Expression>( member ) ); 363 assert( memberExpr ); 364 return new UntypedOffsetofExpr( arg->get_decl()->buildType(), memberExpr->get_name() ); 365 } 366 367 Expression *build_and_or( ExpressionNode *expr_node1, ExpressionNode *expr_node2, bool kind ) { 368 return new LogicalExpr( notZeroExpr( maybeBuild<Expression>(expr_node1) ), notZeroExpr( maybeBuild<Expression>(expr_node2) ), kind ); 369 } 370 371 Expression *build_opr1( OperatorNode::Type op, ExpressionNode *expr_node ) { 372 std::list<Expression *> args; 373 args.push_back( new AddressExpr( maybeBuild<Expression>(expr_node) ) ); 374 return new UntypedExpr( new NameExpr( opName[ op ] ), args ); 375 } 376 Expression *build_opr2( OperatorNode::Type op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) { 377 std::list<Expression *> args; 378 args.push_back( maybeBuild<Expression>(expr_node1) ); 379 args.push_back( maybeBuild<Expression>(expr_node2) ); 380 return new UntypedExpr( new NameExpr( opName[ op ] ), args ); 381 } 382 383 Expression *build_cond( ExpressionNode *expr_node1, ExpressionNode *expr_node2, ExpressionNode *expr_node3 ) { 384 return new ConditionalExpr( notZeroExpr( maybeBuild<Expression>(expr_node1) ), maybeBuild<Expression>(expr_node2), maybeBuild<Expression>(expr_node3) ); 385 } 386 387 Expression *build_comma( ExpressionNode *expr_node1, ExpressionNode *expr_node2 ) { 388 return new CommaExpr( maybeBuild<Expression>(expr_node1), maybeBuild<Expression>(expr_node2) ); 389 } 390 391 CompositeExprNode2::CompositeExprNode2( Expression *expr ) : expr( expr ) {} 392 CompositeExprNode2::CompositeExprNode2( const CompositeExprNode2 &other ) : expr( other.expr->clone() ) {} 393 CompositeExprNode2::~CompositeExprNode2() { delete expr; } 394 void CompositeExprNode2::print( std::ostream &, int indent ) const { assert( false ); } 395 void CompositeExprNode2::printOneLine( std::ostream &, int indent ) const { assert( false ); } 396 313 #include "Common/utility.h" 397 314 398 315 Expression *CompositeExprNode::build() const { … … 406 323 } // if 407 324 408 switch ( op->get_type() ) { 325 switch ( op->get_type()) { 326 case OperatorNode::Incr: 327 case OperatorNode::Decr: 328 case OperatorNode::IncrPost: 329 case OperatorNode::DecrPost: 409 330 case OperatorNode::Assign: 410 331 case OperatorNode::MulAssn: … … 418 339 case OperatorNode::ERAssn: 419 340 case OperatorNode::OrAssn: 341 // the rewrite rules for these expressions specify that the first argument has its address taken 420 342 assert( ! args.empty() ); 421 343 args.front() = new AddressExpr( args.front() ); 344 break; 345 default: // do nothing 346 ; 347 } // switch 348 349 switch ( op->get_type() ) { 350 case OperatorNode::Incr: 351 case OperatorNode::Decr: 352 case OperatorNode::IncrPost: 353 case OperatorNode::DecrPost: 354 case OperatorNode::Assign: 355 case OperatorNode::MulAssn: 356 case OperatorNode::DivAssn: 357 case OperatorNode::ModAssn: 358 case OperatorNode::PlusAssn: 359 case OperatorNode::MinusAssn: 360 case OperatorNode::LSAssn: 361 case OperatorNode::RSAssn: 362 case OperatorNode::AndAssn: 363 case OperatorNode::ERAssn: 364 case OperatorNode::OrAssn: 365 case OperatorNode::Plus: 366 case OperatorNode::Minus: 367 case OperatorNode::Mul: 368 case OperatorNode::Div: 369 case OperatorNode::Mod: 370 case OperatorNode::BitOr: 371 case OperatorNode::BitAnd: 372 case OperatorNode::Xor: 373 case OperatorNode::LShift: 374 case OperatorNode::RShift: 375 case OperatorNode::LThan: 376 case OperatorNode::GThan: 377 case OperatorNode::LEThan: 378 case OperatorNode::GEThan: 379 case OperatorNode::Eq: 380 case OperatorNode::Neq: 381 case OperatorNode::Index: 382 case OperatorNode::Range: 422 383 case OperatorNode::UnPlus: 423 384 case OperatorNode::UnMinus: … … 427 388 case OperatorNode::LabelAddress: 428 389 return new UntypedExpr( new NameExpr( opName[ op->get_type() ] ), args ); 429 390 case OperatorNode::AddressOf: 391 assert( args.size() == 1 ); 392 assert( args.front() ); 393 394 return new AddressExpr( args.front() ); 395 case OperatorNode::Cast: 396 { 397 TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()); 398 assert( arg ); 399 400 DeclarationNode *decl_node = arg->get_decl(); 401 ExpressionNode *expr_node = dynamic_cast<ExpressionNode *>( arg->get_link()); 402 403 Type *targetType = decl_node->buildType(); 404 if ( dynamic_cast< VoidType* >( targetType ) ) { 405 delete targetType; 406 return new CastExpr( maybeBuild<Expression>(expr_node), maybeBuild< Expression >( get_argName() ) ); 407 } else { 408 return new CastExpr( maybeBuild<Expression>(expr_node),targetType, maybeBuild< Expression >( get_argName() ) ); 409 } // if 410 } 411 case OperatorNode::FieldSel: 412 { 413 assert( args.size() == 2 ); 414 415 NameExpr *member = dynamic_cast<NameExpr *>( args.back()); 416 // TupleExpr *memberTup = dynamic_cast<TupleExpr *>( args.back()); 417 418 if ( member != 0 ) { 419 UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), args.front()); 420 delete member; 421 return ret; 422 /* else if ( memberTup != 0 ) 423 { 424 UntypedMemberExpr *ret = new UntypedMemberExpr( memberTup->get_name(), args.front()); 425 delete member; 426 return ret; 427 } */ 428 } else 429 assert( false ); 430 } 431 case OperatorNode::PFieldSel: 432 { 433 assert( args.size() == 2 ); 434 435 NameExpr *member = dynamic_cast<NameExpr *>( args.back()); // modify for Tuples xxx 436 assert( member != 0 ); 437 438 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 439 deref->get_args().push_back( args.front() ); 440 441 UntypedMemberExpr *ret = new UntypedMemberExpr( member->get_name(), deref ); 442 delete member; 443 return ret; 444 } 445 case OperatorNode::SizeOf: 446 { 447 if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()) ) { 448 return new SizeofExpr( arg->get_decl()->buildType()); 449 } else { 450 return new SizeofExpr( args.front()); 451 } // if 452 } 453 case OperatorNode::AlignOf: 454 { 455 if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()) ) { 456 return new AlignofExpr( arg->get_decl()->buildType()); 457 } else { 458 return new AlignofExpr( args.front()); 459 } // if 460 } 461 case OperatorNode::OffsetOf: 462 { 463 assert( args.size() == 2 ); 464 465 if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args() ) ) { 466 NameExpr *member = dynamic_cast<NameExpr *>( args.back() ); 467 assert( member != 0 ); 468 469 return new UntypedOffsetofExpr( arg->get_decl()->buildType(), member->get_name() ); 470 } else assert( false ); 471 } 430 472 case OperatorNode::Attr: 431 473 { 432 VarRefNode *var = dynamic_cast<VarRefNode *>( get_args() );474 VarRefNode *var = dynamic_cast<VarRefNode *>( get_args()); 433 475 assert( var ); 434 476 if ( ! get_args()->get_link() ) { 435 477 return new AttrExpr( maybeBuild<Expression>(var), ( Expression*)0); 436 } else if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()->get_link() ) ) {437 return new AttrExpr( maybeBuild<Expression>(var), arg->get_decl()->buildType() );478 } else if ( TypeValueNode * arg = dynamic_cast<TypeValueNode *>( get_args()->get_link()) ) { 479 return new AttrExpr( maybeBuild<Expression>(var), arg->get_decl()->buildType()); 438 480 } else { 439 return new AttrExpr( maybeBuild<Expression>(var), args.back() );481 return new AttrExpr( maybeBuild<Expression>(var), args.back()); 440 482 } // if 441 483 } 484 case OperatorNode::Or: 485 case OperatorNode::And: 486 assert( args.size() == 2); 487 return new LogicalExpr( notZeroExpr( args.front() ), notZeroExpr( args.back() ), ( op->get_type() == OperatorNode::And ) ); 442 488 case OperatorNode::Cond: 443 489 { … … 451 497 case OperatorNode::NCond: 452 498 throw UnimplementedError( "GNU 2-argument conditional expression" ); 499 case OperatorNode::Comma: 500 { 501 assert( args.size() == 2); 502 std::list< Expression * >::const_iterator i = args.begin(); 503 Expression *ret = *i++; 504 while ( i != args.end() ) { 505 ret = new CommaExpr( ret, *i++ ); 506 } 507 return ret; 508 } 453 509 // Tuples 454 510 case OperatorNode::TupleC: … … 459 515 } 460 516 default: 461 assert( ((void)"CompositeExprNode::build", false) ); 517 // shouldn't happen 518 assert( false ); 462 519 return 0; 463 520 } // switch … … 548 605 549 606 void LabelNode::printOneLine( std::ostream &os, int indent ) const {} 607 608 //############################################################################## 609 610 CommaExprNode::CommaExprNode(): CompositeExprNode( new OperatorNode( OperatorNode::Comma )) {} 611 612 CommaExprNode::CommaExprNode( ExpressionNode *exp ) : CompositeExprNode( new OperatorNode( OperatorNode::Comma ), exp ) { 613 } 614 615 CommaExprNode::CommaExprNode( ExpressionNode *exp1, ExpressionNode *exp2) : CompositeExprNode( new OperatorNode( OperatorNode::Comma ), exp1, exp2) { 616 } 617 618 CommaExprNode *CommaExprNode::add_to_list( ExpressionNode *exp ) { 619 add_arg( exp ); 620 621 return this; 622 } 623 624 CommaExprNode::CommaExprNode( const CommaExprNode &other ) : CompositeExprNode( other ) { 625 } 550 626 551 627 //############################################################################## … … 698 774 } 699 775 776 700 777 ExpressionNode *flattenCommas( ExpressionNode *list ) { 701 778 if ( CompositeExprNode *composite = dynamic_cast< CompositeExprNode * >( list ) ) { -
src/Parser/ParseNode.h
rc331406 r5070fe4 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 5 07:49:32201613 // Update Count : 2 8812 // Last Modified On : Sun Jul 24 02:17:00 2016 13 // Update Count : 269 14 14 // 15 15 … … 77 77 virtual ExpressionNode *clone() const = 0; 78 78 79 //virtual CommaExprNode *add_to_list( ExpressionNode * );79 virtual CommaExprNode *add_to_list( ExpressionNode * ); 80 80 81 81 ExpressionNode *get_argName() const { return argName; } … … 225 225 }; 226 226 227 Expression *build_cast( TypeValueNode * arg, ExpressionNode *expr_node );228 Expression *build_fieldSel( ExpressionNode *expr_node, VarRefNode *member );229 Expression *build_pfieldSel( ExpressionNode *expr_node, VarRefNode *member );230 Expression *build_addressOf( ExpressionNode *expr_node );231 Expression *build_sizeOf( ExpressionNode *expr_node );232 Expression *build_alignOf( ExpressionNode *expr_node );233 Expression *build_offsetOf( TypeValueNode * arg, VarRefNode *member );234 Expression *build_and( ExpressionNode *expr_node1, ExpressionNode *expr_node2 );235 Expression *build_and_or( ExpressionNode *expr_node1, ExpressionNode *expr_node2, bool kind );236 Expression *build_opr1( OperatorNode::Type op, ExpressionNode *expr_node );237 Expression *build_opr2( OperatorNode::Type op, ExpressionNode *expr_node1, ExpressionNode *expr_node2 );238 Expression *build_cond( ExpressionNode *expr_node1, ExpressionNode *expr_node2, ExpressionNode *expr_node3 );239 Expression *build_comma( ExpressionNode *expr_node1, ExpressionNode *expr_node2 );240 241 class CompositeExprNode2 : public ExpressionNode {242 public:243 CompositeExprNode2( Expression *expr );244 CompositeExprNode2( const CompositeExprNode2 &other );245 virtual ~CompositeExprNode2();246 247 virtual CompositeExprNode2 *clone() const { return new CompositeExprNode2( *this ); }248 virtual Expression *build() const { return expr->clone(); }249 250 virtual void print( std::ostream &, int indent = 0) const;251 virtual void printOneLine( std::ostream &, int indent = 0) const;252 private:253 Expression *expr;254 };255 256 227 class CompositeExprNode : public ExpressionNode { 257 228 public: … … 319 290 private: 320 291 std::list< Label > labels; 292 }; 293 294 class CommaExprNode : public CompositeExprNode { 295 public: 296 CommaExprNode(); 297 CommaExprNode( ExpressionNode * ); 298 CommaExprNode( ExpressionNode *, ExpressionNode * ); 299 CommaExprNode( const CommaExprNode &other ); 300 301 virtual CommaExprNode *add_to_list( ExpressionNode * ); 302 virtual CommaExprNode *clone() const { return new CommaExprNode( *this ); } 321 303 }; 322 304 … … 503 485 std::string get_target() const; 504 486 505 //StatementNode *add_controlexp( ExpressionNode * );487 StatementNode *add_controlexp( ExpressionNode * ); 506 488 StatementNode *append_block( StatementNode * ); 507 489 StatementNode *append_last_case( StatementNode * ); … … 549 531 ConstantNode *clobber; 550 532 std::list< Label > gotolabels; 533 }; 534 535 class NullStmtNode : public CompoundStmtNode { 536 public: 537 Statement *build() const; 538 void print( std::ostream &, int indent = 0 ) const; 551 539 }; 552 540 -
src/Parser/StatementNode.cc
rc331406 r5070fe4 107 107 } 108 108 109 //StatementNode *StatementNode::add_controlexp( ExpressionNode *e ) {110 //if ( control && e )111 //control->add_to_list( e ); // xxx - check this112 //return this;113 //}109 StatementNode *StatementNode::add_controlexp( ExpressionNode *e ) { 110 if ( control && e ) 111 control->add_to_list( e ); // xxx - check this 112 return this; 113 } 114 114 115 115 StatementNode *StatementNode::append_block( StatementNode *stmt ) { … … 417 417 } 418 418 419 420 void NullStmtNode::print( ostream &os, int indent ) const { 421 os << string( indent, ' ' ) << "Null Statement:" << endl; 422 } 423 424 Statement *NullStmtNode::build() const { 425 return new NullStmt; 426 } 427 419 428 // Local Variables: // 420 429 // tab-width: 4 // -
src/Parser/TypeData.cc
rc331406 r5070fe4 510 510 return buildVariable(); 511 511 } else { 512 return new ObjectDecl( name, sc, linkage, bitfieldWidth, build(), init, std::list< Attribute * >(),isInline, isNoreturn );512 return new ObjectDecl( name, sc, linkage, bitfieldWidth, build(), init, isInline, isNoreturn ); 513 513 } // if 514 514 return 0; -
src/Parser/parser.cc
rc331406 r5070fe4 354 354 LabelNode *label; 355 355 InitializerNode *in; 356 OperatorNode::Type op;357 356 bool flag; 358 357 … … 360 359 361 360 /* Line 293 of yacc.c */ 362 #line 36 3"Parser/parser.cc"361 #line 362 "Parser/parser.cc" 363 362 } YYSTYPE; 364 363 # define YYSTYPE_IS_TRIVIAL 1 … … 372 371 373 372 /* Line 343 of yacc.c */ 374 #line 37 5"Parser/parser.cc"373 #line 374 "Parser/parser.cc" 375 374 376 375 #ifdef short … … 1017 1016 static const yytype_uint16 yyrline[] = 1018 1017 { 1019 0, 29 2, 292, 298, 307, 308, 309, 313, 314, 315,1020 31 9, 320, 324, 325, 329, 330, 334, 335, 341, 343,1021 34 5, 347, 352, 353, 359, 363, 365, 366, 368, 369,1022 3 71, 373, 375, 383, 384, 390, 391, 392, 397, 399,1023 40 4, 405, 409, 413, 415, 417, 419, 424, 427, 429,1024 4 31, 436, 439, 441, 443, 445, 447, 449, 451, 453,1025 45 5, 457, 459, 466, 467, 469, 473, 474, 475, 476,1026 4 80, 481, 483, 488, 489, 491, 493, 498, 499, 501,1027 50 6, 507, 509, 514, 515, 517, 519, 521, 526, 527,1028 52 9, 534, 535, 540, 541, 546, 547, 552, 553, 558,1029 55 9, 564, 565, 568, 570, 575, 580, 581, 583, 585,1030 5 91, 592, 598, 600, 602, 604, 609, 610, 615, 616,1031 61 7, 618, 619, 620, 621, 622, 623, 624, 628, 629,1032 63 6, 637, 643, 644, 645, 646, 647, 648, 649, 650,1033 6 51, 661, 668, 670, 680, 681, 686, 688, 694, 696,1034 700, 701, 706, 711, 714, 716, 718, 728, 730, 741,1035 7 42, 744, 748, 750, 754, 755, 760, 761, 765, 770,1036 7 71, 775, 777, 783, 784, 788, 790, 792, 794, 800,1037 801, 805, 807, 812, 814, 816, 821, 823, 828, 830,1038 8 34, 837, 841, 844, 848, 850, 854, 856, 863, 865,1039 86 7, 876, 878, 880, 882, 884, 889, 891, 893, 895,1040 900, 913, 914, 919, 921, 926, 930, 932, 934, 936,1041 93 8, 944, 945, 951, 952, 956, 957, 962, 964, 970,1042 9 71, 973, 978, 980, 987, 989, 993, 994, 999, 1001,1043 1005, 1006, 1010, 1012, 1016, 1017, 1021, 1022, 1026, 1027,1044 10 42, 1043, 1044, 1045, 1046, 1050, 1055, 1062, 1072, 1077,1045 10 82, 1090, 1095, 1100, 1105, 1110, 1118, 1140, 1145, 1152,1046 11 54, 1161, 1166, 1171, 1182, 1187, 1192, 1197, 1202, 1211,1047 121 6, 1224, 1225, 1226, 1227, 1233, 1238, 1246, 1247, 1248,1048 124 9, 1253, 1254, 1255, 1256, 1261, 1262, 1271, 1272, 1277,1049 127 8, 1283, 1285, 1287, 1289, 1291, 1294, 1293, 1305, 1306,1050 130 8, 1318, 1319, 1324, 1328, 1330, 1332, 1334, 1336, 1338,1051 13 40, 1342, 1347, 1349, 1351, 1353, 1355, 1357, 1359, 1361,1052 13 63, 1365, 1367, 1369, 1371, 1377, 1378, 1380, 1382, 1384,1053 138 9, 1390, 1396, 1397, 1399, 1401, 1406, 1408, 1410, 1412,1054 141 7, 1418, 1420, 1422, 1427, 1428, 1430, 1435, 1436, 1438,1055 14 40, 1445, 1447, 1449, 1454, 1455, 1459, 1461, 1467, 1466,1056 14 70, 1472, 1477, 1479, 1485, 1486, 1491, 1492, 1494, 1495,1057 1 504, 1505, 1507, 1509, 1514, 1516, 1522, 1523, 1525, 1528,1058 15 31, 1536, 1537, 1542, 1547, 1551, 1553, 1559, 1558, 1565,1059 156 7, 1573, 1574, 1582, 1583, 1587, 1588, 1589, 1591, 1593,1060 1 600, 1601, 1603, 1605, 1610, 1611, 1617, 1618, 1622, 1623,1061 162 8, 1629, 1630, 1632, 1640, 1641, 1643, 1646, 1648, 1652,1062 16 53, 1654, 1656, 1658, 1662, 1667, 1675, 1676, 1685, 1687,1063 16 92, 1693, 1694, 1698, 1699, 1700, 1704, 1705, 1706, 1710,1064 17 11, 1712, 1717, 1718, 1719, 1720, 1726, 1727, 1729, 1734,1065 17 35, 1740, 1741, 1742, 1743, 1744, 1759, 1760, 1765, 1766,1066 17 74, 1776, 1778, 1781, 1783, 1785, 1808, 1809, 1811, 1813,1067 181 8, 1819, 1821, 1826, 1831, 1832, 1838, 1837, 1841, 1845,1068 184 7, 1849, 1855, 1856, 1861, 1866, 1868, 1873, 1875, 1876,1069 187 8, 1883, 1885, 1887, 1892, 1894, 1899, 1904, 1912, 1918,1070 191 7, 1931, 1932, 1937, 1938, 1942, 1947, 1952, 1960, 1965,1071 197 6, 1977, 1988, 1989, 1995, 1996, 2000, 2001, 2002, 2005,1072 2004, 2015, 2024, 2030, 2036, 2045, 2051, 2057, 2063, 2069,1073 207 7, 2083, 2091, 2097, 2106, 2107, 2108, 2112, 2116, 2118,1074 21 23, 2124, 2128, 2129, 2134, 2140, 2141, 2144, 2146, 2147,1075 21 51, 2152, 2153, 2154, 2188, 2190, 2191, 2193, 2198, 2203,1076 220 8, 2210, 2212, 2217, 2219, 2221, 2223, 2228, 2230, 2239,1077 22 41, 2242, 2247, 2249, 2251, 2256, 2258, 2260, 2265, 2267,1078 226 9, 2278, 2279, 2280, 2284, 2286, 2288, 2293, 2295, 2297,1079 2 302, 2304, 2306, 2321, 2323, 2324, 2326, 2331, 2332, 2337,1080 233 9, 2341, 2346, 2348, 2350, 2352, 2357, 2359, 2361, 2371,1081 23 73, 2374, 2376, 2381, 2383, 2385, 2390, 2392, 2394, 2396,1082 2 401, 2403, 2405, 2436, 2438, 2439, 2441, 2446, 2451, 2459,1083 24 61, 2463, 2468, 2470, 2475, 2477, 2491, 2492, 2494, 2499,1084 2 501, 2503, 2505, 2507, 2512, 2513, 2515, 2517, 2522, 2524,1085 252 6, 2532, 2534, 2536, 2540, 2542, 2544, 2546, 2560, 2561,1086 25 63, 2568, 2570, 2572, 2574, 2576, 2581, 2582, 2584, 2586,1087 25 91, 2593, 2595, 2601, 2602, 2604, 2613, 2616, 2618, 2621,1088 26 23, 2625, 2638, 2639, 2641, 2646, 2648, 2650, 2652, 2654,1089 265 9, 2660, 2662, 2664, 2669, 2671, 2679, 2680, 2681, 2686,1090 268 7, 2691, 2693, 2695, 2697, 2699, 2701, 2708, 2710, 2712,1091 27 14, 2716, 2718, 2720, 2722, 2724, 2726, 2731, 2733, 2735,1092 27 40, 2766, 2767, 2769, 2773, 2774, 2778, 2780, 2782, 2784,1093 278 6, 2788, 2795, 2797, 2799, 2801, 2803, 2805, 2810, 2815,1094 281 7, 2819, 2837, 2839, 2844, 28451018 0, 290, 290, 296, 305, 306, 307, 311, 312, 313, 1019 317, 318, 322, 323, 327, 328, 332, 333, 339, 341, 1020 343, 345, 350, 351, 357, 361, 363, 364, 366, 367, 1021 369, 371, 373, 381, 382, 388, 389, 390, 395, 397, 1022 402, 403, 407, 411, 413, 415, 417, 422, 425, 427, 1023 429, 431, 436, 438, 440, 442, 444, 446, 448, 450, 1024 452, 454, 456, 463, 464, 466, 470, 471, 472, 473, 1025 477, 478, 480, 485, 486, 488, 490, 495, 496, 498, 1026 503, 504, 506, 511, 512, 514, 516, 518, 523, 524, 1027 526, 531, 532, 537, 538, 543, 544, 549, 550, 555, 1028 556, 561, 562, 564, 566, 571, 576, 577, 579, 581, 1029 587, 588, 594, 596, 598, 600, 605, 606, 611, 612, 1030 613, 614, 615, 616, 617, 618, 619, 620, 624, 625, 1031 631, 632, 638, 639, 640, 641, 642, 643, 644, 645, 1032 646, 656, 663, 665, 675, 676, 681, 683, 689, 691, 1033 695, 696, 701, 706, 709, 711, 713, 722, 724, 735, 1034 736, 738, 742, 743, 748, 749, 754, 755, 759, 764, 1035 765, 769, 771, 777, 778, 782, 784, 786, 788, 794, 1036 795, 799, 801, 806, 808, 810, 815, 817, 822, 824, 1037 828, 831, 835, 838, 842, 844, 848, 850, 857, 859, 1038 861, 870, 872, 874, 876, 878, 883, 885, 887, 889, 1039 894, 907, 908, 913, 915, 920, 924, 926, 928, 930, 1040 932, 938, 939, 945, 946, 950, 951, 956, 958, 964, 1041 965, 967, 972, 974, 981, 983, 987, 988, 993, 995, 1042 999, 1000, 1004, 1006, 1010, 1011, 1015, 1016, 1020, 1021, 1043 1036, 1037, 1038, 1039, 1040, 1044, 1049, 1056, 1066, 1071, 1044 1076, 1084, 1089, 1094, 1099, 1104, 1112, 1134, 1139, 1146, 1045 1148, 1155, 1160, 1165, 1176, 1181, 1186, 1191, 1196, 1205, 1046 1210, 1218, 1219, 1220, 1221, 1227, 1232, 1240, 1241, 1242, 1047 1243, 1247, 1248, 1249, 1250, 1255, 1256, 1265, 1266, 1271, 1048 1272, 1277, 1279, 1281, 1283, 1285, 1288, 1287, 1299, 1300, 1049 1302, 1312, 1313, 1318, 1322, 1324, 1326, 1328, 1330, 1332, 1050 1334, 1336, 1341, 1343, 1345, 1347, 1349, 1351, 1353, 1355, 1051 1357, 1359, 1361, 1363, 1365, 1371, 1372, 1374, 1376, 1378, 1052 1383, 1384, 1390, 1391, 1393, 1395, 1400, 1402, 1404, 1406, 1053 1411, 1412, 1414, 1416, 1421, 1422, 1424, 1429, 1430, 1432, 1054 1434, 1439, 1441, 1443, 1448, 1449, 1453, 1455, 1461, 1460, 1055 1464, 1466, 1471, 1473, 1479, 1480, 1485, 1486, 1488, 1489, 1056 1498, 1499, 1501, 1503, 1508, 1510, 1516, 1517, 1519, 1522, 1057 1525, 1530, 1531, 1536, 1541, 1545, 1547, 1553, 1552, 1559, 1058 1561, 1567, 1568, 1576, 1577, 1581, 1582, 1583, 1585, 1587, 1059 1594, 1595, 1597, 1599, 1604, 1605, 1611, 1612, 1616, 1617, 1060 1622, 1623, 1624, 1626, 1634, 1635, 1637, 1640, 1642, 1646, 1061 1647, 1648, 1650, 1652, 1656, 1661, 1669, 1670, 1679, 1681, 1062 1686, 1687, 1688, 1692, 1693, 1694, 1698, 1699, 1700, 1704, 1063 1705, 1706, 1711, 1712, 1713, 1714, 1720, 1721, 1723, 1728, 1064 1729, 1734, 1735, 1736, 1737, 1738, 1753, 1754, 1759, 1760, 1065 1768, 1770, 1772, 1775, 1777, 1779, 1802, 1803, 1805, 1807, 1066 1812, 1813, 1815, 1820, 1825, 1826, 1832, 1831, 1835, 1839, 1067 1841, 1843, 1849, 1850, 1855, 1860, 1862, 1867, 1869, 1870, 1068 1872, 1877, 1879, 1881, 1886, 1888, 1893, 1898, 1906, 1912, 1069 1911, 1925, 1926, 1931, 1932, 1936, 1941, 1946, 1954, 1959, 1070 1970, 1971, 1982, 1983, 1989, 1990, 1994, 1995, 1996, 1999, 1071 1998, 2009, 2018, 2024, 2030, 2039, 2045, 2051, 2057, 2063, 1072 2071, 2077, 2085, 2091, 2100, 2101, 2102, 2106, 2110, 2112, 1073 2117, 2118, 2122, 2123, 2128, 2134, 2135, 2138, 2140, 2141, 1074 2145, 2146, 2147, 2148, 2182, 2184, 2185, 2187, 2192, 2197, 1075 2202, 2204, 2206, 2211, 2213, 2215, 2217, 2222, 2224, 2233, 1076 2235, 2236, 2241, 2243, 2245, 2250, 2252, 2254, 2259, 2261, 1077 2263, 2272, 2273, 2274, 2278, 2280, 2282, 2287, 2289, 2291, 1078 2296, 2298, 2300, 2315, 2317, 2318, 2320, 2325, 2326, 2331, 1079 2333, 2335, 2340, 2342, 2344, 2346, 2351, 2353, 2355, 2365, 1080 2367, 2368, 2370, 2375, 2377, 2379, 2384, 2386, 2388, 2390, 1081 2395, 2397, 2399, 2430, 2432, 2433, 2435, 2440, 2445, 2453, 1082 2455, 2457, 2462, 2464, 2469, 2471, 2485, 2486, 2488, 2493, 1083 2495, 2497, 2499, 2501, 2506, 2507, 2509, 2511, 2516, 2518, 1084 2520, 2526, 2528, 2530, 2534, 2536, 2538, 2540, 2554, 2555, 1085 2557, 2562, 2564, 2566, 2568, 2570, 2575, 2576, 2578, 2580, 1086 2585, 2587, 2589, 2595, 2596, 2598, 2607, 2610, 2612, 2615, 1087 2617, 2619, 2632, 2633, 2635, 2640, 2642, 2644, 2646, 2648, 1088 2653, 2654, 2656, 2658, 2663, 2665, 2673, 2674, 2675, 2680, 1089 2681, 2685, 2687, 2689, 2691, 2693, 2695, 2702, 2704, 2706, 1090 2708, 2710, 2712, 2714, 2716, 2718, 2720, 2725, 2727, 2729, 1091 2734, 2760, 2761, 2763, 2767, 2768, 2772, 2774, 2776, 2778, 1092 2780, 2782, 2789, 2791, 2793, 2795, 2797, 2799, 2804, 2809, 1093 2811, 2813, 2831, 2833, 2838, 2839 1095 1094 }; 1096 1095 #endif … … 5217 5216 5218 5217 /* Line 1806 of yacc.c */ 5219 #line 29 2"parser.yy"5218 #line 290 "parser.yy" 5220 5219 { 5221 5220 typedefTable.enterScope(); … … 5226 5225 5227 5226 /* Line 1806 of yacc.c */ 5228 #line 29 8"parser.yy"5227 #line 296 "parser.yy" 5229 5228 { 5230 5229 typedefTable.leaveScope(); … … 5235 5234 5236 5235 /* Line 1806 of yacc.c */ 5236 #line 305 "parser.yy" 5237 { (yyval.constant) = makeConstantInteger( *(yyvsp[(1) - (1)].tok) ); } 5238 break; 5239 5240 case 5: 5241 5242 /* Line 1806 of yacc.c */ 5243 #line 306 "parser.yy" 5244 { (yyval.constant) = makeConstantFloat( *(yyvsp[(1) - (1)].tok) ); } 5245 break; 5246 5247 case 6: 5248 5249 /* Line 1806 of yacc.c */ 5237 5250 #line 307 "parser.yy" 5238 { (yyval.constant) = makeConstantInteger( *(yyvsp[(1) - (1)].tok) ); }5239 break;5240 5241 case 5:5242 5243 /* Line 1806 of yacc.c */5244 #line 308 "parser.yy"5245 { (yyval.constant) = makeConstantFloat( *(yyvsp[(1) - (1)].tok) ); }5246 break;5247 5248 case 6:5249 5250 /* Line 1806 of yacc.c */5251 #line 309 "parser.yy"5252 5251 { (yyval.constant) = makeConstantChar( *(yyvsp[(1) - (1)].tok) ); } 5253 5252 break; … … 5256 5255 5257 5256 /* Line 1806 of yacc.c */ 5258 #line 33 4"parser.yy"5257 #line 332 "parser.yy" 5259 5258 { (yyval.constant) = makeConstantStr( *(yyvsp[(1) - (1)].tok) ); } 5260 5259 break; … … 5263 5262 5264 5263 /* Line 1806 of yacc.c */ 5265 #line 33 5"parser.yy"5264 #line 333 "parser.yy" 5266 5265 { (yyval.constant) = (yyvsp[(1) - (2)].constant)->appendstr( (yyvsp[(2) - (2)].tok) ); } 5267 5266 break; 5268 5267 5269 5268 case 18: 5269 5270 /* Line 1806 of yacc.c */ 5271 #line 340 "parser.yy" 5272 { (yyval.en) = new VarRefNode( (yyvsp[(1) - (1)].tok) ); } 5273 break; 5274 5275 case 19: 5270 5276 5271 5277 /* Line 1806 of yacc.c */ … … 5274 5280 break; 5275 5281 5276 case 19:5282 case 20: 5277 5283 5278 5284 /* Line 1806 of yacc.c */ 5279 5285 #line 344 "parser.yy" 5280 { (yyval.en) = new VarRefNode( (yyvsp[(1) - (1)].tok)); }5281 break; 5282 5283 case 2 0:5286 { (yyval.en) = (yyvsp[(2) - (3)].en); } 5287 break; 5288 5289 case 21: 5284 5290 5285 5291 /* Line 1806 of yacc.c */ 5286 5292 #line 346 "parser.yy" 5287 { (yyval.en) = (yyvsp[(2) - (3)].en); }5288 break;5289 5290 case 21:5291 5292 /* Line 1806 of yacc.c */5293 #line 348 "parser.yy"5294 5293 { (yyval.en) = new ValofExprNode( (yyvsp[(2) - (3)].sn) ); } 5295 5294 break; … … 5298 5297 5299 5298 /* Line 1806 of yacc.c */ 5299 #line 356 "parser.yy" 5300 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Index ), (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en) ); } 5301 break; 5302 5303 case 24: 5304 5305 /* Line 1806 of yacc.c */ 5300 5306 #line 358 "parser.yy" 5301 { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Index, (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en) ) ); }5302 break;5303 5304 case 24:5305 5306 /* Line 1806 of yacc.c */5307 #line 360 "parser.yy"5308 5307 { (yyval.en) = new CompositeExprNode( (yyvsp[(1) - (4)].en), (yyvsp[(3) - (4)].en) ); } 5309 5308 break; … … 5312 5311 5313 5312 /* Line 1806 of yacc.c */ 5314 #line 36 4"parser.yy"5315 { (yyval.en) = new CompositeExprNode 2( build_fieldSel( (yyvsp[(1) - (3)].en), new VarRefNode( (yyvsp[(3) - (3)].tok) ) )); }5313 #line 362 "parser.yy" 5314 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), (yyvsp[(1) - (3)].en), new VarRefNode( (yyvsp[(3) - (3)].tok) )); } 5316 5315 break; 5317 5316 … … 5319 5318 5320 5319 /* Line 1806 of yacc.c */ 5321 #line 36 7"parser.yy"5322 { (yyval.en) = new CompositeExprNode 2( build_pfieldSel( (yyvsp[(1) - (3)].en), new VarRefNode( (yyvsp[(3) - (3)].tok) ) )); }5320 #line 365 "parser.yy" 5321 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), (yyvsp[(1) - (3)].en), new VarRefNode( (yyvsp[(3) - (3)].tok) )); } 5323 5322 break; 5324 5323 … … 5326 5325 5327 5326 /* Line 1806 of yacc.c */ 5327 #line 368 "parser.yy" 5328 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::IncrPost ), (yyvsp[(1) - (2)].en) ); } 5329 break; 5330 5331 case 30: 5332 5333 /* Line 1806 of yacc.c */ 5328 5334 #line 370 "parser.yy" 5329 { (yyval.en) = new CompositeExprNode 2( build_opr1( OperatorNode::IncrPost, (yyvsp[(1) - (2)].en)) ); }5330 break; 5331 5332 case 3 0:5335 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::DecrPost ), (yyvsp[(1) - (2)].en) ); } 5336 break; 5337 5338 case 31: 5333 5339 5334 5340 /* Line 1806 of yacc.c */ 5335 5341 #line 372 "parser.yy" 5336 { (yyval.en) = new Compo siteExprNode2( build_opr1( OperatorNode::DecrPost, (yyvsp[(1) - (2)].en)) ); }5337 break; 5338 5339 case 3 1:5342 { (yyval.en) = new CompoundLiteralNode( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ); } 5343 break; 5344 5345 case 32: 5340 5346 5341 5347 /* Line 1806 of yacc.c */ 5342 5348 #line 374 "parser.yy" 5343 { (yyval.en) = new CompoundLiteralNode( (yyvsp[(2) - (7)].decl), new InitializerNode( (yyvsp[(5) - (7)].in), true ) ); }5344 break;5345 5346 case 32:5347 5348 /* Line 1806 of yacc.c */5349 #line 376 "parser.yy"5350 5349 { 5351 5350 Token fn; fn.str = new std::string( "?{}" ); // location undefined … … 5357 5356 5358 5357 /* Line 1806 of yacc.c */ 5359 #line 38 5"parser.yy"5358 #line 383 "parser.yy" 5360 5359 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) )); } 5361 5360 break; … … 5364 5363 5365 5364 /* Line 1806 of yacc.c */ 5366 #line 3 90"parser.yy"5365 #line 388 "parser.yy" 5367 5366 { (yyval.en) = 0; } 5368 5367 break; … … 5371 5370 5372 5371 /* Line 1806 of yacc.c */ 5373 #line 39 3"parser.yy"5372 #line 391 "parser.yy" 5374 5373 { (yyval.en) = (yyvsp[(3) - (3)].en)->set_argName( (yyvsp[(1) - (3)].tok) ); } 5375 5374 break; … … 5378 5377 5379 5378 /* Line 1806 of yacc.c */ 5379 #line 396 "parser.yy" 5380 { (yyval.en) = (yyvsp[(7) - (7)].en)->set_argName( (yyvsp[(3) - (7)].en) ); } 5381 break; 5382 5383 case 39: 5384 5385 /* Line 1806 of yacc.c */ 5380 5386 #line 398 "parser.yy" 5381 { (yyval.en) = (yyvsp[(7) - (7)].en)->set_argName( (yyvsp[(3) - (7)].en) ); }5382 break;5383 5384 case 39:5385 5386 /* Line 1806 of yacc.c */5387 #line 400 "parser.yy"5388 5387 { (yyval.en) = (yyvsp[(9) - (9)].en)->set_argName( new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(yyvsp[(3) - (9)].en)->set_link( flattenCommas( (yyvsp[(5) - (9)].en) )))); } 5389 5388 break; … … 5392 5391 5393 5392 /* Line 1806 of yacc.c */ 5394 #line 40 5"parser.yy"5393 #line 403 "parser.yy" 5395 5394 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) ); } 5396 5395 break; … … 5399 5398 5400 5399 /* Line 1806 of yacc.c */ 5401 #line 4 10"parser.yy"5400 #line 408 "parser.yy" 5402 5401 { (yyval.en) = new VarRefNode( (yyvsp[(1) - (1)].tok) ); } 5403 5402 break; … … 5406 5405 5407 5406 /* Line 1806 of yacc.c */ 5407 #line 412 "parser.yy" 5408 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( (yyvsp[(1) - (3)].tok) ), (yyvsp[(3) - (3)].en) ); } 5409 break; 5410 5411 case 44: 5412 5413 /* Line 1806 of yacc.c */ 5408 5414 #line 414 "parser.yy" 5409 { (yyval.en) = new CompositeExprNode 2( build_fieldSel( (yyvsp[(3) - (3)].en), new VarRefNode( (yyvsp[(1) - (3)].tok) )) ); }5410 break; 5411 5412 case 4 4:5415 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( (yyvsp[(1) - (7)].tok) ), (yyvsp[(5) - (7)].en) ); } 5416 break; 5417 5418 case 45: 5413 5419 5414 5420 /* Line 1806 of yacc.c */ 5415 5421 #line 416 "parser.yy" 5416 { (yyval.en) = new CompositeExprNode 2( build_fieldSel( (yyvsp[(5) - (7)].en), new VarRefNode( (yyvsp[(1) - (7)].tok) )) ); }5417 break; 5418 5419 case 4 5:5422 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), new VarRefNode( (yyvsp[(1) - (3)].tok) ), (yyvsp[(3) - (3)].en) ); } 5423 break; 5424 5425 case 46: 5420 5426 5421 5427 /* Line 1806 of yacc.c */ 5422 5428 #line 418 "parser.yy" 5423 { (yyval.en) = new CompositeExprNode2( build_pfieldSel( (yyvsp[(3) - (3)].en), new VarRefNode( (yyvsp[(1) - (3)].tok) ) ) ); } 5424 break; 5425 5426 case 46: 5427 5428 /* Line 1806 of yacc.c */ 5429 #line 420 "parser.yy" 5430 { (yyval.en) = new CompositeExprNode2( build_pfieldSel( (yyvsp[(5) - (7)].en), new VarRefNode( (yyvsp[(1) - (7)].tok) ) ) ); } 5429 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), new VarRefNode( (yyvsp[(1) - (7)].tok) ), (yyvsp[(5) - (7)].en) ); } 5431 5430 break; 5432 5431 5433 5432 case 48: 5433 5434 /* Line 1806 of yacc.c */ 5435 #line 426 "parser.yy" 5436 { (yyval.en) = (yyvsp[(1) - (1)].constant); } 5437 break; 5438 5439 case 49: 5434 5440 5435 5441 /* Line 1806 of yacc.c */ … … 5438 5444 break; 5439 5445 5440 case 49:5446 case 50: 5441 5447 5442 5448 /* Line 1806 of yacc.c */ 5443 5449 #line 430 "parser.yy" 5444 { (yyval.en) = (yyvsp[( 1) - (1)].constant); }5445 break; 5446 5447 case 5 0:5450 { (yyval.en) = (yyvsp[(2) - (2)].en)->set_extension( true ); } 5451 break; 5452 5453 case 51: 5448 5454 5449 5455 /* Line 1806 of yacc.c */ 5450 5456 #line 432 "parser.yy" 5451 { (yyval.en) = (yyvsp[(2) - (2)].en)->set_extension( true); }5452 break; 5453 5454 case 5 1:5457 { (yyval.en) = new CompositeExprNode( (yyvsp[(1) - (2)].en), (yyvsp[(2) - (2)].en) ); } 5458 break; 5459 5460 case 52: 5455 5461 5456 5462 /* Line 1806 of yacc.c */ 5457 5463 #line 437 "parser.yy" 5458 { (yyval.en) = (yyvsp[(1) - (2)].op) == OperatorNode::AddressOf ? (ExpressionNode*) new CompositeExprNode2( build_addressOf( (yyvsp[(2) - (2)].en) ) )5459 : (ExpressionNode*)new CompositeExprNode( new OperatorNode ( (yyvsp[(1) - (2)].op) ), (yyvsp[(2) - (2)].en) ); }5460 break;5461 5462 case 52:5463 5464 /* Line 1806 of yacc.c */5465 #line 440 "parser.yy"5466 5464 { (yyval.en) = new CompositeExprNode( (yyvsp[(1) - (2)].en), (yyvsp[(2) - (2)].en) ); } 5467 5465 break; … … 5470 5468 5471 5469 /* Line 1806 of yacc.c */ 5472 #line 4 42"parser.yy"5473 { (yyval.en) = new CompositeExprNode 2( build_opr1( OperatorNode::Incr, (yyvsp[(2) - (2)].en)) ); }5470 #line 439 "parser.yy" 5471 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Incr ), (yyvsp[(2) - (2)].en) ); } 5474 5472 break; 5475 5473 … … 5477 5475 5478 5476 /* Line 1806 of yacc.c */ 5479 #line 44 4"parser.yy"5480 { (yyval.en) = new CompositeExprNode 2( build_opr1( OperatorNode::Decr, (yyvsp[(2) - (2)].en)) ); }5477 #line 441 "parser.yy" 5478 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Decr ), (yyvsp[(2) - (2)].en) ); } 5481 5479 break; 5482 5480 … … 5484 5482 5485 5483 /* Line 1806 of yacc.c */ 5486 #line 44 6"parser.yy"5487 { (yyval.en) = new CompositeExprNode 2( build_sizeOf( (yyvsp[(2) - (2)].en)) ); }5484 #line 443 "parser.yy" 5485 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), (yyvsp[(2) - (2)].en) ); } 5488 5486 break; 5489 5487 … … 5491 5489 5492 5490 /* Line 1806 of yacc.c */ 5493 #line 44 8"parser.yy"5494 { (yyval.en) = new CompositeExprNode 2( build_sizeOf( new TypeValueNode( (yyvsp[(3) - (4)].decl) ) )); }5491 #line 445 "parser.yy" 5492 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( (yyvsp[(3) - (4)].decl) )); } 5495 5493 break; 5496 5494 … … 5498 5496 5499 5497 /* Line 1806 of yacc.c */ 5500 #line 4 50"parser.yy"5501 { (yyval.en) = new CompositeExprNode 2( build_offsetOf( new TypeValueNode( (yyvsp[(3) - (6)].decl) ), new VarRefNode( (yyvsp[(5) - (6)].tok) ) )); }5498 #line 447 "parser.yy" 5499 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( (yyvsp[(3) - (6)].decl) ), new VarRefNode( (yyvsp[(5) - (6)].tok) )); } 5502 5500 break; 5503 5501 … … 5505 5503 5506 5504 /* Line 1806 of yacc.c */ 5507 #line 4 52"parser.yy"5508 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (1)].tok) ) ); }5505 #line 449 "parser.yy" 5506 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (1)].tok) )); } 5509 5507 break; 5510 5508 … … 5512 5510 5513 5511 /* Line 1806 of yacc.c */ 5514 #line 45 4"parser.yy"5515 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (4)].tok) ), new TypeValueNode( (yyvsp[(3) - (4)].decl) ) ); }5512 #line 451 "parser.yy" 5513 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (4)].tok) ), new TypeValueNode( (yyvsp[(3) - (4)].decl) )); } 5516 5514 break; 5517 5515 … … 5519 5517 5520 5518 /* Line 1806 of yacc.c */ 5521 #line 45 6"parser.yy"5519 #line 453 "parser.yy" 5522 5520 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( (yyvsp[(1) - (4)].tok) ), (yyvsp[(3) - (4)].en) ); } 5523 5521 break; … … 5526 5524 5527 5525 /* Line 1806 of yacc.c */ 5528 #line 45 8"parser.yy"5529 { (yyval.en) = new CompositeExprNode 2( build_alignOf( (yyvsp[(2) - (2)].en)) ); }5526 #line 455 "parser.yy" 5527 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), (yyvsp[(2) - (2)].en) ); } 5530 5528 break; 5531 5529 … … 5533 5531 5534 5532 /* Line 1806 of yacc.c */ 5535 #line 4 60"parser.yy"5536 { (yyval.en) = new CompositeExprNode 2( build_alignOf( new TypeValueNode( (yyvsp[(3) - (4)].decl)) ) ); }5533 #line 457 "parser.yy" 5534 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( (yyvsp[(3) - (4)].decl) ) ); } 5537 5535 break; 5538 5536 … … 5540 5538 5541 5539 /* Line 1806 of yacc.c */ 5540 #line 463 "parser.yy" 5541 { (yyval.en) = new OperatorNode( OperatorNode::PointTo ); } 5542 break; 5543 5544 case 64: 5545 5546 /* Line 1806 of yacc.c */ 5547 #line 464 "parser.yy" 5548 { (yyval.en) = new OperatorNode( OperatorNode::AddressOf ); } 5549 break; 5550 5551 case 65: 5552 5553 /* Line 1806 of yacc.c */ 5542 5554 #line 466 "parser.yy" 5543 { (yyval.op) = OperatorNode::PointTo; } 5544 break; 5545 5546 case 64: 5547 5548 /* Line 1806 of yacc.c */ 5549 #line 467 "parser.yy" 5550 { (yyval.op) = OperatorNode::AddressOf; } 5551 break; 5552 5553 case 65: 5554 5555 /* Line 1806 of yacc.c */ 5556 #line 469 "parser.yy" 5557 { (yyval.op) = OperatorNode::And; } 5555 { (yyval.en) = new OperatorNode( OperatorNode::And ); } 5558 5556 break; 5559 5557 … … 5561 5559 5562 5560 /* Line 1806 of yacc.c */ 5561 #line 470 "parser.yy" 5562 { (yyval.en) = new OperatorNode( OperatorNode::UnPlus ); } 5563 break; 5564 5565 case 67: 5566 5567 /* Line 1806 of yacc.c */ 5568 #line 471 "parser.yy" 5569 { (yyval.en) = new OperatorNode( OperatorNode::UnMinus ); } 5570 break; 5571 5572 case 68: 5573 5574 /* Line 1806 of yacc.c */ 5575 #line 472 "parser.yy" 5576 { (yyval.en) = new OperatorNode( OperatorNode::Neg ); } 5577 break; 5578 5579 case 69: 5580 5581 /* Line 1806 of yacc.c */ 5563 5582 #line 473 "parser.yy" 5564 { (yyval.en) = new OperatorNode( OperatorNode::UnPlus ); }5565 break;5566 5567 case 67:5568 5569 /* Line 1806 of yacc.c */5570 #line 474 "parser.yy"5571 { (yyval.en) = new OperatorNode( OperatorNode::UnMinus ); }5572 break;5573 5574 case 68:5575 5576 /* Line 1806 of yacc.c */5577 #line 475 "parser.yy"5578 { (yyval.en) = new OperatorNode( OperatorNode::Neg ); }5579 break;5580 5581 case 69:5582 5583 /* Line 1806 of yacc.c */5584 #line 476 "parser.yy"5585 5583 { (yyval.en) = new OperatorNode( OperatorNode::BitNeg ); } 5586 5584 break; … … 5589 5587 5590 5588 /* Line 1806 of yacc.c */ 5591 #line 4 82"parser.yy"5592 { (yyval.en) = new CompositeExprNode 2( build_cast( new TypeValueNode( (yyvsp[(2) - (4)].decl) ), (yyvsp[(4) - (4)].en)) ); }5589 #line 479 "parser.yy" 5590 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Cast ), new TypeValueNode( (yyvsp[(2) - (4)].decl) ), (yyvsp[(4) - (4)].en) ); } 5593 5591 break; 5594 5592 … … 5596 5594 5597 5595 /* Line 1806 of yacc.c */ 5598 #line 48 4"parser.yy"5599 { (yyval.en) = new CompositeExprNode 2( build_cast( new TypeValueNode( (yyvsp[(2) - (4)].decl) ), (yyvsp[(4) - (4)].en)) ); }5596 #line 481 "parser.yy" 5597 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Cast ), new TypeValueNode( (yyvsp[(2) - (4)].decl) ), (yyvsp[(4) - (4)].en) ); } 5600 5598 break; 5601 5599 … … 5603 5601 5604 5602 /* Line 1806 of yacc.c */ 5605 #line 4 90"parser.yy"5606 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::Mul, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5603 #line 487 "parser.yy" 5604 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Mul ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5607 5605 break; 5608 5606 … … 5610 5608 5611 5609 /* Line 1806 of yacc.c */ 5612 #line 4 92"parser.yy"5613 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::Div, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5610 #line 489 "parser.yy" 5611 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Div ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5614 5612 break; 5615 5613 … … 5617 5615 5618 5616 /* Line 1806 of yacc.c */ 5619 #line 49 4"parser.yy"5620 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::Mod, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5617 #line 491 "parser.yy" 5618 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Mod ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5621 5619 break; 5622 5620 … … 5624 5622 5625 5623 /* Line 1806 of yacc.c */ 5626 #line 500"parser.yy"5627 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::Plus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5624 #line 497 "parser.yy" 5625 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Plus ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5628 5626 break; 5629 5627 … … 5631 5629 5632 5630 /* Line 1806 of yacc.c */ 5633 #line 502"parser.yy"5634 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::Minus, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5631 #line 499 "parser.yy" 5632 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Minus ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5635 5633 break; 5636 5634 … … 5638 5636 5639 5637 /* Line 1806 of yacc.c */ 5640 #line 50 8"parser.yy"5641 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::LShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5638 #line 505 "parser.yy" 5639 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::LShift ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5642 5640 break; 5643 5641 … … 5645 5643 5646 5644 /* Line 1806 of yacc.c */ 5647 #line 5 10"parser.yy"5648 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::RShift, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5645 #line 507 "parser.yy" 5646 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::RShift ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5649 5647 break; 5650 5648 … … 5652 5650 5653 5651 /* Line 1806 of yacc.c */ 5654 #line 51 6"parser.yy"5655 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::LThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5652 #line 513 "parser.yy" 5653 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::LThan ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5656 5654 break; 5657 5655 … … 5659 5657 5660 5658 /* Line 1806 of yacc.c */ 5661 #line 51 8"parser.yy"5662 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::GThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5659 #line 515 "parser.yy" 5660 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::GThan ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5663 5661 break; 5664 5662 … … 5666 5664 5667 5665 /* Line 1806 of yacc.c */ 5668 #line 5 20"parser.yy"5669 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::LEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5666 #line 517 "parser.yy" 5667 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::LEThan ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5670 5668 break; 5671 5669 … … 5673 5671 5674 5672 /* Line 1806 of yacc.c */ 5675 #line 5 22"parser.yy"5676 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::GEThan, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5673 #line 519 "parser.yy" 5674 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::GEThan ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5677 5675 break; 5678 5676 … … 5680 5678 5681 5679 /* Line 1806 of yacc.c */ 5682 #line 52 8"parser.yy"5683 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::Eq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5680 #line 525 "parser.yy" 5681 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Eq ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5684 5682 break; 5685 5683 … … 5687 5685 5688 5686 /* Line 1806 of yacc.c */ 5689 #line 5 30"parser.yy"5690 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::Neq, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5687 #line 527 "parser.yy" 5688 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Neq ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5691 5689 break; 5692 5690 … … 5694 5692 5695 5693 /* Line 1806 of yacc.c */ 5696 #line 53 6"parser.yy"5697 { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::BitAnd, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5694 #line 533 "parser.yy" 5695 { (yyval.en) =new CompositeExprNode( new OperatorNode( OperatorNode::BitAnd ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5698 5696 break; 5699 5697 … … 5701 5699 5702 5700 /* Line 1806 of yacc.c */ 5703 #line 5 42"parser.yy"5704 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::Xor, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5701 #line 539 "parser.yy" 5702 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Xor ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5705 5703 break; 5706 5704 … … 5708 5706 5709 5707 /* Line 1806 of yacc.c */ 5710 #line 54 8"parser.yy"5711 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::BitOr, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }5708 #line 545 "parser.yy" 5709 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::BitOr ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5712 5710 break; 5713 5711 … … 5715 5713 5716 5714 /* Line 1806 of yacc.c */ 5717 #line 55 4"parser.yy"5718 { (yyval.en) = new CompositeExprNode 2( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), true) ); }5715 #line 551 "parser.yy" 5716 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::And ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5719 5717 break; 5720 5718 … … 5722 5720 5723 5721 /* Line 1806 of yacc.c */ 5724 #line 5 60"parser.yy"5725 { (yyval.en) = new CompositeExprNode 2( build_and_or( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en), false) ); }5722 #line 557 "parser.yy" 5723 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Or ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5726 5724 break; 5727 5725 … … 5729 5727 5730 5728 /* Line 1806 of yacc.c */ 5729 #line 563 "parser.yy" 5730 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Cond ), (ExpressionNode *)mkList( (*(yyvsp[(1) - (5)].en), *(yyvsp[(3) - (5)].en), *(yyvsp[(5) - (5)].en) ) ) ); } 5731 break; 5732 5733 case 103: 5734 5735 /* Line 1806 of yacc.c */ 5736 #line 565 "parser.yy" 5737 { (yyval.en)=new CompositeExprNode( new OperatorNode( OperatorNode::NCond ), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ); } 5738 break; 5739 5740 case 104: 5741 5742 /* Line 1806 of yacc.c */ 5731 5743 #line 567 "parser.yy" 5732 { (yyval.en) = new CompositeExprNode2( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); } 5733 break; 5734 5735 case 103: 5736 5737 /* Line 1806 of yacc.c */ 5738 #line 569 "parser.yy" 5739 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::NCond ), (yyvsp[(1) - (4)].en), (yyvsp[(4) - (4)].en) ); } 5740 break; 5741 5742 case 104: 5743 5744 /* Line 1806 of yacc.c */ 5745 #line 571 "parser.yy" 5746 { (yyval.en) = new CompositeExprNode2( build_cond( (yyvsp[(1) - (5)].en), (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].en) ) ); } 5744 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Cond ), (ExpressionNode *)mkList( (*(yyvsp[(1) - (5)].en), *(yyvsp[(3) - (5)].en), *(yyvsp[(5) - (5)].en) ) ) ); } 5747 5745 break; 5748 5746 … … 5750 5748 5751 5749 /* Line 1806 of yacc.c */ 5750 #line 578 "parser.yy" 5751 { (yyval.en) =new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5752 break; 5753 5754 case 108: 5755 5756 /* Line 1806 of yacc.c */ 5757 #line 580 "parser.yy" 5758 { (yyval.en) =new CompositeExprNode( (yyvsp[(2) - (3)].en), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5759 break; 5760 5761 case 109: 5762 5763 /* Line 1806 of yacc.c */ 5752 5764 #line 582 "parser.yy" 5753 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }5754 break;5755 5756 case 108:5757 5758 /* Line 1806 of yacc.c */5759 #line 584 "parser.yy"5760 { (yyval.en) = new CompositeExprNode( (yyvsp[(2) - (3)].en), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); }5761 break;5762 5763 case 109:5764 5765 /* Line 1806 of yacc.c */5766 #line 586 "parser.yy"5767 5765 { (yyval.en) = ( (yyvsp[(2) - (2)].en) == 0 ) ? (yyvsp[(1) - (2)].en) : new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), (yyvsp[(1) - (2)].en), (yyvsp[(2) - (2)].en) ); } 5768 5766 break; … … 5771 5769 5772 5770 /* Line 1806 of yacc.c */ 5773 #line 5 91"parser.yy"5771 #line 587 "parser.yy" 5774 5772 { (yyval.en) = new NullExprNode; } 5775 5773 break; … … 5778 5776 5779 5777 /* Line 1806 of yacc.c */ 5778 #line 595 "parser.yy" 5779 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ) ); } 5780 break; 5781 5782 case 113: 5783 5784 /* Line 1806 of yacc.c */ 5785 #line 597 "parser.yy" 5786 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (yyvsp[(3) - (5)].en) ); } 5787 break; 5788 5789 case 114: 5790 5791 /* Line 1806 of yacc.c */ 5780 5792 #line 599 "parser.yy" 5781 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ) ); }5782 break; 5783 5784 case 11 3:5793 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(new NullExprNode)->set_link( (yyvsp[(4) - (6)].en) ) ); } 5794 break; 5795 5796 case 115: 5785 5797 5786 5798 /* Line 1806 of yacc.c */ 5787 5799 #line 601 "parser.yy" 5788 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (yyvsp[(3) - (5)].en) ); }5789 break;5790 5791 case 114:5792 5793 /* Line 1806 of yacc.c */5794 #line 603 "parser.yy"5795 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(new NullExprNode)->set_link( (yyvsp[(4) - (6)].en) ) ); }5796 break;5797 5798 case 115:5799 5800 /* Line 1806 of yacc.c */5801 #line 605 "parser.yy"5802 5800 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(yyvsp[(3) - (7)].en)->set_link( flattenCommas( (yyvsp[(5) - (7)].en) ) ) ); } 5803 5801 break; … … 5806 5804 5807 5805 /* Line 1806 of yacc.c */ 5806 #line 607 "parser.yy" 5807 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) ); } 5808 break; 5809 5810 case 118: 5811 5812 /* Line 1806 of yacc.c */ 5808 5813 #line 611 "parser.yy" 5809 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) ); } 5810 break; 5811 5812 case 118: 5814 { (yyval.en) = new OperatorNode( OperatorNode::MulAssn ); } 5815 break; 5816 5817 case 119: 5818 5819 /* Line 1806 of yacc.c */ 5820 #line 612 "parser.yy" 5821 { (yyval.en) = new OperatorNode( OperatorNode::DivAssn ); } 5822 break; 5823 5824 case 120: 5825 5826 /* Line 1806 of yacc.c */ 5827 #line 613 "parser.yy" 5828 { (yyval.en) = new OperatorNode( OperatorNode::ModAssn ); } 5829 break; 5830 5831 case 121: 5832 5833 /* Line 1806 of yacc.c */ 5834 #line 614 "parser.yy" 5835 { (yyval.en) = new OperatorNode( OperatorNode::PlusAssn ); } 5836 break; 5837 5838 case 122: 5813 5839 5814 5840 /* Line 1806 of yacc.c */ 5815 5841 #line 615 "parser.yy" 5816 { (yyval.en) = new OperatorNode( OperatorNode::M ulAssn ); }5817 break; 5818 5819 case 1 19:5842 { (yyval.en) = new OperatorNode( OperatorNode::MinusAssn ); } 5843 break; 5844 5845 case 123: 5820 5846 5821 5847 /* Line 1806 of yacc.c */ 5822 5848 #line 616 "parser.yy" 5823 { (yyval.en) = new OperatorNode( OperatorNode:: DivAssn ); }5824 break; 5825 5826 case 12 0:5849 { (yyval.en) = new OperatorNode( OperatorNode::LSAssn ); } 5850 break; 5851 5852 case 124: 5827 5853 5828 5854 /* Line 1806 of yacc.c */ 5829 5855 #line 617 "parser.yy" 5830 { (yyval.en) = new OperatorNode( OperatorNode:: ModAssn ); }5831 break; 5832 5833 case 12 1:5856 { (yyval.en) = new OperatorNode( OperatorNode::RSAssn ); } 5857 break; 5858 5859 case 125: 5834 5860 5835 5861 /* Line 1806 of yacc.c */ 5836 5862 #line 618 "parser.yy" 5837 { (yyval.en) = new OperatorNode( OperatorNode:: PlusAssn ); }5838 break; 5839 5840 case 12 2:5863 { (yyval.en) = new OperatorNode( OperatorNode::AndAssn ); } 5864 break; 5865 5866 case 126: 5841 5867 5842 5868 /* Line 1806 of yacc.c */ 5843 5869 #line 619 "parser.yy" 5844 { (yyval.en) = new OperatorNode( OperatorNode:: MinusAssn ); }5845 break; 5846 5847 case 12 3:5870 { (yyval.en) = new OperatorNode( OperatorNode::ERAssn ); } 5871 break; 5872 5873 case 127: 5848 5874 5849 5875 /* Line 1806 of yacc.c */ 5850 5876 #line 620 "parser.yy" 5851 { (yyval.en) = new OperatorNode( OperatorNode::LSAssn ); }5852 break;5853 5854 case 124:5855 5856 /* Line 1806 of yacc.c */5857 #line 621 "parser.yy"5858 { (yyval.en) = new OperatorNode( OperatorNode::RSAssn ); }5859 break;5860 5861 case 125:5862 5863 /* Line 1806 of yacc.c */5864 #line 622 "parser.yy"5865 { (yyval.en) = new OperatorNode( OperatorNode::AndAssn ); }5866 break;5867 5868 case 126:5869 5870 /* Line 1806 of yacc.c */5871 #line 623 "parser.yy"5872 { (yyval.en) = new OperatorNode( OperatorNode::ERAssn ); }5873 break;5874 5875 case 127:5876 5877 /* Line 1806 of yacc.c */5878 #line 624 "parser.yy"5879 5877 { (yyval.en) = new OperatorNode( OperatorNode::OrAssn ); } 5880 5878 break; … … 5883 5881 5884 5882 /* Line 1806 of yacc.c */ 5883 #line 626 "parser.yy" 5884 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Comma ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 5885 break; 5886 5887 case 130: 5888 5889 /* Line 1806 of yacc.c */ 5885 5890 #line 631 "parser.yy" 5886 { (yyval.en) = new CompositeExprNode2( build_comma( (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); }5887 break;5888 5889 case 130:5890 5891 /* Line 1806 of yacc.c */5892 #line 636 "parser.yy"5893 5891 { (yyval.en) = 0; } 5894 5892 break; … … 5897 5895 5898 5896 /* Line 1806 of yacc.c */ 5899 #line 64 5"parser.yy"5897 #line 640 "parser.yy" 5900 5898 { (yyval.sn) = (yyvsp[(1) - (1)].sn); } 5901 5899 break; … … 5904 5902 5905 5903 /* Line 1806 of yacc.c */ 5906 #line 6 52"parser.yy"5904 #line 647 "parser.yy" 5907 5905 { 5908 5906 Token fn; fn.str = new std::string( "^?{}" ); // location undefined … … 5915 5913 5916 5914 /* Line 1806 of yacc.c */ 5917 #line 6 62"parser.yy"5915 #line 657 "parser.yy" 5918 5916 { 5919 5917 (yyval.sn) = (yyvsp[(4) - (4)].sn)->add_label( (yyvsp[(1) - (4)].tok) ); … … 5924 5922 5925 5923 /* Line 1806 of yacc.c */ 5926 #line 66 9"parser.yy"5924 #line 664 "parser.yy" 5927 5925 { (yyval.sn) = new CompoundStmtNode( (StatementNode *)0 ); } 5928 5926 break; … … 5931 5929 5932 5930 /* Line 1806 of yacc.c */ 5933 #line 67 6"parser.yy"5931 #line 671 "parser.yy" 5934 5932 { (yyval.sn) = new CompoundStmtNode( (yyvsp[(5) - (7)].sn) ); } 5935 5933 break; … … 5938 5936 5939 5937 /* Line 1806 of yacc.c */ 5938 #line 677 "parser.yy" 5939 { if ( (yyvsp[(1) - (3)].sn) != 0 ) { (yyvsp[(1) - (3)].sn)->set_link( (yyvsp[(3) - (3)].sn) ); (yyval.sn) = (yyvsp[(1) - (3)].sn); } } 5940 break; 5941 5942 case 146: 5943 5944 /* Line 1806 of yacc.c */ 5940 5945 #line 682 "parser.yy" 5941 { if ( (yyvsp[(1) - (3)].sn) != 0 ) { (yyvsp[(1) - (3)].sn)->set_link( (yyvsp[(3) - (3)].sn) ); (yyval.sn) = (yyvsp[(1) - (3)].sn); } }5942 break;5943 5944 case 146:5945 5946 /* Line 1806 of yacc.c */5947 #line 687 "parser.yy"5948 5946 { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); } 5949 5947 break; … … 5952 5950 5953 5951 /* Line 1806 of yacc.c */ 5954 #line 68 9"parser.yy"5952 #line 684 "parser.yy" 5955 5953 { // mark all fields in list 5956 5954 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != NULL; iter = (DeclarationNode *)iter->get_link() ) … … 5963 5961 5964 5962 /* Line 1806 of yacc.c */ 5965 #line 69 5"parser.yy"5963 #line 690 "parser.yy" 5966 5964 { (yyval.sn) = new StatementNode( (yyvsp[(1) - (1)].decl) ); } 5967 5965 break; … … 5970 5968 5971 5969 /* Line 1806 of yacc.c */ 5970 #line 697 "parser.yy" 5971 { if ( (yyvsp[(1) - (2)].sn) != 0 ) { (yyvsp[(1) - (2)].sn)->set_link( (yyvsp[(2) - (2)].sn) ); (yyval.sn) = (yyvsp[(1) - (2)].sn); } } 5972 break; 5973 5974 case 152: 5975 5976 /* Line 1806 of yacc.c */ 5972 5977 #line 702 "parser.yy" 5973 { if ( (yyvsp[(1) - (2)].sn) != 0 ) { (yyvsp[(1) - (2)].sn)->set_link( (yyvsp[(2) - (2)].sn) ); (yyval.sn) = (yyvsp[(1) - (2)].sn); } }5974 break;5975 5976 case 152:5977 5978 /* Line 1806 of yacc.c */5979 #line 707 "parser.yy"5980 5978 { (yyval.sn) = new StatementNode( StatementNode::Exp, (yyvsp[(1) - (2)].en), 0 ); } 5981 5979 break; … … 5984 5982 5985 5983 /* Line 1806 of yacc.c */ 5986 #line 7 13"parser.yy"5984 #line 708 "parser.yy" 5987 5985 { (yyval.sn) = new StatementNode( StatementNode::If, (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ); } 5988 5986 break; … … 5991 5989 5992 5990 /* Line 1806 of yacc.c */ 5993 #line 71 5"parser.yy"5991 #line 710 "parser.yy" 5994 5992 { (yyval.sn) = new StatementNode( StatementNode::If, (yyvsp[(3) - (7)].en), (StatementNode *)mkList((*(yyvsp[(5) - (7)].sn), *(yyvsp[(7) - (7)].sn) )) ); } 5995 5993 break; … … 5998 5996 5999 5997 /* Line 1806 of yacc.c */ 6000 #line 71 7"parser.yy"5998 #line 712 "parser.yy" 6001 5999 { (yyval.sn) = new StatementNode( StatementNode::Switch, (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ); } 6002 6000 break; … … 6005 6003 6006 6004 /* Line 1806 of yacc.c */ 6007 #line 71 9"parser.yy"6005 #line 714 "parser.yy" 6008 6006 { 6009 6007 StatementNode *sw = new StatementNode( StatementNode::Switch, (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ); … … 6011 6009 // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound 6012 6010 // statement around the switch. Statements after the initial declaration list can never be executed, and 6013 // therefore, are removed from the grammar even though C allows it. The change also applies to choose 6014 // statement. 6011 // therefore, are removed from the grammar even though C allows it. Change also applies to choose statement. 6015 6012 (yyval.sn) = (yyvsp[(7) - (9)].decl) != 0 ? new CompoundStmtNode( (StatementNode *)((new StatementNode( (yyvsp[(7) - (9)].decl) ))->set_link( sw )) ) : sw; 6016 6013 } … … 6020 6017 6021 6018 /* Line 1806 of yacc.c */ 6022 #line 72 9"parser.yy"6019 #line 723 "parser.yy" 6023 6020 { (yyval.sn) = new StatementNode( StatementNode::Switch, (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ); } 6024 6021 break; … … 6027 6024 6028 6025 /* Line 1806 of yacc.c */ 6029 #line 7 31"parser.yy"6026 #line 725 "parser.yy" 6030 6027 { 6031 6028 StatementNode *sw = new StatementNode( StatementNode::Switch, (yyvsp[(3) - (9)].en), (yyvsp[(8) - (9)].sn) ); … … 6037 6034 6038 6035 /* Line 1806 of yacc.c */ 6039 #line 7 41"parser.yy"6036 #line 735 "parser.yy" 6040 6037 { (yyval.en) = (yyvsp[(1) - (1)].en); } 6041 6038 break; … … 6044 6041 6045 6042 /* Line 1806 of yacc.c */ 6046 #line 743 "parser.yy" 6047 { (yyval.en) = new CompositeExprNode2( build_opr2( OperatorNode::Range, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ) ); } 6048 break; 6049 6050 case 162: 6043 #line 737 "parser.yy" 6044 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Range ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 6045 break; 6046 6047 case 163: 6048 6049 /* Line 1806 of yacc.c */ 6050 #line 744 "parser.yy" 6051 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(tupleContents( (yyvsp[(1) - (3)].en) ))->set_link( (yyvsp[(3) - (3)].en) ) ); } 6052 break; 6053 6054 case 164: 6051 6055 6052 6056 /* Line 1806 of yacc.c */ 6053 6057 #line 748 "parser.yy" 6054 { (yyval.sn) = new StatementNode( StatementNode::Case, (yyvsp[(1) - (1)].en), 0 ); } 6055 break; 6056 6057 case 163: 6058 6059 /* Line 1806 of yacc.c */ 6060 #line 750 "parser.yy" 6061 { (yyval.sn) = (StatementNode *)((yyvsp[(1) - (3)].sn)->set_link( new StatementNode( StatementNode::Case, (yyvsp[(3) - (3)].en), 0 ) ) ); } 6062 break; 6063 6064 case 164: 6065 6066 /* Line 1806 of yacc.c */ 6067 #line 754 "parser.yy" 6068 { (yyval.sn) = (yyvsp[(2) - (3)].sn); } 6058 { (yyval.sn) = new StatementNode( StatementNode::Case, (yyvsp[(2) - (3)].en), 0 ); } 6069 6059 break; 6070 6060 … … 6072 6062 6073 6063 /* Line 1806 of yacc.c */ 6064 #line 749 "parser.yy" 6065 { (yyval.sn) = new StatementNode( StatementNode::Default ); } 6066 break; 6067 6068 case 167: 6069 6070 /* Line 1806 of yacc.c */ 6074 6071 #line 755 "parser.yy" 6075 { (yyval.sn) = new StatementNode( StatementNode::Default ); }6076 break;6077 6078 case 167:6079 6080 /* Line 1806 of yacc.c */6081 #line 761 "parser.yy"6082 6072 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (2)].sn)->set_link( (yyvsp[(2) - (2)].sn) )); } 6083 6073 break; … … 6086 6076 6087 6077 /* Line 1806 of yacc.c */ 6088 #line 7 65"parser.yy"6078 #line 759 "parser.yy" 6089 6079 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new CompoundStmtNode( (yyvsp[(2) - (2)].sn) ) ); } 6090 6080 break; … … 6093 6083 6094 6084 /* Line 1806 of yacc.c */ 6085 #line 764 "parser.yy" 6086 { (yyval.sn) = 0; } 6087 break; 6088 6089 case 171: 6090 6091 /* Line 1806 of yacc.c */ 6095 6092 #line 770 "parser.yy" 6093 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new CompoundStmtNode( (yyvsp[(2) - (2)].sn) ) ); } 6094 break; 6095 6096 case 172: 6097 6098 /* Line 1806 of yacc.c */ 6099 #line 772 "parser.yy" 6100 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_link( (yyvsp[(2) - (3)].sn)->append_last_case( new CompoundStmtNode( (yyvsp[(3) - (3)].sn) ) ) ) ); } 6101 break; 6102 6103 case 173: 6104 6105 /* Line 1806 of yacc.c */ 6106 #line 777 "parser.yy" 6096 6107 { (yyval.sn) = 0; } 6097 6108 break; 6098 6109 6099 case 171: 6100 6101 /* Line 1806 of yacc.c */ 6102 #line 776 "parser.yy" 6103 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( new CompoundStmtNode( (yyvsp[(2) - (2)].sn) ) ); } 6104 break; 6105 6106 case 172: 6107 6108 /* Line 1806 of yacc.c */ 6109 #line 778 "parser.yy" 6110 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_link( (yyvsp[(2) - (3)].sn)->append_last_case( new CompoundStmtNode( (yyvsp[(3) - (3)].sn) ) ) ) ); } 6111 break; 6112 6113 case 173: 6110 case 175: 6114 6111 6115 6112 /* Line 1806 of yacc.c */ 6116 6113 #line 783 "parser.yy" 6114 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); } 6115 break; 6116 6117 case 176: 6118 6119 /* Line 1806 of yacc.c */ 6120 #line 785 "parser.yy" 6121 { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new CompoundStmtNode( (StatementNode *)mkList( (*(yyvsp[(2) - (3)].sn), *(yyvsp[(3) - (3)].sn) ) ) ) ); } 6122 break; 6123 6124 case 177: 6125 6126 /* Line 1806 of yacc.c */ 6127 #line 787 "parser.yy" 6128 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_link( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); } 6129 break; 6130 6131 case 178: 6132 6133 /* Line 1806 of yacc.c */ 6134 #line 789 "parser.yy" 6135 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (4)].sn)->set_link( (yyvsp[(2) - (4)].sn)->append_last_case( new CompoundStmtNode( (StatementNode *)mkList( (*(yyvsp[(3) - (4)].sn), *(yyvsp[(4) - (4)].sn) ) ) ) ) ) ); } 6136 break; 6137 6138 case 179: 6139 6140 /* Line 1806 of yacc.c */ 6141 #line 794 "parser.yy" 6142 { (yyval.sn) = new StatementNode( StatementNode::Break ); } 6143 break; 6144 6145 case 181: 6146 6147 /* Line 1806 of yacc.c */ 6148 #line 800 "parser.yy" 6117 6149 { (yyval.sn) = 0; } 6118 6150 break; 6119 6151 6120 case 175: 6121 6122 /* Line 1806 of yacc.c */ 6123 #line 789 "parser.yy" 6124 { (yyval.sn) = (yyvsp[(1) - (2)].sn)->append_last_case( (yyvsp[(2) - (2)].sn) ); } 6125 break; 6126 6127 case 176: 6128 6129 /* Line 1806 of yacc.c */ 6130 #line 791 "parser.yy" 6131 { (yyval.sn) = (yyvsp[(1) - (3)].sn)->append_last_case( new CompoundStmtNode( (StatementNode *)mkList( (*(yyvsp[(2) - (3)].sn), *(yyvsp[(3) - (3)].sn) ) ) ) ); } 6132 break; 6133 6134 case 177: 6135 6136 /* Line 1806 of yacc.c */ 6137 #line 793 "parser.yy" 6138 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (3)].sn)->set_link( (yyvsp[(2) - (3)].sn)->append_last_case( (yyvsp[(3) - (3)].sn) ))); } 6139 break; 6140 6141 case 178: 6142 6143 /* Line 1806 of yacc.c */ 6144 #line 795 "parser.yy" 6145 { (yyval.sn) = (StatementNode *)( (yyvsp[(1) - (4)].sn)->set_link( (yyvsp[(2) - (4)].sn)->append_last_case( new CompoundStmtNode( (StatementNode *)mkList( (*(yyvsp[(3) - (4)].sn), *(yyvsp[(4) - (4)].sn) ) ) ) ) ) ); } 6146 break; 6147 6148 case 179: 6149 6150 /* Line 1806 of yacc.c */ 6151 #line 800 "parser.yy" 6152 case 182: 6153 6154 /* Line 1806 of yacc.c */ 6155 #line 802 "parser.yy" 6156 { (yyval.sn) = 0; } 6157 break; 6158 6159 case 183: 6160 6161 /* Line 1806 of yacc.c */ 6162 #line 807 "parser.yy" 6163 { (yyval.sn) = new StatementNode( StatementNode::While, (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ); } 6164 break; 6165 6166 case 184: 6167 6168 /* Line 1806 of yacc.c */ 6169 #line 809 "parser.yy" 6170 { (yyval.sn) = new StatementNode( StatementNode::Do, (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn) ); } 6171 break; 6172 6173 case 185: 6174 6175 /* Line 1806 of yacc.c */ 6176 #line 811 "parser.yy" 6177 { (yyval.sn) = new StatementNode( StatementNode::For, (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].sn) ); } 6178 break; 6179 6180 case 186: 6181 6182 /* Line 1806 of yacc.c */ 6183 #line 816 "parser.yy" 6184 { (yyval.en) = new ForCtlExprNode( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); } 6185 break; 6186 6187 case 187: 6188 6189 /* Line 1806 of yacc.c */ 6190 #line 818 "parser.yy" 6191 { (yyval.en) = new ForCtlExprNode( (yyvsp[(1) - (4)].decl), (yyvsp[(2) - (4)].en), (yyvsp[(4) - (4)].en) ); } 6192 break; 6193 6194 case 188: 6195 6196 /* Line 1806 of yacc.c */ 6197 #line 823 "parser.yy" 6198 { (yyval.sn) = new StatementNode( StatementNode::Goto, (yyvsp[(2) - (3)].tok) ); } 6199 break; 6200 6201 case 189: 6202 6203 /* Line 1806 of yacc.c */ 6204 #line 827 "parser.yy" 6205 { (yyval.sn) = new StatementNode( StatementNode::Goto, (yyvsp[(3) - (4)].en) ); } 6206 break; 6207 6208 case 190: 6209 6210 /* Line 1806 of yacc.c */ 6211 #line 830 "parser.yy" 6212 { (yyval.sn) = new StatementNode( StatementNode::Continue ); } 6213 break; 6214 6215 case 191: 6216 6217 /* Line 1806 of yacc.c */ 6218 #line 834 "parser.yy" 6219 { (yyval.sn) = new StatementNode( StatementNode::Continue, (yyvsp[(2) - (3)].tok) ); } 6220 break; 6221 6222 case 192: 6223 6224 /* Line 1806 of yacc.c */ 6225 #line 837 "parser.yy" 6152 6226 { (yyval.sn) = new StatementNode( StatementNode::Break ); } 6153 6227 break; 6154 6228 6155 case 181: 6156 6157 /* Line 1806 of yacc.c */ 6158 #line 806 "parser.yy" 6159 { (yyval.sn) = 0; } 6160 break; 6161 6162 case 182: 6163 6164 /* Line 1806 of yacc.c */ 6165 #line 808 "parser.yy" 6166 { (yyval.sn) = 0; } 6167 break; 6168 6169 case 183: 6170 6171 /* Line 1806 of yacc.c */ 6172 #line 813 "parser.yy" 6173 { (yyval.sn) = new StatementNode( StatementNode::While, (yyvsp[(3) - (5)].en), (yyvsp[(5) - (5)].sn) ); } 6174 break; 6175 6176 case 184: 6177 6178 /* Line 1806 of yacc.c */ 6179 #line 815 "parser.yy" 6180 { (yyval.sn) = new StatementNode( StatementNode::Do, (yyvsp[(5) - (7)].en), (yyvsp[(2) - (7)].sn) ); } 6181 break; 6182 6183 case 185: 6184 6185 /* Line 1806 of yacc.c */ 6186 #line 817 "parser.yy" 6187 { (yyval.sn) = new StatementNode( StatementNode::For, (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].sn) ); } 6188 break; 6189 6190 case 186: 6191 6192 /* Line 1806 of yacc.c */ 6193 #line 822 "parser.yy" 6194 { (yyval.en) = new ForCtlExprNode( (yyvsp[(1) - (6)].en), (yyvsp[(4) - (6)].en), (yyvsp[(6) - (6)].en) ); } 6195 break; 6196 6197 case 187: 6198 6199 /* Line 1806 of yacc.c */ 6200 #line 824 "parser.yy" 6201 { (yyval.en) = new ForCtlExprNode( (yyvsp[(1) - (4)].decl), (yyvsp[(2) - (4)].en), (yyvsp[(4) - (4)].en) ); } 6202 break; 6203 6204 case 188: 6205 6206 /* Line 1806 of yacc.c */ 6207 #line 829 "parser.yy" 6208 { (yyval.sn) = new StatementNode( StatementNode::Goto, (yyvsp[(2) - (3)].tok) ); } 6209 break; 6210 6211 case 189: 6212 6213 /* Line 1806 of yacc.c */ 6214 #line 833 "parser.yy" 6215 { (yyval.sn) = new StatementNode( StatementNode::Goto, (yyvsp[(3) - (4)].en) ); } 6216 break; 6217 6218 case 190: 6219 6220 /* Line 1806 of yacc.c */ 6221 #line 836 "parser.yy" 6222 { (yyval.sn) = new StatementNode( StatementNode::Continue ); } 6223 break; 6224 6225 case 191: 6226 6227 /* Line 1806 of yacc.c */ 6228 #line 840 "parser.yy" 6229 { (yyval.sn) = new StatementNode( StatementNode::Continue, (yyvsp[(2) - (3)].tok) ); } 6230 break; 6231 6232 case 192: 6229 case 193: 6230 6231 /* Line 1806 of yacc.c */ 6232 #line 841 "parser.yy" 6233 { (yyval.sn) = new StatementNode( StatementNode::Break, (yyvsp[(2) - (3)].tok) ); } 6234 break; 6235 6236 case 194: 6233 6237 6234 6238 /* Line 1806 of yacc.c */ 6235 6239 #line 843 "parser.yy" 6236 { (yyval.sn) = new StatementNode( StatementNode:: Break); }6237 break; 6238 6239 case 19 3:6240 6241 /* Line 1806 of yacc.c */ 6242 #line 84 7"parser.yy"6243 { (yyval.sn) = new StatementNode( StatementNode:: Break, (yyvsp[(2) - (3)].tok)); }6244 break; 6245 6246 case 19 4:6240 { (yyval.sn) = new StatementNode( StatementNode::Return, (yyvsp[(2) - (3)].en), 0 ); } 6241 break; 6242 6243 case 195: 6244 6245 /* Line 1806 of yacc.c */ 6246 #line 845 "parser.yy" 6247 { (yyval.sn) = new StatementNode( StatementNode::Throw, (yyvsp[(2) - (3)].en), 0 ); } 6248 break; 6249 6250 case 196: 6247 6251 6248 6252 /* Line 1806 of yacc.c */ 6249 6253 #line 849 "parser.yy" 6250 { (yyval.sn) = new StatementNode( StatementNode:: Return, (yyvsp[(2) - (3)].en), 0 ); }6251 break; 6252 6253 case 19 5:6254 { (yyval.sn) = new StatementNode( StatementNode::Throw, (yyvsp[(2) - (3)].en), 0 ); } 6255 break; 6256 6257 case 197: 6254 6258 6255 6259 /* Line 1806 of yacc.c */ 6256 6260 #line 851 "parser.yy" 6257 { (yyval.sn) = new StatementNode( StatementNode::Throw, (yyvsp[(2) - (3)].en), 0 ); }6258 break;6259 6260 case 196:6261 6262 /* Line 1806 of yacc.c */6263 #line 855 "parser.yy"6264 { (yyval.sn) = new StatementNode( StatementNode::Throw, (yyvsp[(2) - (3)].en), 0 ); }6265 break;6266 6267 case 197:6268 6269 /* Line 1806 of yacc.c */6270 #line 857 "parser.yy"6271 6261 { (yyval.sn) = new StatementNode( StatementNode::Throw, (yyvsp[(2) - (5)].en), 0 ); } 6272 6262 break; … … 6275 6265 6276 6266 /* Line 1806 of yacc.c */ 6277 #line 8 64"parser.yy"6267 #line 858 "parser.yy" 6278 6268 { (yyval.sn) = new StatementNode( StatementNode::Try, 0,(StatementNode *)(mkList((*(yyvsp[(2) - (3)].sn),*(yyvsp[(3) - (3)].pn) )))); } 6279 6269 break; … … 6282 6272 6283 6273 /* Line 1806 of yacc.c */ 6284 #line 86 6"parser.yy"6274 #line 860 "parser.yy" 6285 6275 { (yyval.sn) = new StatementNode( StatementNode::Try, 0,(StatementNode *)(mkList((*(yyvsp[(2) - (3)].sn),*(yyvsp[(3) - (3)].pn) )))); } 6286 6276 break; … … 6289 6279 6290 6280 /* Line 1806 of yacc.c */ 6291 #line 86 8"parser.yy"6281 #line 862 "parser.yy" 6292 6282 { 6293 6283 (yyvsp[(3) - (4)].pn)->set_link( (yyvsp[(4) - (4)].pn) ); … … 6299 6289 6300 6290 /* Line 1806 of yacc.c */ 6291 #line 873 "parser.yy" 6292 { (yyval.pn) = StatementNode::newCatchStmt( 0, (yyvsp[(5) - (5)].sn), true ); } 6293 break; 6294 6295 case 203: 6296 6297 /* Line 1806 of yacc.c */ 6298 #line 875 "parser.yy" 6299 { (yyval.pn) = (yyvsp[(1) - (6)].pn)->set_link( StatementNode::newCatchStmt( 0, (yyvsp[(6) - (6)].sn), true ) ); } 6300 break; 6301 6302 case 204: 6303 6304 /* Line 1806 of yacc.c */ 6305 #line 877 "parser.yy" 6306 { (yyval.pn) = StatementNode::newCatchStmt( 0, (yyvsp[(5) - (5)].sn), true ); } 6307 break; 6308 6309 case 205: 6310 6311 /* Line 1806 of yacc.c */ 6301 6312 #line 879 "parser.yy" 6302 { (yyval.pn) = StatementNode::newCatchStmt( 0, (yyvsp[(5) - (5)].sn), true ); }6303 break;6304 6305 case 203:6306 6307 /* Line 1806 of yacc.c */6308 #line 881 "parser.yy"6309 6313 { (yyval.pn) = (yyvsp[(1) - (6)].pn)->set_link( StatementNode::newCatchStmt( 0, (yyvsp[(6) - (6)].sn), true ) ); } 6310 6314 break; 6311 6315 6312 case 204:6313 6314 /* Line 1806 of yacc.c */6315 #line 883 "parser.yy"6316 { (yyval.pn) = StatementNode::newCatchStmt( 0, (yyvsp[(5) - (5)].sn), true ); }6317 break;6318 6319 case 205:6320 6321 /* Line 1806 of yacc.c */6322 #line 885 "parser.yy"6323 { (yyval.pn) = (yyvsp[(1) - (6)].pn)->set_link( StatementNode::newCatchStmt( 0, (yyvsp[(6) - (6)].sn), true ) ); }6324 break;6325 6326 6316 case 206: 6327 6317 6328 6318 /* Line 1806 of yacc.c */ 6319 #line 884 "parser.yy" 6320 { (yyval.pn) = StatementNode::newCatchStmt( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ); } 6321 break; 6322 6323 case 207: 6324 6325 /* Line 1806 of yacc.c */ 6326 #line 886 "parser.yy" 6327 { (yyval.pn) = (yyvsp[(1) - (10)].pn)->set_link( StatementNode::newCatchStmt( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ); } 6328 break; 6329 6330 case 208: 6331 6332 /* Line 1806 of yacc.c */ 6333 #line 888 "parser.yy" 6334 { (yyval.pn) = StatementNode::newCatchStmt( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ); } 6335 break; 6336 6337 case 209: 6338 6339 /* Line 1806 of yacc.c */ 6329 6340 #line 890 "parser.yy" 6330 { (yyval.pn) = StatementNode::newCatchStmt( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ); }6331 break;6332 6333 case 207:6334 6335 /* Line 1806 of yacc.c */6336 #line 892 "parser.yy"6337 6341 { (yyval.pn) = (yyvsp[(1) - (10)].pn)->set_link( StatementNode::newCatchStmt( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ); } 6338 6342 break; 6339 6343 6340 case 208:6341 6342 /* Line 1806 of yacc.c */6343 #line 894 "parser.yy"6344 { (yyval.pn) = StatementNode::newCatchStmt( (yyvsp[(5) - (9)].decl), (yyvsp[(8) - (9)].sn) ); }6345 break;6346 6347 case 209:6348 6349 /* Line 1806 of yacc.c */6350 #line 896 "parser.yy"6351 { (yyval.pn) = (yyvsp[(1) - (10)].pn)->set_link( StatementNode::newCatchStmt( (yyvsp[(6) - (10)].decl), (yyvsp[(9) - (10)].sn) ) ); }6352 break;6353 6354 6344 case 210: 6355 6345 6356 6346 /* Line 1806 of yacc.c */ 6357 #line 901"parser.yy"6347 #line 895 "parser.yy" 6358 6348 { 6359 6349 (yyval.pn) = new StatementNode( StatementNode::Finally, 0, (yyvsp[(2) - (2)].sn) ); … … 6365 6355 6366 6356 /* Line 1806 of yacc.c */ 6367 #line 9 15"parser.yy"6357 #line 909 "parser.yy" 6368 6358 { 6369 6359 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6375 6365 6376 6366 /* Line 1806 of yacc.c */ 6377 #line 9 20"parser.yy"6367 #line 914 "parser.yy" 6378 6368 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 6379 6369 break; … … 6382 6372 6383 6373 /* Line 1806 of yacc.c */ 6384 #line 9 22"parser.yy"6374 #line 916 "parser.yy" 6385 6375 { 6386 6376 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6392 6382 6393 6383 /* Line 1806 of yacc.c */ 6384 #line 925 "parser.yy" 6385 { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (6)].flag), (yyvsp[(4) - (6)].constant), 0 ); } 6386 break; 6387 6388 case 217: 6389 6390 /* Line 1806 of yacc.c */ 6391 #line 927 "parser.yy" 6392 { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ); } 6393 break; 6394 6395 case 218: 6396 6397 /* Line 1806 of yacc.c */ 6398 #line 929 "parser.yy" 6399 { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ); } 6400 break; 6401 6402 case 219: 6403 6404 /* Line 1806 of yacc.c */ 6394 6405 #line 931 "parser.yy" 6395 { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - ( 6)].flag), (yyvsp[(4) - (6)].constant), 0); }6396 break; 6397 6398 case 2 17:6406 { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].constant) ); } 6407 break; 6408 6409 case 220: 6399 6410 6400 6411 /* Line 1806 of yacc.c */ 6401 6412 #line 933 "parser.yy" 6402 { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (8)].flag), (yyvsp[(4) - (8)].constant), (yyvsp[(6) - (8)].en) ); }6403 break;6404 6405 case 218:6406 6407 /* Line 1806 of yacc.c */6408 #line 935 "parser.yy"6409 { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (10)].flag), (yyvsp[(4) - (10)].constant), (yyvsp[(6) - (10)].en), (yyvsp[(8) - (10)].en) ); }6410 break;6411 6412 case 219:6413 6414 /* Line 1806 of yacc.c */6415 #line 937 "parser.yy"6416 { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (12)].flag), (yyvsp[(4) - (12)].constant), (yyvsp[(6) - (12)].en), (yyvsp[(8) - (12)].en), (yyvsp[(10) - (12)].constant) ); }6417 break;6418 6419 case 220:6420 6421 /* Line 1806 of yacc.c */6422 #line 939 "parser.yy"6423 6413 { (yyval.sn) = new AsmStmtNode( StatementNode::Asm, (yyvsp[(2) - (14)].flag), (yyvsp[(5) - (14)].constant), 0, (yyvsp[(8) - (14)].en), (yyvsp[(10) - (14)].constant), (yyvsp[(12) - (14)].label) ); } 6424 6414 break; … … 6427 6417 6428 6418 /* Line 1806 of yacc.c */ 6429 #line 9 44"parser.yy"6419 #line 938 "parser.yy" 6430 6420 { (yyval.flag) = false; } 6431 6421 break; … … 6434 6424 6435 6425 /* Line 1806 of yacc.c */ 6436 #line 94 6"parser.yy"6426 #line 940 "parser.yy" 6437 6427 { (yyval.flag) = true; } 6438 6428 break; … … 6441 6431 6442 6432 /* Line 1806 of yacc.c */ 6443 #line 9 51"parser.yy"6433 #line 945 "parser.yy" 6444 6434 { (yyval.en) = 0; } 6445 6435 break; … … 6448 6438 6449 6439 /* Line 1806 of yacc.c */ 6450 #line 95 8"parser.yy"6440 #line 952 "parser.yy" 6451 6441 { (yyval.en) = (ExpressionNode *)(yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) ); } 6452 6442 break; … … 6455 6445 6456 6446 /* Line 1806 of yacc.c */ 6457 #line 9 63"parser.yy"6447 #line 957 "parser.yy" 6458 6448 { (yyval.en) = new AsmExprNode( 0, (yyvsp[(1) - (4)].constant), (yyvsp[(3) - (4)].en) ); } 6459 6449 break; … … 6462 6452 6463 6453 /* Line 1806 of yacc.c */ 6464 #line 9 65"parser.yy"6454 #line 959 "parser.yy" 6465 6455 { (yyval.en) = new AsmExprNode( (yyvsp[(2) - (7)].en), (yyvsp[(4) - (7)].constant), (yyvsp[(6) - (7)].en) ); } 6466 6456 break; … … 6469 6459 6470 6460 /* Line 1806 of yacc.c */ 6471 #line 9 70"parser.yy"6461 #line 964 "parser.yy" 6472 6462 { (yyval.constant) = 0; } 6473 6463 break; … … 6476 6466 6477 6467 /* Line 1806 of yacc.c */ 6478 #line 9 72"parser.yy"6468 #line 966 "parser.yy" 6479 6469 { (yyval.constant) = (yyvsp[(1) - (1)].constant); } 6480 6470 break; … … 6483 6473 6484 6474 /* Line 1806 of yacc.c */ 6485 #line 9 74"parser.yy"6475 #line 968 "parser.yy" 6486 6476 { (yyval.constant) = (ConstantNode *)(yyvsp[(1) - (3)].constant)->set_link( (yyvsp[(3) - (3)].constant) ); } 6487 6477 break; … … 6490 6480 6491 6481 /* Line 1806 of yacc.c */ 6492 #line 97 9"parser.yy"6482 #line 973 "parser.yy" 6493 6483 { (yyval.label) = new LabelNode(); (yyval.label)->append_label( (yyvsp[(1) - (1)].tok) ); } 6494 6484 break; … … 6497 6487 6498 6488 /* Line 1806 of yacc.c */ 6499 #line 9 81"parser.yy"6489 #line 975 "parser.yy" 6500 6490 { (yyval.label) = (yyvsp[(1) - (3)].label); (yyvsp[(1) - (3)].label)->append_label( (yyvsp[(3) - (3)].tok) ); } 6501 6491 break; … … 6504 6494 6505 6495 /* Line 1806 of yacc.c */ 6506 #line 98 8"parser.yy"6496 #line 982 "parser.yy" 6507 6497 { (yyval.decl) = 0; } 6508 6498 break; … … 6511 6501 6512 6502 /* Line 1806 of yacc.c */ 6513 #line 9 95"parser.yy"6503 #line 989 "parser.yy" 6514 6504 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); } 6515 6505 break; … … 6518 6508 6519 6509 /* Line 1806 of yacc.c */ 6520 #line 1000"parser.yy"6510 #line 994 "parser.yy" 6521 6511 { (yyval.decl) = 0; } 6522 6512 break; … … 6525 6515 6526 6516 /* Line 1806 of yacc.c */ 6527 #line 100 7"parser.yy"6517 #line 1001 "parser.yy" 6528 6518 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); } 6529 6519 break; … … 6532 6522 6533 6523 /* Line 1806 of yacc.c */ 6534 #line 10 21"parser.yy"6524 #line 1015 "parser.yy" 6535 6525 {} 6536 6526 break; … … 6539 6529 6540 6530 /* Line 1806 of yacc.c */ 6541 #line 10 22"parser.yy"6531 #line 1016 "parser.yy" 6542 6532 {} 6543 6533 break; … … 6546 6536 6547 6537 /* Line 1806 of yacc.c */ 6548 #line 10 51"parser.yy"6538 #line 1045 "parser.yy" 6549 6539 { 6550 6540 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6556 6546 6557 6547 /* Line 1806 of yacc.c */ 6558 #line 105 8"parser.yy"6548 #line 1052 "parser.yy" 6559 6549 { 6560 6550 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6566 6556 6567 6557 /* Line 1806 of yacc.c */ 6568 #line 10 63"parser.yy"6558 #line 1057 "parser.yy" 6569 6559 { 6570 6560 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (6)].tok), TypedefTable::ID ); … … 6576 6566 6577 6567 /* Line 1806 of yacc.c */ 6578 #line 10 73"parser.yy"6568 #line 1067 "parser.yy" 6579 6569 { 6580 6570 typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) ); … … 6586 6576 6587 6577 /* Line 1806 of yacc.c */ 6588 #line 107 8"parser.yy"6578 #line 1072 "parser.yy" 6589 6579 { 6590 6580 typedefTable.setNextIdentifier( *(yyvsp[(2) - (3)].tok) ); … … 6596 6586 6597 6587 /* Line 1806 of yacc.c */ 6598 #line 10 83"parser.yy"6588 #line 1077 "parser.yy" 6599 6589 { 6600 6590 typedefTable.setNextIdentifier( *(yyvsp[(3) - (4)].tok) ); … … 6606 6596 6607 6597 /* Line 1806 of yacc.c */ 6608 #line 10 91"parser.yy"6598 #line 1085 "parser.yy" 6609 6599 { 6610 6600 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6616 6606 6617 6607 /* Line 1806 of yacc.c */ 6618 #line 109 6"parser.yy"6608 #line 1090 "parser.yy" 6619 6609 { 6620 6610 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6626 6616 6627 6617 /* Line 1806 of yacc.c */ 6628 #line 1 101"parser.yy"6618 #line 1095 "parser.yy" 6629 6619 { 6630 6620 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6636 6626 6637 6627 /* Line 1806 of yacc.c */ 6638 #line 110 6"parser.yy"6628 #line 1100 "parser.yy" 6639 6629 { 6640 6630 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6646 6636 6647 6637 /* Line 1806 of yacc.c */ 6648 #line 11 11"parser.yy"6638 #line 1105 "parser.yy" 6649 6639 { 6650 6640 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::ID ); … … 6656 6646 6657 6647 /* Line 1806 of yacc.c */ 6658 #line 111 9"parser.yy"6648 #line 1113 "parser.yy" 6659 6649 { 6660 6650 (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(3) - (8)].tok), DeclarationNode::newTuple( 0 ), (yyvsp[(6) - (8)].decl), 0, true ); … … 6665 6655 6666 6656 /* Line 1806 of yacc.c */ 6667 #line 11 42"parser.yy"6657 #line 1136 "parser.yy" 6668 6658 { 6669 6659 (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true ); … … 6674 6664 6675 6665 /* Line 1806 of yacc.c */ 6676 #line 114 6"parser.yy"6666 #line 1140 "parser.yy" 6677 6667 { 6678 6668 (yyval.decl) = DeclarationNode::newFunction( (yyvsp[(2) - (7)].tok), (yyvsp[(1) - (7)].decl), (yyvsp[(5) - (7)].decl), 0, true ); … … 6683 6673 6684 6674 /* Line 1806 of yacc.c */ 6685 #line 11 53"parser.yy"6675 #line 1147 "parser.yy" 6686 6676 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); } 6687 6677 break; … … 6690 6680 6691 6681 /* Line 1806 of yacc.c */ 6692 #line 115 7"parser.yy"6682 #line 1151 "parser.yy" 6693 6683 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (9)].decl)->appendList( (yyvsp[(7) - (9)].decl) ) ); } 6694 6684 break; … … 6697 6687 6698 6688 /* Line 1806 of yacc.c */ 6699 #line 11 62"parser.yy"6689 #line 1156 "parser.yy" 6700 6690 { 6701 6691 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6707 6697 6708 6698 /* Line 1806 of yacc.c */ 6709 #line 116 7"parser.yy"6699 #line 1161 "parser.yy" 6710 6700 { 6711 6701 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6717 6707 6718 6708 /* Line 1806 of yacc.c */ 6719 #line 11 72"parser.yy"6709 #line 1166 "parser.yy" 6720 6710 { 6721 6711 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (5)].tok), TypedefTable::TD ); … … 6727 6717 6728 6718 /* Line 1806 of yacc.c */ 6729 #line 11 83"parser.yy"6719 #line 1177 "parser.yy" 6730 6720 { 6731 6721 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6737 6727 6738 6728 /* Line 1806 of yacc.c */ 6739 #line 118 8"parser.yy"6729 #line 1182 "parser.yy" 6740 6730 { 6741 6731 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6747 6737 6748 6738 /* Line 1806 of yacc.c */ 6749 #line 11 93"parser.yy"6739 #line 1187 "parser.yy" 6750 6740 { 6751 6741 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6757 6747 6758 6748 /* Line 1806 of yacc.c */ 6759 #line 119 8"parser.yy"6749 #line 1192 "parser.yy" 6760 6750 { 6761 6751 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6767 6757 6768 6758 /* Line 1806 of yacc.c */ 6769 #line 1 203"parser.yy"6759 #line 1197 "parser.yy" 6770 6760 { 6771 6761 typedefTable.addToEnclosingScope( TypedefTable::TD ); … … 6777 6767 6778 6768 /* Line 1806 of yacc.c */ 6779 #line 12 12"parser.yy"6769 #line 1206 "parser.yy" 6780 6770 { 6781 6771 typedefTable.addToEnclosingScope( *(yyvsp[(2) - (4)].tok), TypedefTable::TD ); … … 6787 6777 6788 6778 /* Line 1806 of yacc.c */ 6789 #line 121 7"parser.yy"6779 #line 1211 "parser.yy" 6790 6780 { 6791 6781 typedefTable.addToEnclosingScope( *(yyvsp[(5) - (7)].tok), TypedefTable::TD ); … … 6797 6787 6798 6788 /* Line 1806 of yacc.c */ 6799 #line 12 34"parser.yy"6789 #line 1228 "parser.yy" 6800 6790 { 6801 6791 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6807 6797 6808 6798 /* Line 1806 of yacc.c */ 6809 #line 123 9"parser.yy"6799 #line 1233 "parser.yy" 6810 6800 { 6811 6801 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 6817 6807 6818 6808 /* Line 1806 of yacc.c */ 6819 #line 12 61"parser.yy"6809 #line 1255 "parser.yy" 6820 6810 { (yyval.decl) = 0; } 6821 6811 break; … … 6824 6814 6825 6815 /* Line 1806 of yacc.c */ 6826 #line 12 73"parser.yy"6816 #line 1267 "parser.yy" 6827 6817 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6828 6818 break; … … 6831 6821 6832 6822 /* Line 1806 of yacc.c */ 6823 #line 1278 "parser.yy" 6824 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Const ); } 6825 break; 6826 6827 case 302: 6828 6829 /* Line 1806 of yacc.c */ 6830 #line 1280 "parser.yy" 6831 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Restrict ); } 6832 break; 6833 6834 case 303: 6835 6836 /* Line 1806 of yacc.c */ 6837 #line 1282 "parser.yy" 6838 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); } 6839 break; 6840 6841 case 304: 6842 6843 /* Line 1806 of yacc.c */ 6833 6844 #line 1284 "parser.yy" 6834 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode:: Const); }6835 break; 6836 6837 case 30 2:6845 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); } 6846 break; 6847 6848 case 305: 6838 6849 6839 6850 /* Line 1806 of yacc.c */ 6840 6851 #line 1286 "parser.yy" 6841 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode:: Restrict); }6842 break; 6843 6844 case 30 3:6852 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); } 6853 break; 6854 6855 case 306: 6845 6856 6846 6857 /* Line 1806 of yacc.c */ 6847 6858 #line 1288 "parser.yy" 6848 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Volatile ); }6849 break;6850 6851 case 304:6852 6853 /* Line 1806 of yacc.c */6854 #line 1290 "parser.yy"6855 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Lvalue ); }6856 break;6857 6858 case 305:6859 6860 /* Line 1806 of yacc.c */6861 #line 1292 "parser.yy"6862 { (yyval.decl) = DeclarationNode::newQualifier( DeclarationNode::Atomic ); }6863 break;6864 6865 case 306:6866 6867 /* Line 1806 of yacc.c */6868 #line 1294 "parser.yy"6869 6859 { 6870 6860 typedefTable.enterScope(); … … 6875 6865 6876 6866 /* Line 1806 of yacc.c */ 6877 #line 129 8"parser.yy"6867 #line 1292 "parser.yy" 6878 6868 { 6879 6869 typedefTable.leaveScope(); … … 6885 6875 6886 6876 /* Line 1806 of yacc.c */ 6887 #line 130 7"parser.yy"6877 #line 1301 "parser.yy" 6888 6878 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6889 6879 break; … … 6892 6882 6893 6883 /* Line 1806 of yacc.c */ 6894 #line 130 9"parser.yy"6884 #line 1303 "parser.yy" 6895 6885 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 6896 6886 break; … … 6899 6889 6900 6890 /* Line 1806 of yacc.c */ 6901 #line 13 20"parser.yy"6891 #line 1314 "parser.yy" 6902 6892 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 6903 6893 break; … … 6906 6896 6907 6897 /* Line 1806 of yacc.c */ 6898 #line 1323 "parser.yy" 6899 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Extern ); } 6900 break; 6901 6902 case 315: 6903 6904 /* Line 1806 of yacc.c */ 6905 #line 1325 "parser.yy" 6906 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Static ); } 6907 break; 6908 6909 case 316: 6910 6911 /* Line 1806 of yacc.c */ 6912 #line 1327 "parser.yy" 6913 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Auto ); } 6914 break; 6915 6916 case 317: 6917 6918 /* Line 1806 of yacc.c */ 6908 6919 #line 1329 "parser.yy" 6909 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode:: Extern); }6910 break; 6911 6912 case 31 5:6920 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Register ); } 6921 break; 6922 6923 case 318: 6913 6924 6914 6925 /* Line 1806 of yacc.c */ 6915 6926 #line 1331 "parser.yy" 6916 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode:: Static); }6917 break; 6918 6919 case 31 6:6927 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Inline ); } 6928 break; 6929 6930 case 319: 6920 6931 6921 6932 /* Line 1806 of yacc.c */ 6922 6933 #line 1333 "parser.yy" 6923 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode:: Auto); }6924 break; 6925 6926 case 3 17:6934 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); } 6935 break; 6936 6937 case 320: 6927 6938 6928 6939 /* Line 1806 of yacc.c */ 6929 6940 #line 1335 "parser.yy" 6930 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode:: Register); }6931 break; 6932 6933 case 3 18:6941 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Noreturn ); } 6942 break; 6943 6944 case 321: 6934 6945 6935 6946 /* Line 1806 of yacc.c */ 6936 6947 #line 1337 "parser.yy" 6937 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Inline ); }6938 break;6939 6940 case 319:6941 6942 /* Line 1806 of yacc.c */6943 #line 1339 "parser.yy"6944 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Fortran ); }6945 break;6946 6947 case 320:6948 6949 /* Line 1806 of yacc.c */6950 #line 1341 "parser.yy"6951 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Noreturn ); }6952 break;6953 6954 case 321:6955 6956 /* Line 1806 of yacc.c */6957 #line 1343 "parser.yy"6958 6948 { (yyval.decl) = DeclarationNode::newStorageClass( DeclarationNode::Threadlocal ); } 6959 6949 break; … … 6962 6952 6963 6953 /* Line 1806 of yacc.c */ 6954 #line 1342 "parser.yy" 6955 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Char ); } 6956 break; 6957 6958 case 323: 6959 6960 /* Line 1806 of yacc.c */ 6961 #line 1344 "parser.yy" 6962 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Double ); } 6963 break; 6964 6965 case 324: 6966 6967 /* Line 1806 of yacc.c */ 6968 #line 1346 "parser.yy" 6969 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Float ); } 6970 break; 6971 6972 case 325: 6973 6974 /* Line 1806 of yacc.c */ 6964 6975 #line 1348 "parser.yy" 6965 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode:: Char); }6966 break; 6967 6968 case 32 3:6976 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Int ); } 6977 break; 6978 6979 case 326: 6969 6980 6970 6981 /* Line 1806 of yacc.c */ 6971 6982 #line 1350 "parser.yy" 6972 { (yyval.decl) = DeclarationNode::new BasicType( DeclarationNode::Double); }6973 break; 6974 6975 case 32 4:6983 { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Long ); } 6984 break; 6985 6986 case 327: 6976 6987 6977 6988 /* Line 1806 of yacc.c */ 6978 6989 #line 1352 "parser.yy" 6979 { (yyval.decl) = DeclarationNode::new BasicType( DeclarationNode::Float ); }6980 break; 6981 6982 case 32 5:6990 { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Short ); } 6991 break; 6992 6993 case 328: 6983 6994 6984 6995 /* Line 1806 of yacc.c */ 6985 6996 #line 1354 "parser.yy" 6986 { (yyval.decl) = DeclarationNode::new BasicType( DeclarationNode::Int); }6987 break; 6988 6989 case 32 6:6997 { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Signed ); } 6998 break; 6999 7000 case 329: 6990 7001 6991 7002 /* Line 1806 of yacc.c */ 6992 7003 #line 1356 "parser.yy" 6993 { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode:: Long); }6994 break; 6995 6996 case 3 27:7004 { (yyval.decl) = DeclarationNode::newModifier( DeclarationNode::Unsigned ); } 7005 break; 7006 7007 case 330: 6997 7008 6998 7009 /* Line 1806 of yacc.c */ 6999 7010 #line 1358 "parser.yy" 7000 { (yyval.decl) = DeclarationNode::new Modifier( DeclarationNode::Short); }7001 break; 7002 7003 case 3 28:7011 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Void ); } 7012 break; 7013 7014 case 331: 7004 7015 7005 7016 /* Line 1806 of yacc.c */ 7006 7017 #line 1360 "parser.yy" 7007 { (yyval.decl) = DeclarationNode::new Modifier( DeclarationNode::Signed); }7008 break; 7009 7010 case 3 29:7018 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); } 7019 break; 7020 7021 case 332: 7011 7022 7012 7023 /* Line 1806 of yacc.c */ 7013 7024 #line 1362 "parser.yy" 7014 { (yyval.decl) = DeclarationNode::new Modifier( DeclarationNode::Unsigned); }7015 break; 7016 7017 case 33 0:7025 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Complex ); } 7026 break; 7027 7028 case 333: 7018 7029 7019 7030 /* Line 1806 of yacc.c */ 7020 7031 #line 1364 "parser.yy" 7021 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode:: Void); }7022 break; 7023 7024 case 33 1:7032 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); } 7033 break; 7034 7035 case 334: 7025 7036 7026 7037 /* Line 1806 of yacc.c */ 7027 7038 #line 1366 "parser.yy" 7028 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Bool ); }7029 break;7030 7031 case 332:7032 7033 /* Line 1806 of yacc.c */7034 #line 1368 "parser.yy"7035 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Complex ); }7036 break;7037 7038 case 333:7039 7040 /* Line 1806 of yacc.c */7041 #line 1370 "parser.yy"7042 { (yyval.decl) = DeclarationNode::newBasicType( DeclarationNode::Imaginary ); }7043 break;7044 7045 case 334:7046 7047 /* Line 1806 of yacc.c */7048 #line 1372 "parser.yy"7049 7039 { (yyval.decl) = DeclarationNode::newBuiltinType( DeclarationNode::Valist ); } 7050 7040 break; … … 7053 7043 7054 7044 /* Line 1806 of yacc.c */ 7045 #line 1373 "parser.yy" 7046 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7047 break; 7048 7049 case 337: 7050 7051 /* Line 1806 of yacc.c */ 7052 #line 1375 "parser.yy" 7053 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7054 break; 7055 7056 case 338: 7057 7058 /* Line 1806 of yacc.c */ 7059 #line 1377 "parser.yy" 7060 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 7061 break; 7062 7063 case 339: 7064 7065 /* Line 1806 of yacc.c */ 7055 7066 #line 1379 "parser.yy" 7067 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); } 7068 break; 7069 7070 case 341: 7071 7072 /* Line 1806 of yacc.c */ 7073 #line 1385 "parser.yy" 7074 { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 7075 break; 7076 7077 case 343: 7078 7079 /* Line 1806 of yacc.c */ 7080 #line 1392 "parser.yy" 7056 7081 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7057 7082 break; 7058 7083 7059 case 3 37:7060 7061 /* Line 1806 of yacc.c */ 7062 #line 13 81"parser.yy"7084 case 344: 7085 7086 /* Line 1806 of yacc.c */ 7087 #line 1394 "parser.yy" 7063 7088 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7064 7089 break; 7065 7090 7066 case 338: 7067 7068 /* Line 1806 of yacc.c */ 7069 #line 1383 "parser.yy" 7091 case 345: 7092 7093 /* Line 1806 of yacc.c */ 7094 #line 1396 "parser.yy" 7095 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); } 7096 break; 7097 7098 case 346: 7099 7100 /* Line 1806 of yacc.c */ 7101 #line 1401 "parser.yy" 7102 { (yyval.decl) = (yyvsp[(3) - (4)].decl); } 7103 break; 7104 7105 case 347: 7106 7107 /* Line 1806 of yacc.c */ 7108 #line 1403 "parser.yy" 7109 { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); } 7110 break; 7111 7112 case 348: 7113 7114 /* Line 1806 of yacc.c */ 7115 #line 1405 "parser.yy" 7116 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); } 7117 break; 7118 7119 case 349: 7120 7121 /* Line 1806 of yacc.c */ 7122 #line 1407 "parser.yy" 7123 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); } 7124 break; 7125 7126 case 351: 7127 7128 /* Line 1806 of yacc.c */ 7129 #line 1413 "parser.yy" 7130 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7131 break; 7132 7133 case 352: 7134 7135 /* Line 1806 of yacc.c */ 7136 #line 1415 "parser.yy" 7137 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7138 break; 7139 7140 case 353: 7141 7142 /* Line 1806 of yacc.c */ 7143 #line 1417 "parser.yy" 7070 7144 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 7071 7145 break; 7072 7146 7073 case 339: 7074 7075 /* Line 1806 of yacc.c */ 7076 #line 1385 "parser.yy" 7077 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addType( (yyvsp[(1) - (3)].decl) ); } 7078 break; 7079 7080 case 341: 7081 7082 /* Line 1806 of yacc.c */ 7083 #line 1391 "parser.yy" 7084 { (yyval.decl) = (yyvsp[(2) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 7085 break; 7086 7087 case 343: 7088 7089 /* Line 1806 of yacc.c */ 7090 #line 1398 "parser.yy" 7147 case 355: 7148 7149 /* Line 1806 of yacc.c */ 7150 #line 1423 "parser.yy" 7091 7151 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7092 7152 break; 7093 7153 7094 case 3 44:7095 7096 /* Line 1806 of yacc.c */ 7097 #line 14 00"parser.yy"7154 case 356: 7155 7156 /* Line 1806 of yacc.c */ 7157 #line 1425 "parser.yy" 7098 7158 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7099 7159 break; 7100 7160 7101 case 345: 7102 7103 /* Line 1806 of yacc.c */ 7104 #line 1402 "parser.yy" 7105 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addType( (yyvsp[(2) - (2)].decl) ); } 7106 break; 7107 7108 case 346: 7109 7110 /* Line 1806 of yacc.c */ 7111 #line 1407 "parser.yy" 7112 { (yyval.decl) = (yyvsp[(3) - (4)].decl); } 7113 break; 7114 7115 case 347: 7116 7117 /* Line 1806 of yacc.c */ 7118 #line 1409 "parser.yy" 7119 { (yyval.decl) = DeclarationNode::newTypeof( (yyvsp[(3) - (4)].en) ); } 7120 break; 7121 7122 case 348: 7123 7124 /* Line 1806 of yacc.c */ 7125 #line 1411 "parser.yy" 7126 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].decl) ); } 7127 break; 7128 7129 case 349: 7130 7131 /* Line 1806 of yacc.c */ 7132 #line 1413 "parser.yy" 7133 { (yyval.decl) = DeclarationNode::newAttr( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); } 7134 break; 7135 7136 case 351: 7137 7138 /* Line 1806 of yacc.c */ 7139 #line 1419 "parser.yy" 7161 case 358: 7162 7163 /* Line 1806 of yacc.c */ 7164 #line 1431 "parser.yy" 7140 7165 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7141 7166 break; 7142 7167 7143 case 35 2:7144 7145 /* Line 1806 of yacc.c */ 7146 #line 14 21"parser.yy"7168 case 359: 7169 7170 /* Line 1806 of yacc.c */ 7171 #line 1433 "parser.yy" 7147 7172 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7148 7173 break; 7149 7174 7150 case 3 53:7151 7152 /* Line 1806 of yacc.c */ 7153 #line 14 23"parser.yy"7175 case 360: 7176 7177 /* Line 1806 of yacc.c */ 7178 #line 1435 "parser.yy" 7154 7179 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 7155 7180 break; 7156 7181 7157 case 355: 7158 7159 /* Line 1806 of yacc.c */ 7160 #line 1429 "parser.yy" 7161 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7162 break; 7163 7164 case 356: 7165 7166 /* Line 1806 of yacc.c */ 7167 #line 1431 "parser.yy" 7182 case 361: 7183 7184 /* Line 1806 of yacc.c */ 7185 #line 1440 "parser.yy" 7186 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); } 7187 break; 7188 7189 case 362: 7190 7191 /* Line 1806 of yacc.c */ 7192 #line 1442 "parser.yy" 7193 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7194 break; 7195 7196 case 363: 7197 7198 /* Line 1806 of yacc.c */ 7199 #line 1444 "parser.yy" 7168 7200 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7169 7201 break; 7170 7202 7171 case 358:7172 7173 /* Line 1806 of yacc.c */7174 #line 1437 "parser.yy"7175 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }7176 break;7177 7178 case 359:7179 7180 /* Line 1806 of yacc.c */7181 #line 1439 "parser.yy"7182 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }7183 break;7184 7185 case 360:7186 7187 /* Line 1806 of yacc.c */7188 #line 1441 "parser.yy"7189 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }7190 break;7191 7192 case 361:7193 7194 /* Line 1806 of yacc.c */7195 #line 1446 "parser.yy"7196 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(1) - (1)].tok) ); }7197 break;7198 7199 case 362:7200 7201 /* Line 1806 of yacc.c */7202 #line 1448 "parser.yy"7203 { (yyval.decl) = DeclarationNode::newFromTypedef( (yyvsp[(2) - (2)].tok) )->addQualifiers( (yyvsp[(1) - (2)].decl) ); }7204 break;7205 7206 case 363:7207 7208 /* Line 1806 of yacc.c */7209 #line 1450 "parser.yy"7210 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }7211 break;7212 7213 7203 case 366: 7214 7204 7215 7205 /* Line 1806 of yacc.c */ 7216 #line 14 60"parser.yy"7206 #line 1454 "parser.yy" 7217 7207 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (4)].aggKey), 0, 0, (yyvsp[(3) - (4)].decl), true ); } 7218 7208 break; … … 7221 7211 7222 7212 /* Line 1806 of yacc.c */ 7223 #line 14 62"parser.yy"7213 #line 1456 "parser.yy" 7224 7214 { 7225 7215 typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); … … 7231 7221 7232 7222 /* Line 1806 of yacc.c */ 7223 #line 1461 "parser.yy" 7224 { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); } 7225 break; 7226 7227 case 369: 7228 7229 /* Line 1806 of yacc.c */ 7230 #line 1463 "parser.yy" 7231 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), 0, (yyvsp[(5) - (6)].decl), true ); } 7232 break; 7233 7234 case 370: 7235 7236 /* Line 1806 of yacc.c */ 7237 #line 1465 "parser.yy" 7238 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), 0, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); } 7239 break; 7240 7241 case 371: 7242 7243 /* Line 1806 of yacc.c */ 7233 7244 #line 1467 "parser.yy" 7234 { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); }7235 break;7236 7237 case 369:7238 7239 /* Line 1806 of yacc.c */7240 #line 1469 "parser.yy"7241 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (6)].aggKey), (yyvsp[(2) - (6)].tok), 0, (yyvsp[(5) - (6)].decl), true ); }7242 break;7243 7244 case 370:7245 7246 /* Line 1806 of yacc.c */7247 #line 1471 "parser.yy"7248 { (yyval.decl) = DeclarationNode::newAggregate( (yyvsp[(1) - (7)].aggKey), 0, (yyvsp[(3) - (7)].en), (yyvsp[(6) - (7)].decl), false ); }7249 break;7250 7251 case 371:7252 7253 /* Line 1806 of yacc.c */7254 #line 1473 "parser.yy"7255 7245 { (yyval.decl) = (yyvsp[(2) - (2)].decl); } 7256 7246 break; … … 7259 7249 7260 7250 /* Line 1806 of yacc.c */ 7261 #line 147 8"parser.yy"7251 #line 1472 "parser.yy" 7262 7252 { (yyval.aggKey) = DeclarationNode::Struct; } 7263 7253 break; … … 7266 7256 7267 7257 /* Line 1806 of yacc.c */ 7268 #line 14 80"parser.yy"7258 #line 1474 "parser.yy" 7269 7259 { (yyval.aggKey) = DeclarationNode::Union; } 7270 7260 break; … … 7273 7263 7274 7264 /* Line 1806 of yacc.c */ 7275 #line 14 85"parser.yy"7265 #line 1479 "parser.yy" 7276 7266 { (yyval.decl) = 0; } 7277 7267 break; … … 7280 7270 7281 7271 /* Line 1806 of yacc.c */ 7272 #line 1481 "parser.yy" 7273 { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); } 7274 break; 7275 7276 case 377: 7277 7278 /* Line 1806 of yacc.c */ 7282 7279 #line 1487 "parser.yy" 7283 { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); }7284 break;7285 7286 case 377:7287 7288 /* Line 1806 of yacc.c */7289 #line 1493 "parser.yy"7290 7280 { (yyval.decl) = (yyvsp[(2) - (3)].decl)->set_extension( true ); } 7291 7281 break; … … 7294 7284 7295 7285 /* Line 1806 of yacc.c */ 7296 #line 149 6"parser.yy"7286 #line 1490 "parser.yy" 7297 7287 { // mark all fields in list 7298 7288 for ( DeclarationNode *iter = (yyvsp[(2) - (3)].decl); iter != NULL; iter = (DeclarationNode *)iter->get_link() ) … … 7305 7295 7306 7296 /* Line 1806 of yacc.c */ 7307 #line 150 6"parser.yy"7297 #line 1500 "parser.yy" 7308 7298 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addName( (yyvsp[(2) - (2)].tok) ); } 7309 7299 break; … … 7312 7302 7313 7303 /* Line 1806 of yacc.c */ 7314 #line 150 8"parser.yy"7304 #line 1502 "parser.yy" 7315 7305 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(1) - (3)].decl)->cloneType( (yyvsp[(3) - (3)].tok) ) ); } 7316 7306 break; … … 7319 7309 7320 7310 /* Line 1806 of yacc.c */ 7321 #line 15 10"parser.yy"7311 #line 1504 "parser.yy" 7322 7312 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(1) - (2)].decl)->cloneType( 0 ) ); } 7323 7313 break; … … 7326 7316 7327 7317 /* Line 1806 of yacc.c */ 7328 #line 15 15"parser.yy"7318 #line 1509 "parser.yy" 7329 7319 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7330 7320 break; … … 7333 7323 7334 7324 /* Line 1806 of yacc.c */ 7335 #line 151 7"parser.yy"7325 #line 1511 "parser.yy" 7336 7326 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(1) - (4)].decl)->cloneBaseType( (yyvsp[(4) - (4)].decl) ) ); } 7337 7327 break; … … 7340 7330 7341 7331 /* Line 1806 of yacc.c */ 7342 #line 15 22"parser.yy"7332 #line 1516 "parser.yy" 7343 7333 { (yyval.decl) = DeclarationNode::newName( 0 ); /* XXX */ } 7344 7334 break; … … 7347 7337 7348 7338 /* Line 1806 of yacc.c */ 7339 #line 1518 "parser.yy" 7340 { (yyval.decl) = DeclarationNode::newBitfield( (yyvsp[(1) - (1)].en) ); } 7341 break; 7342 7343 case 388: 7344 7345 /* Line 1806 of yacc.c */ 7346 #line 1521 "parser.yy" 7347 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); } 7348 break; 7349 7350 case 389: 7351 7352 /* Line 1806 of yacc.c */ 7349 7353 #line 1524 "parser.yy" 7350 { (yyval.decl) = DeclarationNode::newBitfield( (yyvsp[(1) - (1)].en) ); }7351 break;7352 7353 case 388:7354 7355 /* Line 1806 of yacc.c */7356 #line 1527 "parser.yy"7357 7354 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); } 7358 7355 break; 7359 7356 7360 case 3 89:7357 case 391: 7361 7358 7362 7359 /* Line 1806 of yacc.c */ 7363 7360 #line 1530 "parser.yy" 7364 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addBitfield( (yyvsp[(2) - (2)].en) ); }7365 break;7366 7367 case 391:7368 7369 /* Line 1806 of yacc.c */7370 #line 1536 "parser.yy"7371 7361 { (yyval.en) = 0; } 7372 7362 break; … … 7375 7365 7376 7366 /* Line 1806 of yacc.c */ 7377 #line 153 8"parser.yy"7367 #line 1532 "parser.yy" 7378 7368 { (yyval.en) = (yyvsp[(1) - (1)].en); } 7379 7369 break; … … 7382 7372 7383 7373 /* Line 1806 of yacc.c */ 7384 #line 15 43"parser.yy"7374 #line 1537 "parser.yy" 7385 7375 { (yyval.en) = (yyvsp[(2) - (2)].en); } 7386 7376 break; … … 7389 7379 7390 7380 /* Line 1806 of yacc.c */ 7391 #line 15 52"parser.yy"7381 #line 1546 "parser.yy" 7392 7382 { (yyval.decl) = DeclarationNode::newEnum( 0, (yyvsp[(3) - (5)].decl) ); } 7393 7383 break; … … 7396 7386 7397 7387 /* Line 1806 of yacc.c */ 7398 #line 15 54"parser.yy"7388 #line 1548 "parser.yy" 7399 7389 { 7400 7390 typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); … … 7406 7396 7407 7397 /* Line 1806 of yacc.c */ 7408 #line 155 9"parser.yy"7398 #line 1553 "parser.yy" 7409 7399 { typedefTable.makeTypedef( *(yyvsp[(2) - (2)].tok) ); } 7410 7400 break; … … 7413 7403 7414 7404 /* Line 1806 of yacc.c */ 7415 #line 15 61"parser.yy"7405 #line 1555 "parser.yy" 7416 7406 { (yyval.decl) = DeclarationNode::newEnum( (yyvsp[(2) - (7)].tok), (yyvsp[(5) - (7)].decl) ); } 7417 7407 break; … … 7420 7410 7421 7411 /* Line 1806 of yacc.c */ 7422 #line 156 6"parser.yy"7412 #line 1560 "parser.yy" 7423 7413 { (yyval.decl) = DeclarationNode::newEnumConstant( (yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].en) ); } 7424 7414 break; … … 7427 7417 7428 7418 /* Line 1806 of yacc.c */ 7429 #line 156 8"parser.yy"7419 #line 1562 "parser.yy" 7430 7420 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( DeclarationNode::newEnumConstant( (yyvsp[(3) - (4)].tok), (yyvsp[(4) - (4)].en) ) ); } 7431 7421 break; … … 7434 7424 7435 7425 /* Line 1806 of yacc.c */ 7436 #line 15 73"parser.yy"7426 #line 1567 "parser.yy" 7437 7427 { (yyval.en) = 0; } 7438 7428 break; … … 7441 7431 7442 7432 /* Line 1806 of yacc.c */ 7443 #line 15 75"parser.yy"7433 #line 1569 "parser.yy" 7444 7434 { (yyval.en) = (yyvsp[(2) - (2)].en); } 7445 7435 break; … … 7448 7438 7449 7439 /* Line 1806 of yacc.c */ 7450 #line 15 82"parser.yy"7440 #line 1576 "parser.yy" 7451 7441 { (yyval.decl) = 0; } 7452 7442 break; … … 7455 7445 7456 7446 /* Line 1806 of yacc.c */ 7457 #line 15 90"parser.yy"7447 #line 1584 "parser.yy" 7458 7448 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7459 7449 break; … … 7462 7452 7463 7453 /* Line 1806 of yacc.c */ 7464 #line 15 92"parser.yy"7454 #line 1586 "parser.yy" 7465 7455 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); } 7466 7456 break; … … 7469 7459 7470 7460 /* Line 1806 of yacc.c */ 7471 #line 15 94"parser.yy"7461 #line 1588 "parser.yy" 7472 7462 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); } 7473 7463 break; … … 7476 7466 7477 7467 /* Line 1806 of yacc.c */ 7478 #line 1 602"parser.yy"7468 #line 1596 "parser.yy" 7479 7469 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7480 7470 break; … … 7483 7473 7484 7474 /* Line 1806 of yacc.c */ 7485 #line 1 604"parser.yy"7475 #line 1598 "parser.yy" 7486 7476 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7487 7477 break; … … 7490 7480 7491 7481 /* Line 1806 of yacc.c */ 7482 #line 1600 "parser.yy" 7483 { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); } 7484 break; 7485 7486 case 415: 7487 7488 /* Line 1806 of yacc.c */ 7492 7489 #line 1606 "parser.yy" 7493 { (yyval.decl) = (yyvsp[(1) - (9)].decl)->appendList( (yyvsp[(5) - (9)].decl) )->appendList( (yyvsp[(9) - (9)].decl) ); }7494 break;7495 7496 case 415:7497 7498 /* Line 1806 of yacc.c */7499 #line 1612 "parser.yy"7500 7490 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7501 7491 break; … … 7504 7494 7505 7495 /* Line 1806 of yacc.c */ 7506 #line 161 7"parser.yy"7496 #line 1611 "parser.yy" 7507 7497 { (yyval.decl) = 0; } 7508 7498 break; … … 7511 7501 7512 7502 /* Line 1806 of yacc.c */ 7513 #line 16 24"parser.yy"7503 #line 1618 "parser.yy" 7514 7504 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->addVarArgs(); } 7515 7505 break; … … 7518 7508 7519 7509 /* Line 1806 of yacc.c */ 7520 #line 16 31"parser.yy"7510 #line 1625 "parser.yy" 7521 7511 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7522 7512 break; … … 7525 7515 7526 7516 /* Line 1806 of yacc.c */ 7527 #line 16 33"parser.yy"7517 #line 1627 "parser.yy" 7528 7518 { (yyval.decl) = (yyvsp[(1) - (5)].decl)->appendList( (yyvsp[(5) - (5)].decl) ); } 7529 7519 break; … … 7532 7522 7533 7523 /* Line 1806 of yacc.c */ 7534 #line 16 42"parser.yy"7524 #line 1636 "parser.yy" 7535 7525 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); } 7536 7526 break; … … 7539 7529 7540 7530 /* Line 1806 of yacc.c */ 7541 #line 16 45"parser.yy"7531 #line 1639 "parser.yy" 7542 7532 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addName( (yyvsp[(2) - (3)].tok) ); } 7543 7533 break; … … 7546 7536 7547 7537 /* Line 1806 of yacc.c */ 7548 #line 164 7"parser.yy"7538 #line 1641 "parser.yy" 7549 7539 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addName( (yyvsp[(3) - (4)].tok) )->addQualifiers( (yyvsp[(1) - (4)].decl) ); } 7550 7540 break; … … 7553 7543 7554 7544 /* Line 1806 of yacc.c */ 7545 #line 1651 "parser.yy" 7546 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7547 break; 7548 7549 case 434: 7550 7551 /* Line 1806 of yacc.c */ 7555 7552 #line 1657 "parser.yy" 7556 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }7557 break;7558 7559 case 434:7560 7561 /* Line 1806 of yacc.c */7562 #line 1663 "parser.yy"7563 7553 { 7564 7554 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7570 7560 7571 7561 /* Line 1806 of yacc.c */ 7572 #line 166 8"parser.yy"7562 #line 1662 "parser.yy" 7573 7563 { 7574 7564 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 7580 7570 7581 7571 /* Line 1806 of yacc.c */ 7582 #line 167 7"parser.yy"7572 #line 1671 "parser.yy" 7583 7573 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7584 7574 break; … … 7587 7577 7588 7578 /* Line 1806 of yacc.c */ 7589 #line 168 6"parser.yy"7579 #line 1680 "parser.yy" 7590 7580 { (yyval.decl) = DeclarationNode::newName( (yyvsp[(1) - (1)].tok) ); } 7591 7581 break; … … 7594 7584 7595 7585 /* Line 1806 of yacc.c */ 7596 #line 168 8"parser.yy"7586 #line 1682 "parser.yy" 7597 7587 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( DeclarationNode::newName( (yyvsp[(3) - (3)].tok) ) ); } 7598 7588 break; … … 7601 7591 7602 7592 /* Line 1806 of yacc.c */ 7603 #line 17 13"parser.yy"7593 #line 1707 "parser.yy" 7604 7594 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7605 7595 break; … … 7608 7598 7609 7599 /* Line 1806 of yacc.c */ 7610 #line 17 21"parser.yy"7600 #line 1715 "parser.yy" 7611 7601 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addType( (yyvsp[(1) - (2)].decl) ); } 7612 7602 break; … … 7615 7605 7616 7606 /* Line 1806 of yacc.c */ 7617 #line 172 6"parser.yy"7607 #line 1720 "parser.yy" 7618 7608 { (yyval.in) = 0; } 7619 7609 break; … … 7622 7612 7623 7613 /* Line 1806 of yacc.c */ 7614 #line 1722 "parser.yy" 7615 { (yyval.in) = (yyvsp[(2) - (2)].in); } 7616 break; 7617 7618 case 458: 7619 7620 /* Line 1806 of yacc.c */ 7621 #line 1724 "parser.yy" 7622 { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); } 7623 break; 7624 7625 case 459: 7626 7627 /* Line 1806 of yacc.c */ 7624 7628 #line 1728 "parser.yy" 7625 { (yyval.in) = (yyvsp[(2) - (2)].in); }7626 break; 7627 7628 case 4 58:7629 7630 /* Line 1806 of yacc.c */ 7631 #line 17 30"parser.yy"7632 { (yyval.in) = (yyvsp[(2) - (2)].in)->set_maybeConstructed( false ); }7633 break; 7634 7635 case 4 59:7629 { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); } 7630 break; 7631 7632 case 460: 7633 7634 /* Line 1806 of yacc.c */ 7635 #line 1729 "parser.yy" 7636 { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); } 7637 break; 7638 7639 case 461: 7636 7640 7637 7641 /* Line 1806 of yacc.c */ 7638 7642 #line 1734 "parser.yy" 7639 { (yyval.in) = new InitializerNode( (yyvsp[(1) - (1)].en) ); }7640 break;7641 7642 case 460:7643 7644 /* Line 1806 of yacc.c */7645 #line 1735 "parser.yy"7646 { (yyval.in) = new InitializerNode( (yyvsp[(2) - (4)].in), true ); }7647 break;7648 7649 case 461:7650 7651 /* Line 1806 of yacc.c */7652 #line 1740 "parser.yy"7653 7643 { (yyval.in) = 0; } 7654 7644 break; … … 7657 7647 7658 7648 /* Line 1806 of yacc.c */ 7659 #line 17 42"parser.yy"7649 #line 1736 "parser.yy" 7660 7650 { (yyval.in) = (yyvsp[(2) - (2)].in)->set_designators( (yyvsp[(1) - (2)].en) ); } 7661 7651 break; … … 7664 7654 7665 7655 /* Line 1806 of yacc.c */ 7666 #line 17 43"parser.yy"7656 #line 1737 "parser.yy" 7667 7657 { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (3)].in)->set_link( (yyvsp[(3) - (3)].in) ) ); } 7668 7658 break; … … 7671 7661 7672 7662 /* Line 1806 of yacc.c */ 7673 #line 17 45"parser.yy"7663 #line 1739 "parser.yy" 7674 7664 { (yyval.in) = (InitializerNode *)( (yyvsp[(1) - (4)].in)->set_link( (yyvsp[(4) - (4)].in)->set_designators( (yyvsp[(3) - (4)].en) ) ) ); } 7675 7665 break; … … 7678 7668 7679 7669 /* Line 1806 of yacc.c */ 7670 #line 1755 "parser.yy" 7671 { (yyval.en) = new VarRefNode( (yyvsp[(1) - (2)].tok) ); } 7672 break; 7673 7674 case 469: 7675 7676 /* Line 1806 of yacc.c */ 7680 7677 #line 1761 "parser.yy" 7681 { (yyval.en) = new VarRefNode( (yyvsp[(1) - (2)].tok) ); }7682 break;7683 7684 case 469:7685 7686 /* Line 1806 of yacc.c */7687 #line 1767 "parser.yy"7688 7678 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (2)].en)->set_link( (yyvsp[(2) - (2)].en) )); } 7689 7679 break; … … 7692 7682 7693 7683 /* Line 1806 of yacc.c */ 7694 #line 17 75"parser.yy"7684 #line 1769 "parser.yy" 7695 7685 { (yyval.en) = new DesignatorNode( new VarRefNode( (yyvsp[(1) - (1)].tok) ) ); } 7696 7686 break; … … 7699 7689 7700 7690 /* Line 1806 of yacc.c */ 7701 #line 177 7"parser.yy"7691 #line 1771 "parser.yy" 7702 7692 { (yyval.en) = new DesignatorNode( new VarRefNode( (yyvsp[(2) - (2)].tok) ) ); } 7703 7693 break; … … 7706 7696 7707 7697 /* Line 1806 of yacc.c */ 7698 #line 1774 "parser.yy" 7699 { (yyval.en) = new DesignatorNode( (yyvsp[(3) - (5)].en), true ); } 7700 break; 7701 7702 case 473: 7703 7704 /* Line 1806 of yacc.c */ 7705 #line 1776 "parser.yy" 7706 { (yyval.en) = new DesignatorNode( (yyvsp[(3) - (5)].en), true ); } 7707 break; 7708 7709 case 474: 7710 7711 /* Line 1806 of yacc.c */ 7712 #line 1778 "parser.yy" 7713 { (yyval.en) = new DesignatorNode( new CompositeExprNode( new OperatorNode( OperatorNode::Range ), (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ), true ); } 7714 break; 7715 7716 case 475: 7717 7718 /* Line 1806 of yacc.c */ 7708 7719 #line 1780 "parser.yy" 7709 { (yyval.en) = new DesignatorNode( (yyvsp[(3) - (5)].en), true ); }7710 break;7711 7712 case 473:7713 7714 /* Line 1806 of yacc.c */7715 #line 1782 "parser.yy"7716 { (yyval.en) = new DesignatorNode( (yyvsp[(3) - (5)].en), true ); }7717 break;7718 7719 case 474:7720 7721 /* Line 1806 of yacc.c */7722 #line 1784 "parser.yy"7723 { (yyval.en) = new DesignatorNode( new CompositeExprNode2( build_opr2( OperatorNode::Range, (yyvsp[(3) - (7)].en), (yyvsp[(5) - (7)].en) ) ), true ); }7724 break;7725 7726 case 475:7727 7728 /* Line 1806 of yacc.c */7729 #line 1786 "parser.yy"7730 7720 { (yyval.en) = new DesignatorNode( (yyvsp[(4) - (6)].en) ); } 7731 7721 break; … … 7734 7724 7735 7725 /* Line 1806 of yacc.c */ 7736 #line 18 10"parser.yy"7726 #line 1804 "parser.yy" 7737 7727 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7738 7728 break; … … 7741 7731 7742 7732 /* Line 1806 of yacc.c */ 7743 #line 18 12"parser.yy"7733 #line 1806 "parser.yy" 7744 7734 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7745 7735 break; … … 7748 7738 7749 7739 /* Line 1806 of yacc.c */ 7740 #line 1808 "parser.yy" 7741 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); } 7742 break; 7743 7744 case 481: 7745 7746 /* Line 1806 of yacc.c */ 7750 7747 #line 1814 "parser.yy" 7751 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->addQualifiers( (yyvsp[(2) - (3)].decl) )->addQualifiers( (yyvsp[(3) - (3)].decl) ); }7752 break;7753 7754 case 481:7755 7756 /* Line 1806 of yacc.c */7757 #line 1820 "parser.yy"7758 7748 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 7759 7749 break; … … 7762 7752 7763 7753 /* Line 1806 of yacc.c */ 7764 #line 18 22"parser.yy"7754 #line 1816 "parser.yy" 7765 7755 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 7766 7756 break; … … 7769 7759 7770 7760 /* Line 1806 of yacc.c */ 7761 #line 1821 "parser.yy" 7762 { (yyval.decl) = DeclarationNode::newFromTypeGen( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); } 7763 break; 7764 7765 case 485: 7766 7767 /* Line 1806 of yacc.c */ 7771 7768 #line 1827 "parser.yy" 7772 { (yyval.decl) = DeclarationNode::newFromTypeGen( (yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].en) ); }7773 break;7774 7775 case 485:7776 7777 /* Line 1806 of yacc.c */7778 #line 1833 "parser.yy"7779 7769 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->appendList( (yyvsp[(3) - (4)].decl) ); } 7780 7770 break; … … 7783 7773 7784 7774 /* Line 1806 of yacc.c */ 7785 #line 183 8"parser.yy"7775 #line 1832 "parser.yy" 7786 7776 { typedefTable.addToEnclosingScope( *(yyvsp[(2) - (2)].tok), TypedefTable::TD ); } 7787 7777 break; … … 7790 7780 7791 7781 /* Line 1806 of yacc.c */ 7782 #line 1834 "parser.yy" 7783 { (yyval.decl) = DeclarationNode::newTypeParam( (yyvsp[(1) - (4)].tclass), (yyvsp[(2) - (4)].tok) )->addAssertions( (yyvsp[(4) - (4)].decl) ); } 7784 break; 7785 7786 case 489: 7787 7788 /* Line 1806 of yacc.c */ 7792 7789 #line 1840 "parser.yy" 7793 { (yyval.decl) = DeclarationNode::newTypeParam( (yyvsp[(1) - (4)].tclass), (yyvsp[(2) - (4)].tok) )->addAssertions( (yyvsp[(4) - (4)].decl) ); }7794 break;7795 7796 case 489:7797 7798 /* Line 1806 of yacc.c */7799 #line 1846 "parser.yy"7800 7790 { (yyval.tclass) = DeclarationNode::Type; } 7801 7791 break; … … 7804 7794 7805 7795 /* Line 1806 of yacc.c */ 7806 #line 184 8"parser.yy"7796 #line 1842 "parser.yy" 7807 7797 { (yyval.tclass) = DeclarationNode::Ftype; } 7808 7798 break; … … 7811 7801 7812 7802 /* Line 1806 of yacc.c */ 7813 #line 18 50"parser.yy"7803 #line 1844 "parser.yy" 7814 7804 { (yyval.tclass) = DeclarationNode::Dtype; } 7815 7805 break; … … 7818 7808 7819 7809 /* Line 1806 of yacc.c */ 7820 #line 18 55"parser.yy"7810 #line 1849 "parser.yy" 7821 7811 { (yyval.decl) = 0; } 7822 7812 break; … … 7825 7815 7826 7816 /* Line 1806 of yacc.c */ 7827 #line 185 7"parser.yy"7817 #line 1851 "parser.yy" 7828 7818 { (yyval.decl) = (yyvsp[(1) - (2)].decl) != 0 ? (yyvsp[(1) - (2)].decl)->appendList( (yyvsp[(2) - (2)].decl) ) : (yyvsp[(2) - (2)].decl); } 7829 7819 break; … … 7832 7822 7833 7823 /* Line 1806 of yacc.c */ 7834 #line 18 62"parser.yy"7824 #line 1856 "parser.yy" 7835 7825 { 7836 7826 typedefTable.openTrait( *(yyvsp[(2) - (5)].tok) ); … … 7842 7832 7843 7833 /* Line 1806 of yacc.c */ 7844 #line 186 7"parser.yy"7834 #line 1861 "parser.yy" 7845 7835 { (yyval.decl) = (yyvsp[(4) - (5)].decl); } 7846 7836 break; … … 7849 7839 7850 7840 /* Line 1806 of yacc.c */ 7851 #line 186 9"parser.yy"7841 #line 1863 "parser.yy" 7852 7842 { (yyval.decl) = 0; } 7853 7843 break; … … 7856 7846 7857 7847 /* Line 1806 of yacc.c */ 7858 #line 18 74"parser.yy"7848 #line 1868 "parser.yy" 7859 7849 { (yyval.en) = new TypeValueNode( (yyvsp[(1) - (1)].decl) ); } 7860 7850 break; … … 7863 7853 7864 7854 /* Line 1806 of yacc.c */ 7865 #line 187 7"parser.yy"7855 #line 1871 "parser.yy" 7866 7856 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_link( new TypeValueNode( (yyvsp[(3) - (3)].decl) ))); } 7867 7857 break; … … 7870 7860 7871 7861 /* Line 1806 of yacc.c */ 7872 #line 187 9"parser.yy"7862 #line 1873 "parser.yy" 7873 7863 { (yyval.en) = (ExpressionNode *)( (yyvsp[(1) - (3)].en)->set_link( (yyvsp[(3) - (3)].en) )); } 7874 7864 break; … … 7877 7867 7878 7868 /* Line 1806 of yacc.c */ 7879 #line 18 84"parser.yy"7869 #line 1878 "parser.yy" 7880 7870 { (yyval.decl) = (yyvsp[(2) - (2)].decl); } 7881 7871 break; … … 7884 7874 7885 7875 /* Line 1806 of yacc.c */ 7886 #line 188 6"parser.yy"7876 #line 1880 "parser.yy" 7887 7877 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addQualifiers( (yyvsp[(1) - (3)].decl) ); } 7888 7878 break; … … 7891 7881 7892 7882 /* Line 1806 of yacc.c */ 7893 #line 188 8"parser.yy"7883 #line 1882 "parser.yy" 7894 7884 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl)->copyStorageClasses( (yyvsp[(1) - (3)].decl) ) ); } 7895 7885 break; … … 7898 7888 7899 7889 /* Line 1806 of yacc.c */ 7900 #line 18 93"parser.yy"7890 #line 1887 "parser.yy" 7901 7891 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addAssertions( (yyvsp[(2) - (2)].decl) ); } 7902 7892 break; … … 7905 7895 7906 7896 /* Line 1806 of yacc.c */ 7907 #line 18 95"parser.yy"7897 #line 1889 "parser.yy" 7908 7898 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addAssertions( (yyvsp[(2) - (4)].decl) )->addType( (yyvsp[(4) - (4)].decl) ); } 7909 7899 break; … … 7912 7902 7913 7903 /* Line 1806 of yacc.c */ 7914 #line 1 900"parser.yy"7904 #line 1894 "parser.yy" 7915 7905 { 7916 7906 typedefTable.addToEnclosingScope( *(yyvsp[(1) - (1)].tok), TypedefTable::TD ); … … 7922 7912 7923 7913 /* Line 1806 of yacc.c */ 7924 #line 1 905"parser.yy"7914 #line 1899 "parser.yy" 7925 7915 { 7926 7916 typedefTable.addToEnclosingScope( *(yyvsp[(1) - (6)].tok), TypedefTable::TG ); … … 7932 7922 7933 7923 /* Line 1806 of yacc.c */ 7934 #line 19 13"parser.yy"7924 #line 1907 "parser.yy" 7935 7925 { 7936 7926 typedefTable.addToEnclosingScope( *(yyvsp[(2) - (9)].tok), TypedefTable::ID ); … … 7942 7932 7943 7933 /* Line 1806 of yacc.c */ 7944 #line 191 8"parser.yy"7934 #line 1912 "parser.yy" 7945 7935 { 7946 7936 typedefTable.enterTrait( *(yyvsp[(2) - (8)].tok) ); … … 7952 7942 7953 7943 /* Line 1806 of yacc.c */ 7954 #line 19 23"parser.yy"7944 #line 1917 "parser.yy" 7955 7945 { 7956 7946 typedefTable.leaveTrait(); … … 7963 7953 7964 7954 /* Line 1806 of yacc.c */ 7965 #line 19 33"parser.yy"7955 #line 1927 "parser.yy" 7966 7956 { (yyval.decl) = (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ); } 7967 7957 break; … … 7970 7960 7971 7961 /* Line 1806 of yacc.c */ 7972 #line 19 43"parser.yy"7962 #line 1937 "parser.yy" 7973 7963 { 7974 7964 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7980 7970 7981 7971 /* Line 1806 of yacc.c */ 7982 #line 194 8"parser.yy"7972 #line 1942 "parser.yy" 7983 7973 { 7984 7974 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 7990 7980 7991 7981 /* Line 1806 of yacc.c */ 7992 #line 19 53"parser.yy"7982 #line 1947 "parser.yy" 7993 7983 { 7994 7984 typedefTable.addToEnclosingScope2( *(yyvsp[(5) - (5)].tok), TypedefTable::ID ); … … 8000 7990 8001 7991 /* Line 1806 of yacc.c */ 8002 #line 19 61"parser.yy"7992 #line 1955 "parser.yy" 8003 7993 { 8004 7994 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 8010 8000 8011 8001 /* Line 1806 of yacc.c */ 8012 #line 196 6"parser.yy"8002 #line 1960 "parser.yy" 8013 8003 { 8014 8004 typedefTable.addToEnclosingScope2( TypedefTable::ID ); … … 8020 8010 8021 8011 /* Line 1806 of yacc.c */ 8022 #line 197 6"parser.yy"8012 #line 1970 "parser.yy" 8023 8013 {} 8024 8014 break; … … 8027 8017 8028 8018 /* Line 1806 of yacc.c */ 8029 #line 197 8"parser.yy"8019 #line 1972 "parser.yy" 8030 8020 { 8031 8021 if ( theTree ) { … … 8040 8030 8041 8031 /* Line 1806 of yacc.c */ 8042 #line 19 90"parser.yy"8032 #line 1984 "parser.yy" 8043 8033 { (yyval.decl) = ( (yyvsp[(1) - (3)].decl) != NULL ) ? (yyvsp[(1) - (3)].decl)->appendList( (yyvsp[(3) - (3)].decl) ) : (yyvsp[(3) - (3)].decl); } 8044 8034 break; … … 8047 8037 8048 8038 /* Line 1806 of yacc.c */ 8049 #line 19 95"parser.yy"8039 #line 1989 "parser.yy" 8050 8040 { (yyval.decl) = 0; } 8051 8041 break; … … 8054 8044 8055 8045 /* Line 1806 of yacc.c */ 8056 #line 2003"parser.yy"8046 #line 1997 "parser.yy" 8057 8047 {} 8058 8048 break; … … 8061 8051 8062 8052 /* Line 1806 of yacc.c */ 8063 #line 2005"parser.yy"8053 #line 1999 "parser.yy" 8064 8054 { 8065 8055 linkageStack.push( linkage ); … … 8071 8061 8072 8062 /* Line 1806 of yacc.c */ 8073 #line 20 10"parser.yy"8063 #line 2004 "parser.yy" 8074 8064 { 8075 8065 linkage = linkageStack.top(); … … 8082 8072 8083 8073 /* Line 1806 of yacc.c */ 8084 #line 201 6"parser.yy"8074 #line 2010 "parser.yy" 8085 8075 { // mark all fields in list 8086 8076 for ( DeclarationNode *iter = (yyvsp[(2) - (2)].decl); iter != NULL; iter = (DeclarationNode *)iter->get_link() ) … … 8093 8083 8094 8084 /* Line 1806 of yacc.c */ 8095 #line 20 31"parser.yy"8085 #line 2025 "parser.yy" 8096 8086 { 8097 8087 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 8104 8094 8105 8095 /* Line 1806 of yacc.c */ 8106 #line 203 7"parser.yy"8096 #line 2031 "parser.yy" 8107 8097 { 8108 8098 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 8115 8105 8116 8106 /* Line 1806 of yacc.c */ 8117 #line 204 6"parser.yy"8107 #line 2040 "parser.yy" 8118 8108 { 8119 8109 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 8126 8116 8127 8117 /* Line 1806 of yacc.c */ 8128 #line 20 52"parser.yy"8118 #line 2046 "parser.yy" 8129 8119 { 8130 8120 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 8135 8125 8136 8126 case 537: 8127 8128 /* Line 1806 of yacc.c */ 8129 #line 2052 "parser.yy" 8130 { 8131 typedefTable.addToEnclosingScope( TypedefTable::ID ); 8132 typedefTable.leaveScope(); 8133 (yyval.decl) = (yyvsp[(2) - (3)].decl)->addFunctionBody( (yyvsp[(3) - (3)].sn) )->addQualifiers( (yyvsp[(1) - (3)].decl) ); 8134 } 8135 break; 8136 8137 case 538: 8137 8138 8138 8139 /* Line 1806 of yacc.c */ … … 8145 8146 break; 8146 8147 8147 case 53 8:8148 case 539: 8148 8149 8149 8150 /* Line 1806 of yacc.c */ 8150 8151 #line 2064 "parser.yy" 8151 {8152 typedefTable.addToEnclosingScope( TypedefTable::ID );8153 typedefTable.leaveScope();8154 (yyval.decl) = (yyvsp[(2) - (3)].decl)->addFunctionBody( (yyvsp[(3) - (3)].sn) )->addQualifiers( (yyvsp[(1) - (3)].decl) );8155 }8156 break;8157 8158 case 539:8159 8160 /* Line 1806 of yacc.c */8161 #line 2070 "parser.yy"8162 8152 { 8163 8153 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 8170 8160 8171 8161 /* Line 1806 of yacc.c */ 8172 #line 207 8"parser.yy"8162 #line 2072 "parser.yy" 8173 8163 { 8174 8164 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 8181 8171 8182 8172 /* Line 1806 of yacc.c */ 8183 #line 20 84"parser.yy"8173 #line 2078 "parser.yy" 8184 8174 { 8185 8175 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 8192 8182 8193 8183 /* Line 1806 of yacc.c */ 8194 #line 20 92"parser.yy"8184 #line 2086 "parser.yy" 8195 8185 { 8196 8186 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 8203 8193 8204 8194 /* Line 1806 of yacc.c */ 8205 #line 209 8"parser.yy"8195 #line 2092 "parser.yy" 8206 8196 { 8207 8197 typedefTable.addToEnclosingScope( TypedefTable::ID ); … … 8214 8204 8215 8205 /* Line 1806 of yacc.c */ 8216 #line 21 13"parser.yy"8217 { (yyval.en) = new CompositeExprNode 2( build_opr2( OperatorNode::Range, (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en)) ); }8206 #line 2107 "parser.yy" 8207 { (yyval.en) = new CompositeExprNode( new OperatorNode( OperatorNode::Range ), (yyvsp[(1) - (3)].en), (yyvsp[(3) - (3)].en) ); } 8218 8208 break; 8219 8209 … … 8221 8211 8222 8212 /* Line 1806 of yacc.c */ 8223 #line 21 23"parser.yy"8213 #line 2117 "parser.yy" 8224 8214 { (yyval.decl) = 0; } 8225 8215 break; … … 8228 8218 8229 8219 /* Line 1806 of yacc.c */ 8220 #line 2124 "parser.yy" 8221 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 8222 break; 8223 8224 case 554: 8225 8226 /* Line 1806 of yacc.c */ 8230 8227 #line 2130 "parser.yy" 8231 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); }8232 break;8233 8234 case 554:8235 8236 /* Line 1806 of yacc.c */8237 #line 2136 "parser.yy"8238 8228 { (yyval.decl) = 0; } 8239 8229 break; … … 8242 8232 8243 8233 /* Line 1806 of yacc.c */ 8244 #line 21 51"parser.yy"8234 #line 2145 "parser.yy" 8245 8235 {} 8246 8236 break; … … 8249 8239 8250 8240 /* Line 1806 of yacc.c */ 8251 #line 21 52"parser.yy"8241 #line 2146 "parser.yy" 8252 8242 {} 8253 8243 break; … … 8256 8246 8257 8247 /* Line 1806 of yacc.c */ 8258 #line 21 53"parser.yy"8248 #line 2147 "parser.yy" 8259 8249 {} 8260 8250 break; … … 8263 8253 8264 8254 /* Line 1806 of yacc.c */ 8265 #line 21 54"parser.yy"8255 #line 2148 "parser.yy" 8266 8256 {} 8267 8257 break; … … 8270 8260 8271 8261 /* Line 1806 of yacc.c */ 8272 #line 218 9"parser.yy"8262 #line 2183 "parser.yy" 8273 8263 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8274 8264 break; … … 8277 8267 8278 8268 /* Line 1806 of yacc.c */ 8279 #line 21 92"parser.yy"8269 #line 2186 "parser.yy" 8280 8270 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8281 8271 break; … … 8284 8274 8285 8275 /* Line 1806 of yacc.c */ 8286 #line 21 94"parser.yy"8276 #line 2188 "parser.yy" 8287 8277 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8288 8278 break; … … 8291 8281 8292 8282 /* Line 1806 of yacc.c */ 8293 #line 219 9"parser.yy"8283 #line 2193 "parser.yy" 8294 8284 { 8295 8285 typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) ); … … 8301 8291 8302 8292 /* Line 1806 of yacc.c */ 8303 #line 2 204"parser.yy"8293 #line 2198 "parser.yy" 8304 8294 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8305 8295 break; … … 8308 8298 8309 8299 /* Line 1806 of yacc.c */ 8310 #line 220 9"parser.yy"8300 #line 2203 "parser.yy" 8311 8301 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8312 8302 break; … … 8315 8305 8316 8306 /* Line 1806 of yacc.c */ 8317 #line 22 11"parser.yy"8307 #line 2205 "parser.yy" 8318 8308 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8319 8309 break; … … 8322 8312 8323 8313 /* Line 1806 of yacc.c */ 8324 #line 22 13"parser.yy"8314 #line 2207 "parser.yy" 8325 8315 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8326 8316 break; … … 8329 8319 8330 8320 /* Line 1806 of yacc.c */ 8321 #line 2212 "parser.yy" 8322 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8323 break; 8324 8325 case 574: 8326 8327 /* Line 1806 of yacc.c */ 8328 #line 2214 "parser.yy" 8329 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8330 break; 8331 8332 case 575: 8333 8334 /* Line 1806 of yacc.c */ 8335 #line 2216 "parser.yy" 8336 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8337 break; 8338 8339 case 576: 8340 8341 /* Line 1806 of yacc.c */ 8331 8342 #line 2218 "parser.yy" 8343 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8344 break; 8345 8346 case 577: 8347 8348 /* Line 1806 of yacc.c */ 8349 #line 2223 "parser.yy" 8350 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8351 break; 8352 8353 case 578: 8354 8355 /* Line 1806 of yacc.c */ 8356 #line 2225 "parser.yy" 8357 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8358 break; 8359 8360 case 579: 8361 8362 /* Line 1806 of yacc.c */ 8363 #line 2234 "parser.yy" 8364 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8365 break; 8366 8367 case 581: 8368 8369 /* Line 1806 of yacc.c */ 8370 #line 2237 "parser.yy" 8371 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8372 break; 8373 8374 case 582: 8375 8376 /* Line 1806 of yacc.c */ 8377 #line 2242 "parser.yy" 8378 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8379 break; 8380 8381 case 583: 8382 8383 /* Line 1806 of yacc.c */ 8384 #line 2244 "parser.yy" 8385 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8386 break; 8387 8388 case 584: 8389 8390 /* Line 1806 of yacc.c */ 8391 #line 2246 "parser.yy" 8392 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8393 break; 8394 8395 case 585: 8396 8397 /* Line 1806 of yacc.c */ 8398 #line 2251 "parser.yy" 8399 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8400 break; 8401 8402 case 586: 8403 8404 /* Line 1806 of yacc.c */ 8405 #line 2253 "parser.yy" 8406 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8407 break; 8408 8409 case 587: 8410 8411 /* Line 1806 of yacc.c */ 8412 #line 2255 "parser.yy" 8413 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8414 break; 8415 8416 case 588: 8417 8418 /* Line 1806 of yacc.c */ 8419 #line 2260 "parser.yy" 8420 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8421 break; 8422 8423 case 589: 8424 8425 /* Line 1806 of yacc.c */ 8426 #line 2262 "parser.yy" 8427 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8428 break; 8429 8430 case 590: 8431 8432 /* Line 1806 of yacc.c */ 8433 #line 2264 "parser.yy" 8434 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8435 break; 8436 8437 case 594: 8438 8439 /* Line 1806 of yacc.c */ 8440 #line 2279 "parser.yy" 8441 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); } 8442 break; 8443 8444 case 595: 8445 8446 /* Line 1806 of yacc.c */ 8447 #line 2281 "parser.yy" 8448 { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); } 8449 break; 8450 8451 case 596: 8452 8453 /* Line 1806 of yacc.c */ 8454 #line 2283 "parser.yy" 8455 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8456 break; 8457 8458 case 597: 8459 8460 /* Line 1806 of yacc.c */ 8461 #line 2288 "parser.yy" 8462 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8463 break; 8464 8465 case 598: 8466 8467 /* Line 1806 of yacc.c */ 8468 #line 2290 "parser.yy" 8469 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8470 break; 8471 8472 case 599: 8473 8474 /* Line 1806 of yacc.c */ 8475 #line 2292 "parser.yy" 8476 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8477 break; 8478 8479 case 600: 8480 8481 /* Line 1806 of yacc.c */ 8482 #line 2297 "parser.yy" 8483 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8484 break; 8485 8486 case 601: 8487 8488 /* Line 1806 of yacc.c */ 8489 #line 2299 "parser.yy" 8490 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8491 break; 8492 8493 case 602: 8494 8495 /* Line 1806 of yacc.c */ 8496 #line 2301 "parser.yy" 8497 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8498 break; 8499 8500 case 603: 8501 8502 /* Line 1806 of yacc.c */ 8503 #line 2316 "parser.yy" 8504 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8505 break; 8506 8507 case 605: 8508 8509 /* Line 1806 of yacc.c */ 8510 #line 2319 "parser.yy" 8511 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8512 break; 8513 8514 case 606: 8515 8516 /* Line 1806 of yacc.c */ 8517 #line 2321 "parser.yy" 8518 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8519 break; 8520 8521 case 608: 8522 8523 /* Line 1806 of yacc.c */ 8524 #line 2327 "parser.yy" 8525 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8526 break; 8527 8528 case 609: 8529 8530 /* Line 1806 of yacc.c */ 8531 #line 2332 "parser.yy" 8532 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8533 break; 8534 8535 case 610: 8536 8537 /* Line 1806 of yacc.c */ 8538 #line 2334 "parser.yy" 8539 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8540 break; 8541 8542 case 611: 8543 8544 /* Line 1806 of yacc.c */ 8545 #line 2336 "parser.yy" 8546 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8547 break; 8548 8549 case 612: 8550 8551 /* Line 1806 of yacc.c */ 8552 #line 2341 "parser.yy" 8332 8553 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8333 8554 break; 8334 8555 8335 case 574:8336 8337 /* Line 1806 of yacc.c */ 8338 #line 2 220"parser.yy"8556 case 613: 8557 8558 /* Line 1806 of yacc.c */ 8559 #line 2343 "parser.yy" 8339 8560 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8340 8561 break; 8341 8562 8342 case 575:8343 8344 /* Line 1806 of yacc.c */ 8345 #line 2 222"parser.yy"8563 case 614: 8564 8565 /* Line 1806 of yacc.c */ 8566 #line 2345 "parser.yy" 8346 8567 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8347 8568 break; 8348 8569 8349 case 576:8350 8351 /* Line 1806 of yacc.c */ 8352 #line 2 224"parser.yy"8570 case 615: 8571 8572 /* Line 1806 of yacc.c */ 8573 #line 2347 "parser.yy" 8353 8574 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8354 8575 break; 8355 8576 8356 case 577: 8357 8358 /* Line 1806 of yacc.c */ 8359 #line 2229 "parser.yy" 8577 case 616: 8578 8579 /* Line 1806 of yacc.c */ 8580 #line 2352 "parser.yy" 8581 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8582 break; 8583 8584 case 617: 8585 8586 /* Line 1806 of yacc.c */ 8587 #line 2354 "parser.yy" 8360 8588 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8361 8589 break; 8362 8590 8363 case 578:8364 8365 /* Line 1806 of yacc.c */ 8366 #line 2 231"parser.yy"8591 case 618: 8592 8593 /* Line 1806 of yacc.c */ 8594 #line 2356 "parser.yy" 8367 8595 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8368 8596 break; 8369 8597 8370 case 579:8371 8372 /* Line 1806 of yacc.c */ 8373 #line 2 240"parser.yy"8598 case 619: 8599 8600 /* Line 1806 of yacc.c */ 8601 #line 2366 "parser.yy" 8374 8602 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8375 8603 break; 8376 8604 8377 case 581:8378 8379 /* Line 1806 of yacc.c */ 8380 #line 2 243"parser.yy"8605 case 621: 8606 8607 /* Line 1806 of yacc.c */ 8608 #line 2369 "parser.yy" 8381 8609 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8382 8610 break; 8383 8611 8384 case 582: 8385 8386 /* Line 1806 of yacc.c */ 8387 #line 2248 "parser.yy" 8612 case 622: 8613 8614 /* Line 1806 of yacc.c */ 8615 #line 2371 "parser.yy" 8616 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8617 break; 8618 8619 case 623: 8620 8621 /* Line 1806 of yacc.c */ 8622 #line 2376 "parser.yy" 8623 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8624 break; 8625 8626 case 624: 8627 8628 /* Line 1806 of yacc.c */ 8629 #line 2378 "parser.yy" 8630 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8631 break; 8632 8633 case 625: 8634 8635 /* Line 1806 of yacc.c */ 8636 #line 2380 "parser.yy" 8637 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8638 break; 8639 8640 case 626: 8641 8642 /* Line 1806 of yacc.c */ 8643 #line 2385 "parser.yy" 8644 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8645 break; 8646 8647 case 627: 8648 8649 /* Line 1806 of yacc.c */ 8650 #line 2387 "parser.yy" 8651 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8652 break; 8653 8654 case 628: 8655 8656 /* Line 1806 of yacc.c */ 8657 #line 2389 "parser.yy" 8658 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8659 break; 8660 8661 case 629: 8662 8663 /* Line 1806 of yacc.c */ 8664 #line 2391 "parser.yy" 8665 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8666 break; 8667 8668 case 630: 8669 8670 /* Line 1806 of yacc.c */ 8671 #line 2396 "parser.yy" 8388 8672 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8389 8673 break; 8390 8674 8391 case 583:8392 8393 /* Line 1806 of yacc.c */ 8394 #line 2 250"parser.yy"8675 case 631: 8676 8677 /* Line 1806 of yacc.c */ 8678 #line 2398 "parser.yy" 8395 8679 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8396 8680 break; 8397 8681 8398 case 584:8399 8400 /* Line 1806 of yacc.c */ 8401 #line 2 252"parser.yy"8682 case 632: 8683 8684 /* Line 1806 of yacc.c */ 8685 #line 2400 "parser.yy" 8402 8686 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8403 8687 break; 8404 8688 8405 case 585: 8406 8407 /* Line 1806 of yacc.c */ 8408 #line 2257 "parser.yy" 8409 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8410 break; 8411 8412 case 586: 8413 8414 /* Line 1806 of yacc.c */ 8415 #line 2259 "parser.yy" 8416 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8417 break; 8418 8419 case 587: 8420 8421 /* Line 1806 of yacc.c */ 8422 #line 2261 "parser.yy" 8423 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8424 break; 8425 8426 case 588: 8427 8428 /* Line 1806 of yacc.c */ 8429 #line 2266 "parser.yy" 8430 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8431 break; 8432 8433 case 589: 8434 8435 /* Line 1806 of yacc.c */ 8436 #line 2268 "parser.yy" 8437 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8438 break; 8439 8440 case 590: 8441 8442 /* Line 1806 of yacc.c */ 8443 #line 2270 "parser.yy" 8444 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8445 break; 8446 8447 case 594: 8448 8449 /* Line 1806 of yacc.c */ 8450 #line 2285 "parser.yy" 8451 { (yyval.decl) = (yyvsp[(1) - (4)].decl)->addIdList( (yyvsp[(3) - (4)].decl) ); } 8452 break; 8453 8454 case 595: 8455 8456 /* Line 1806 of yacc.c */ 8457 #line 2287 "parser.yy" 8458 { (yyval.decl) = (yyvsp[(2) - (6)].decl)->addIdList( (yyvsp[(5) - (6)].decl) ); } 8459 break; 8460 8461 case 596: 8462 8463 /* Line 1806 of yacc.c */ 8464 #line 2289 "parser.yy" 8465 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8466 break; 8467 8468 case 597: 8469 8470 /* Line 1806 of yacc.c */ 8471 #line 2294 "parser.yy" 8472 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8473 break; 8474 8475 case 598: 8476 8477 /* Line 1806 of yacc.c */ 8478 #line 2296 "parser.yy" 8479 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8480 break; 8481 8482 case 599: 8483 8484 /* Line 1806 of yacc.c */ 8485 #line 2298 "parser.yy" 8486 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8487 break; 8488 8489 case 600: 8490 8491 /* Line 1806 of yacc.c */ 8492 #line 2303 "parser.yy" 8493 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8494 break; 8495 8496 case 601: 8497 8498 /* Line 1806 of yacc.c */ 8499 #line 2305 "parser.yy" 8500 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8501 break; 8502 8503 case 602: 8504 8505 /* Line 1806 of yacc.c */ 8506 #line 2307 "parser.yy" 8507 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8508 break; 8509 8510 case 603: 8511 8512 /* Line 1806 of yacc.c */ 8513 #line 2322 "parser.yy" 8689 case 633: 8690 8691 /* Line 1806 of yacc.c */ 8692 #line 2431 "parser.yy" 8514 8693 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8515 8694 break; 8516 8695 8517 case 6 05:8518 8519 /* Line 1806 of yacc.c */ 8520 #line 2 325"parser.yy"8696 case 635: 8697 8698 /* Line 1806 of yacc.c */ 8699 #line 2434 "parser.yy" 8521 8700 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8522 8701 break; 8523 8702 8524 case 6 06:8525 8526 /* Line 1806 of yacc.c */ 8527 #line 2 327"parser.yy"8703 case 636: 8704 8705 /* Line 1806 of yacc.c */ 8706 #line 2436 "parser.yy" 8528 8707 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8529 8708 break; 8530 8709 8531 case 608:8532 8533 /* Line 1806 of yacc.c */8534 #line 2333 "parser.yy"8535 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }8536 break;8537 8538 case 609:8539 8540 /* Line 1806 of yacc.c */8541 #line 2338 "parser.yy"8542 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }8543 break;8544 8545 case 610:8546 8547 /* Line 1806 of yacc.c */8548 #line 2340 "parser.yy"8549 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }8550 break;8551 8552 case 611:8553 8554 /* Line 1806 of yacc.c */8555 #line 2342 "parser.yy"8556 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }8557 break;8558 8559 case 612:8560 8561 /* Line 1806 of yacc.c */8562 #line 2347 "parser.yy"8563 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }8564 break;8565 8566 case 613:8567 8568 /* Line 1806 of yacc.c */8569 #line 2349 "parser.yy"8570 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8571 break;8572 8573 case 614:8574 8575 /* Line 1806 of yacc.c */8576 #line 2351 "parser.yy"8577 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8578 break;8579 8580 case 615:8581 8582 /* Line 1806 of yacc.c */8583 #line 2353 "parser.yy"8584 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }8585 break;8586 8587 case 616:8588 8589 /* Line 1806 of yacc.c */8590 #line 2358 "parser.yy"8591 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }8592 break;8593 8594 case 617:8595 8596 /* Line 1806 of yacc.c */8597 #line 2360 "parser.yy"8598 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }8599 break;8600 8601 case 618:8602 8603 /* Line 1806 of yacc.c */8604 #line 2362 "parser.yy"8605 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }8606 break;8607 8608 case 619:8609 8610 /* Line 1806 of yacc.c */8611 #line 2372 "parser.yy"8612 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8613 break;8614 8615 case 621:8616 8617 /* Line 1806 of yacc.c */8618 #line 2375 "parser.yy"8619 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8620 break;8621 8622 case 622:8623 8624 /* Line 1806 of yacc.c */8625 #line 2377 "parser.yy"8626 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8627 break;8628 8629 case 623:8630 8631 /* Line 1806 of yacc.c */8632 #line 2382 "parser.yy"8633 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }8634 break;8635 8636 case 624:8637 8638 /* Line 1806 of yacc.c */8639 #line 2384 "parser.yy"8640 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }8641 break;8642 8643 case 625:8644 8645 /* Line 1806 of yacc.c */8646 #line 2386 "parser.yy"8647 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }8648 break;8649 8650 case 626:8651 8652 /* Line 1806 of yacc.c */8653 #line 2391 "parser.yy"8654 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }8655 break;8656 8657 case 627:8658 8659 /* Line 1806 of yacc.c */8660 #line 2393 "parser.yy"8661 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8662 break;8663 8664 case 628:8665 8666 /* Line 1806 of yacc.c */8667 #line 2395 "parser.yy"8668 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }8669 break;8670 8671 case 629:8672 8673 /* Line 1806 of yacc.c */8674 #line 2397 "parser.yy"8675 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }8676 break;8677 8678 case 630:8679 8680 /* Line 1806 of yacc.c */8681 #line 2402 "parser.yy"8682 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); }8683 break;8684 8685 case 631:8686 8687 /* Line 1806 of yacc.c */8688 #line 2404 "parser.yy"8689 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }8690 break;8691 8692 case 632:8693 8694 /* Line 1806 of yacc.c */8695 #line 2406 "parser.yy"8696 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }8697 break;8698 8699 case 633:8700 8701 /* Line 1806 of yacc.c */8702 #line 2437 "parser.yy"8703 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8704 break;8705 8706 case 635:8707 8708 /* Line 1806 of yacc.c */8709 #line 2440 "parser.yy"8710 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8711 break;8712 8713 case 636:8714 8715 /* Line 1806 of yacc.c */8716 #line 2442 "parser.yy"8717 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }8718 break;8719 8720 8710 case 637: 8721 8711 8722 8712 /* Line 1806 of yacc.c */ 8723 #line 244 7"parser.yy"8713 #line 2441 "parser.yy" 8724 8714 { 8725 8715 typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) ); … … 8731 8721 8732 8722 /* Line 1806 of yacc.c */ 8733 #line 24 52"parser.yy"8723 #line 2446 "parser.yy" 8734 8724 { 8735 8725 typedefTable.setNextIdentifier( *(yyvsp[(1) - (1)].tok) ); … … 8741 8731 8742 8732 /* Line 1806 of yacc.c */ 8743 #line 24 60"parser.yy"8733 #line 2454 "parser.yy" 8744 8734 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8745 8735 break; … … 8748 8738 8749 8739 /* Line 1806 of yacc.c */ 8750 #line 24 62"parser.yy"8740 #line 2456 "parser.yy" 8751 8741 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8752 8742 break; … … 8755 8745 8756 8746 /* Line 1806 of yacc.c */ 8757 #line 24 64"parser.yy"8747 #line 2458 "parser.yy" 8758 8748 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8759 8749 break; … … 8762 8752 8763 8753 /* Line 1806 of yacc.c */ 8764 #line 246 9"parser.yy"8754 #line 2463 "parser.yy" 8765 8755 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 8766 8756 break; … … 8769 8759 8770 8760 /* Line 1806 of yacc.c */ 8771 #line 24 71"parser.yy"8761 #line 2465 "parser.yy" 8772 8762 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8773 8763 break; … … 8776 8766 8777 8767 /* Line 1806 of yacc.c */ 8778 #line 247 6"parser.yy"8768 #line 2470 "parser.yy" 8779 8769 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addParamList( (yyvsp[(4) - (6)].decl) ); } 8780 8770 break; … … 8783 8773 8784 8774 /* Line 1806 of yacc.c */ 8785 #line 247 8"parser.yy"8775 #line 2472 "parser.yy" 8786 8776 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8787 8777 break; … … 8790 8780 8791 8781 /* Line 1806 of yacc.c */ 8792 #line 24 93"parser.yy"8782 #line 2487 "parser.yy" 8793 8783 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8794 8784 break; … … 8797 8787 8798 8788 /* Line 1806 of yacc.c */ 8799 #line 24 95"parser.yy"8789 #line 2489 "parser.yy" 8800 8790 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8801 8791 break; … … 8804 8794 8805 8795 /* Line 1806 of yacc.c */ 8796 #line 2494 "parser.yy" 8797 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 8798 break; 8799 8800 case 650: 8801 8802 /* Line 1806 of yacc.c */ 8803 #line 2496 "parser.yy" 8804 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); } 8805 break; 8806 8807 case 651: 8808 8809 /* Line 1806 of yacc.c */ 8810 #line 2498 "parser.yy" 8811 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8812 break; 8813 8814 case 652: 8815 8816 /* Line 1806 of yacc.c */ 8806 8817 #line 2500 "parser.yy" 8818 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8819 break; 8820 8821 case 653: 8822 8823 /* Line 1806 of yacc.c */ 8824 #line 2502 "parser.yy" 8825 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8826 break; 8827 8828 case 655: 8829 8830 /* Line 1806 of yacc.c */ 8831 #line 2508 "parser.yy" 8832 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8833 break; 8834 8835 case 656: 8836 8837 /* Line 1806 of yacc.c */ 8838 #line 2510 "parser.yy" 8839 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8840 break; 8841 8842 case 657: 8843 8844 /* Line 1806 of yacc.c */ 8845 #line 2512 "parser.yy" 8846 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8847 break; 8848 8849 case 658: 8850 8851 /* Line 1806 of yacc.c */ 8852 #line 2517 "parser.yy" 8853 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); } 8854 break; 8855 8856 case 659: 8857 8858 /* Line 1806 of yacc.c */ 8859 #line 2519 "parser.yy" 8860 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8861 break; 8862 8863 case 660: 8864 8865 /* Line 1806 of yacc.c */ 8866 #line 2521 "parser.yy" 8867 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8868 break; 8869 8870 case 661: 8871 8872 /* Line 1806 of yacc.c */ 8873 #line 2527 "parser.yy" 8874 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 8875 break; 8876 8877 case 662: 8878 8879 /* Line 1806 of yacc.c */ 8880 #line 2529 "parser.yy" 8881 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false )->addArray( (yyvsp[(3) - (3)].decl) ); } 8882 break; 8883 8884 case 664: 8885 8886 /* Line 1806 of yacc.c */ 8887 #line 2535 "parser.yy" 8888 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); } 8889 break; 8890 8891 case 665: 8892 8893 /* Line 1806 of yacc.c */ 8894 #line 2537 "parser.yy" 8895 { (yyval.decl) = DeclarationNode::newVarArray( 0 ); } 8896 break; 8897 8898 case 666: 8899 8900 /* Line 1806 of yacc.c */ 8901 #line 2539 "parser.yy" 8902 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false ) ); } 8903 break; 8904 8905 case 667: 8906 8907 /* Line 1806 of yacc.c */ 8908 #line 2541 "parser.yy" 8909 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newVarArray( 0 ) ); } 8910 break; 8911 8912 case 669: 8913 8914 /* Line 1806 of yacc.c */ 8915 #line 2556 "parser.yy" 8916 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8917 break; 8918 8919 case 670: 8920 8921 /* Line 1806 of yacc.c */ 8922 #line 2558 "parser.yy" 8923 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8924 break; 8925 8926 case 671: 8927 8928 /* Line 1806 of yacc.c */ 8929 #line 2563 "parser.yy" 8807 8930 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 8808 8931 break; 8809 8932 8810 case 6 50:8811 8812 /* Line 1806 of yacc.c */ 8813 #line 25 02"parser.yy"8933 case 672: 8934 8935 /* Line 1806 of yacc.c */ 8936 #line 2565 "parser.yy" 8814 8937 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); } 8815 8938 break; 8816 8939 8817 case 6 51:8818 8819 /* Line 1806 of yacc.c */ 8820 #line 25 04"parser.yy"8940 case 673: 8941 8942 /* Line 1806 of yacc.c */ 8943 #line 2567 "parser.yy" 8821 8944 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8822 8945 break; 8823 8946 8824 case 6 52:8825 8826 /* Line 1806 of yacc.c */ 8827 #line 25 06"parser.yy"8947 case 674: 8948 8949 /* Line 1806 of yacc.c */ 8950 #line 2569 "parser.yy" 8828 8951 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8829 8952 break; 8830 8953 8831 case 6 53:8832 8833 /* Line 1806 of yacc.c */ 8834 #line 25 08"parser.yy"8954 case 675: 8955 8956 /* Line 1806 of yacc.c */ 8957 #line 2571 "parser.yy" 8835 8958 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8836 8959 break; 8837 8960 8838 case 6 55:8839 8840 /* Line 1806 of yacc.c */ 8841 #line 25 14"parser.yy"8961 case 677: 8962 8963 /* Line 1806 of yacc.c */ 8964 #line 2577 "parser.yy" 8842 8965 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8843 8966 break; 8844 8967 8845 case 6 56:8846 8847 /* Line 1806 of yacc.c */ 8848 #line 25 16"parser.yy"8968 case 678: 8969 8970 /* Line 1806 of yacc.c */ 8971 #line 2579 "parser.yy" 8849 8972 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8850 8973 break; 8851 8974 8852 case 6 57:8853 8854 /* Line 1806 of yacc.c */ 8855 #line 25 18"parser.yy"8975 case 679: 8976 8977 /* Line 1806 of yacc.c */ 8978 #line 2581 "parser.yy" 8856 8979 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8857 8980 break; 8858 8981 8859 case 6 58:8860 8861 /* Line 1806 of yacc.c */ 8862 #line 25 23"parser.yy"8982 case 680: 8983 8984 /* Line 1806 of yacc.c */ 8985 #line 2586 "parser.yy" 8863 8986 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); } 8864 8987 break; 8865 8988 8866 case 6 59:8867 8868 /* Line 1806 of yacc.c */ 8869 #line 25 25"parser.yy"8989 case 681: 8990 8991 /* Line 1806 of yacc.c */ 8992 #line 2588 "parser.yy" 8870 8993 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 8871 8994 break; 8872 8995 8873 case 6 60:8874 8875 /* Line 1806 of yacc.c */ 8876 #line 25 27"parser.yy"8996 case 682: 8997 8998 /* Line 1806 of yacc.c */ 8999 #line 2590 "parser.yy" 8877 9000 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8878 9001 break; 8879 9002 8880 case 661: 8881 8882 /* Line 1806 of yacc.c */ 8883 #line 2533 "parser.yy" 9003 case 684: 9004 9005 /* Line 1806 of yacc.c */ 9006 #line 2597 "parser.yy" 9007 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); } 9008 break; 9009 9010 case 686: 9011 9012 /* Line 1806 of yacc.c */ 9013 #line 2608 "parser.yy" 8884 9014 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); } 8885 9015 break; 8886 9016 8887 case 6 62:8888 8889 /* Line 1806 of yacc.c */ 8890 #line 2 535"parser.yy"8891 { (yyval.decl) = DeclarationNode::new Array( 0, 0, false )->addArray( (yyvsp[(3) - (3)].decl) ); }8892 break; 8893 8894 case 6 64:8895 8896 /* Line 1806 of yacc.c */ 8897 #line 2 541"parser.yy"8898 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(3) - (5)].en), 0, false ); }8899 break; 8900 8901 case 6 65:8902 8903 /* Line 1806 of yacc.c */ 8904 #line 2 543"parser.yy"8905 { (yyval.decl) = DeclarationNode::new VarArray( 0); }8906 break; 8907 8908 case 6 66:8909 8910 /* Line 1806 of yacc.c */ 8911 #line 2 545"parser.yy"8912 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newArray( (yyvsp[(4) - (6)].en), 0, false )); }8913 break; 8914 8915 case 6 67:8916 8917 /* Line 1806 of yacc.c */ 8918 #line 2 547"parser.yy"8919 { (yyval.decl) = (yyvsp[(1) - (6)].decl)->addArray( DeclarationNode::newVarArray( 0 )); }8920 break; 8921 8922 case 6 69:8923 8924 /* Line 1806 of yacc.c */ 8925 #line 2 562"parser.yy"9017 case 687: 9018 9019 /* Line 1806 of yacc.c */ 9020 #line 2611 "parser.yy" 9021 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); } 9022 break; 9023 9024 case 688: 9025 9026 /* Line 1806 of yacc.c */ 9027 #line 2613 "parser.yy" 9028 { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[(3) - (5)].decl), false ); } 9029 break; 9030 9031 case 689: 9032 9033 /* Line 1806 of yacc.c */ 9034 #line 2616 "parser.yy" 9035 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); } 9036 break; 9037 9038 case 690: 9039 9040 /* Line 1806 of yacc.c */ 9041 #line 2618 "parser.yy" 9042 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); } 9043 break; 9044 9045 case 691: 9046 9047 /* Line 1806 of yacc.c */ 9048 #line 2620 "parser.yy" 9049 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(3) - (7)].decl), true ); } 9050 break; 9051 9052 case 693: 9053 9054 /* Line 1806 of yacc.c */ 9055 #line 2634 "parser.yy" 8926 9056 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8927 9057 break; 8928 9058 8929 case 6 70:8930 8931 /* Line 1806 of yacc.c */ 8932 #line 2 564"parser.yy"9059 case 694: 9060 9061 /* Line 1806 of yacc.c */ 9062 #line 2636 "parser.yy" 8933 9063 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); } 8934 9064 break; 8935 9065 8936 case 6 71:8937 8938 /* Line 1806 of yacc.c */ 8939 #line 2 569"parser.yy"9066 case 695: 9067 9068 /* Line 1806 of yacc.c */ 9069 #line 2641 "parser.yy" 8940 9070 { (yyval.decl) = DeclarationNode::newPointer( 0 ); } 8941 9071 break; 8942 9072 8943 case 6 72:8944 8945 /* Line 1806 of yacc.c */ 8946 #line 2 571"parser.yy"9073 case 696: 9074 9075 /* Line 1806 of yacc.c */ 9076 #line 2643 "parser.yy" 8947 9077 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); } 8948 9078 break; 8949 9079 8950 case 6 73:8951 8952 /* Line 1806 of yacc.c */ 8953 #line 2 573"parser.yy"9080 case 697: 9081 9082 /* Line 1806 of yacc.c */ 9083 #line 2645 "parser.yy" 8954 9084 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); } 8955 9085 break; 8956 9086 8957 case 6 74:8958 8959 /* Line 1806 of yacc.c */ 8960 #line 2 575"parser.yy"9087 case 698: 9088 9089 /* Line 1806 of yacc.c */ 9090 #line 2647 "parser.yy" 8961 9091 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); } 8962 9092 break; 8963 9093 8964 case 6 75:8965 8966 /* Line 1806 of yacc.c */ 8967 #line 2 577"parser.yy"9094 case 699: 9095 9096 /* Line 1806 of yacc.c */ 9097 #line 2649 "parser.yy" 8968 9098 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8969 9099 break; 8970 9100 8971 case 677:8972 8973 /* Line 1806 of yacc.c */ 8974 #line 2 583"parser.yy"9101 case 701: 9102 9103 /* Line 1806 of yacc.c */ 9104 #line 2655 "parser.yy" 8975 9105 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8976 9106 break; 8977 9107 8978 case 678:8979 8980 /* Line 1806 of yacc.c */ 8981 #line 2 585"parser.yy"9108 case 702: 9109 9110 /* Line 1806 of yacc.c */ 9111 #line 2657 "parser.yy" 8982 9112 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); } 8983 9113 break; 8984 9114 8985 case 679:8986 8987 /* Line 1806 of yacc.c */ 8988 #line 2 587"parser.yy"9115 case 703: 9116 9117 /* Line 1806 of yacc.c */ 9118 #line 2659 "parser.yy" 8989 9119 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 8990 9120 break; 8991 9121 8992 case 680: 8993 8994 /* Line 1806 of yacc.c */ 8995 #line 2592 "parser.yy" 8996 { (yyval.decl) = DeclarationNode::newFunction( 0, 0, (yyvsp[(3) - (5)].decl), 0 ); } 8997 break; 8998 8999 case 681: 9000 9001 /* Line 1806 of yacc.c */ 9002 #line 2594 "parser.yy" 9122 case 704: 9123 9124 /* Line 1806 of yacc.c */ 9125 #line 2664 "parser.yy" 9003 9126 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); } 9004 9127 break; 9005 9128 9006 case 682:9007 9008 /* Line 1806 of yacc.c */ 9009 #line 2 596 "parser.yy"9129 case 705: 9130 9131 /* Line 1806 of yacc.c */ 9132 #line 2666 "parser.yy" 9010 9133 { (yyval.decl) = (yyvsp[(2) - (3)].decl); } 9011 9134 break; 9012 9135 9013 case 684:9014 9015 /* Line 1806 of yacc.c */9016 #line 2603 "parser.yy"9017 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addArray( (yyvsp[(2) - (2)].decl) ); }9018 break;9019 9020 case 686:9021 9022 /* Line 1806 of yacc.c */9023 #line 2614 "parser.yy"9024 { (yyval.decl) = DeclarationNode::newArray( 0, 0, false ); }9025 break;9026 9027 case 687:9028 9029 /* Line 1806 of yacc.c */9030 #line 2617 "parser.yy"9031 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); }9032 break;9033 9034 case 688:9035 9036 /* Line 1806 of yacc.c */9037 #line 2619 "parser.yy"9038 { (yyval.decl) = DeclarationNode::newArray( 0, (yyvsp[(3) - (5)].decl), false ); }9039 break;9040 9041 case 689:9042 9043 /* Line 1806 of yacc.c */9044 #line 2622 "parser.yy"9045 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); }9046 break;9047 9048 case 690:9049 9050 /* Line 1806 of yacc.c */9051 #line 2624 "parser.yy"9052 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl), true ); }9053 break;9054 9055 case 691:9056 9057 /* Line 1806 of yacc.c */9058 #line 2626 "parser.yy"9059 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(3) - (7)].decl), true ); }9060 break;9061 9062 case 693:9063 9064 /* Line 1806 of yacc.c */9065 #line 2640 "parser.yy"9066 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }9067 break;9068 9069 case 694:9070 9071 /* Line 1806 of yacc.c */9072 #line 2642 "parser.yy"9073 { (yyval.decl) = (yyvsp[(1) - (2)].decl)->addQualifiers( (yyvsp[(2) - (2)].decl) ); }9074 break;9075 9076 case 695:9077 9078 /* Line 1806 of yacc.c */9079 #line 2647 "parser.yy"9080 { (yyval.decl) = DeclarationNode::newPointer( 0 ); }9081 break;9082 9083 case 696:9084 9085 /* Line 1806 of yacc.c */9086 #line 2649 "parser.yy"9087 { (yyval.decl) = DeclarationNode::newPointer( (yyvsp[(2) - (2)].decl) ); }9088 break;9089 9090 case 697:9091 9092 /* Line 1806 of yacc.c */9093 #line 2651 "parser.yy"9094 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addPointer( DeclarationNode::newPointer( 0 ) ); }9095 break;9096 9097 case 698:9098 9099 /* Line 1806 of yacc.c */9100 #line 2653 "parser.yy"9101 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addPointer( DeclarationNode::newPointer( (yyvsp[(2) - (3)].decl) ) ); }9102 break;9103 9104 case 699:9105 9106 /* Line 1806 of yacc.c */9107 #line 2655 "parser.yy"9108 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }9109 break;9110 9111 case 701:9112 9113 /* Line 1806 of yacc.c */9114 #line 2661 "parser.yy"9115 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }9116 break;9117 9118 case 702:9119 9120 /* Line 1806 of yacc.c */9121 #line 2663 "parser.yy"9122 { (yyval.decl) = (yyvsp[(2) - (4)].decl)->addArray( (yyvsp[(4) - (4)].decl) ); }9123 break;9124 9125 case 703:9126 9127 /* Line 1806 of yacc.c */9128 #line 2665 "parser.yy"9129 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }9130 break;9131 9132 case 704:9133 9134 /* Line 1806 of yacc.c */9135 #line 2670 "parser.yy"9136 { (yyval.decl) = (yyvsp[(2) - (8)].decl)->addParamList( (yyvsp[(6) - (8)].decl) ); }9137 break;9138 9139 case 705:9140 9141 /* Line 1806 of yacc.c */9142 #line 2672 "parser.yy"9143 { (yyval.decl) = (yyvsp[(2) - (3)].decl); }9144 break;9145 9146 9136 case 708: 9147 9137 9148 9138 /* Line 1806 of yacc.c */ 9149 #line 26 82"parser.yy"9139 #line 2676 "parser.yy" 9150 9140 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 9151 9141 break; … … 9154 9144 9155 9145 /* Line 1806 of yacc.c */ 9146 #line 2686 "parser.yy" 9147 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9148 break; 9149 9150 case 712: 9151 9152 /* Line 1806 of yacc.c */ 9153 #line 2688 "parser.yy" 9154 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9155 break; 9156 9157 case 713: 9158 9159 /* Line 1806 of yacc.c */ 9160 #line 2690 "parser.yy" 9161 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9162 break; 9163 9164 case 714: 9165 9166 /* Line 1806 of yacc.c */ 9156 9167 #line 2692 "parser.yy" 9168 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9169 break; 9170 9171 case 715: 9172 9173 /* Line 1806 of yacc.c */ 9174 #line 2694 "parser.yy" 9157 9175 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9158 9176 break; 9159 9177 9160 case 71 2:9161 9162 /* Line 1806 of yacc.c */ 9163 #line 269 4"parser.yy"9178 case 716: 9179 9180 /* Line 1806 of yacc.c */ 9181 #line 2696 "parser.yy" 9164 9182 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9165 9183 break; 9166 9184 9167 case 713:9168 9169 /* Line 1806 of yacc.c */9170 #line 2696 "parser.yy"9171 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }9172 break;9173 9174 case 714:9175 9176 /* Line 1806 of yacc.c */9177 #line 2698 "parser.yy"9178 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }9179 break;9180 9181 case 715:9182 9183 /* Line 1806 of yacc.c */9184 #line 2700 "parser.yy"9185 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); }9186 break;9187 9188 case 716:9189 9190 /* Line 1806 of yacc.c */9191 #line 2702 "parser.yy"9192 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); }9193 break;9194 9195 9185 case 717: 9196 9186 9197 9187 /* Line 1806 of yacc.c */ 9188 #line 2703 "parser.yy" 9189 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9190 break; 9191 9192 case 718: 9193 9194 /* Line 1806 of yacc.c */ 9195 #line 2705 "parser.yy" 9196 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 9197 break; 9198 9199 case 719: 9200 9201 /* Line 1806 of yacc.c */ 9202 #line 2707 "parser.yy" 9203 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9204 break; 9205 9206 case 720: 9207 9208 /* Line 1806 of yacc.c */ 9198 9209 #line 2709 "parser.yy" 9199 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false) ); }9200 break; 9201 9202 case 7 18:9210 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); } 9211 break; 9212 9213 case 721: 9203 9214 9204 9215 /* Line 1806 of yacc.c */ … … 9207 9218 break; 9208 9219 9209 case 7 19:9220 case 722: 9210 9221 9211 9222 /* Line 1806 of yacc.c */ 9212 9223 #line 2713 "parser.yy" 9224 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9225 break; 9226 9227 case 723: 9228 9229 /* Line 1806 of yacc.c */ 9230 #line 2715 "parser.yy" 9231 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 9232 break; 9233 9234 case 724: 9235 9236 /* Line 1806 of yacc.c */ 9237 #line 2717 "parser.yy" 9213 9238 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9214 9239 break; 9215 9240 9216 case 72 0:9217 9218 /* Line 1806 of yacc.c */ 9219 #line 271 5"parser.yy"9241 case 725: 9242 9243 /* Line 1806 of yacc.c */ 9244 #line 2719 "parser.yy" 9220 9245 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); } 9221 9246 break; 9222 9247 9223 case 721: 9224 9225 /* Line 1806 of yacc.c */ 9226 #line 2717 "parser.yy" 9227 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 9228 break; 9229 9230 case 722: 9231 9232 /* Line 1806 of yacc.c */ 9233 #line 2719 "parser.yy" 9234 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9235 break; 9236 9237 case 723: 9248 case 726: 9238 9249 9239 9250 /* Line 1806 of yacc.c */ … … 9242 9253 break; 9243 9254 9244 case 724: 9245 9246 /* Line 1806 of yacc.c */ 9247 #line 2723 "parser.yy" 9255 case 727: 9256 9257 /* Line 1806 of yacc.c */ 9258 #line 2726 "parser.yy" 9259 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); } 9260 break; 9261 9262 case 728: 9263 9264 /* Line 1806 of yacc.c */ 9265 #line 2728 "parser.yy" 9266 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); } 9267 break; 9268 9269 case 729: 9270 9271 /* Line 1806 of yacc.c */ 9272 #line 2733 "parser.yy" 9273 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); } 9274 break; 9275 9276 case 730: 9277 9278 /* Line 1806 of yacc.c */ 9279 #line 2735 "parser.yy" 9280 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); } 9281 break; 9282 9283 case 732: 9284 9285 /* Line 1806 of yacc.c */ 9286 #line 2762 "parser.yy" 9287 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 9288 break; 9289 9290 case 736: 9291 9292 /* Line 1806 of yacc.c */ 9293 #line 2773 "parser.yy" 9294 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9295 break; 9296 9297 case 737: 9298 9299 /* Line 1806 of yacc.c */ 9300 #line 2775 "parser.yy" 9301 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9302 break; 9303 9304 case 738: 9305 9306 /* Line 1806 of yacc.c */ 9307 #line 2777 "parser.yy" 9308 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9309 break; 9310 9311 case 739: 9312 9313 /* Line 1806 of yacc.c */ 9314 #line 2779 "parser.yy" 9315 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9316 break; 9317 9318 case 740: 9319 9320 /* Line 1806 of yacc.c */ 9321 #line 2781 "parser.yy" 9322 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9323 break; 9324 9325 case 741: 9326 9327 /* Line 1806 of yacc.c */ 9328 #line 2783 "parser.yy" 9329 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9330 break; 9331 9332 case 742: 9333 9334 /* Line 1806 of yacc.c */ 9335 #line 2790 "parser.yy" 9336 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9337 break; 9338 9339 case 743: 9340 9341 /* Line 1806 of yacc.c */ 9342 #line 2792 "parser.yy" 9248 9343 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); } 9249 9344 break; 9250 9345 9251 case 725: 9252 9253 /* Line 1806 of yacc.c */ 9254 #line 2725 "parser.yy" 9255 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( (yyvsp[(2) - (3)].decl) )->addNewArray( (yyvsp[(1) - (3)].decl) ); } 9256 break; 9257 9258 case 726: 9259 9260 /* Line 1806 of yacc.c */ 9261 #line 2727 "parser.yy" 9346 case 744: 9347 9348 /* Line 1806 of yacc.c */ 9349 #line 2794 "parser.yy" 9262 9350 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); } 9263 9351 break; 9264 9352 9265 case 727: 9266 9267 /* Line 1806 of yacc.c */ 9268 #line 2732 "parser.yy" 9269 { (yyval.decl) = DeclarationNode::newVarArray( (yyvsp[(3) - (6)].decl) ); } 9270 break; 9271 9272 case 728: 9273 9274 /* Line 1806 of yacc.c */ 9275 #line 2734 "parser.yy" 9276 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), false ); } 9277 break; 9278 9279 case 729: 9280 9281 /* Line 1806 of yacc.c */ 9282 #line 2739 "parser.yy" 9283 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(4) - (6)].en), (yyvsp[(3) - (6)].decl), true ); } 9284 break; 9285 9286 case 730: 9287 9288 /* Line 1806 of yacc.c */ 9289 #line 2741 "parser.yy" 9290 { (yyval.decl) = DeclarationNode::newArray( (yyvsp[(5) - (7)].en), (yyvsp[(4) - (7)].decl)->addQualifiers( (yyvsp[(3) - (7)].decl) ), true ); } 9291 break; 9292 9293 case 732: 9294 9295 /* Line 1806 of yacc.c */ 9296 #line 2768 "parser.yy" 9297 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addQualifiers( (yyvsp[(1) - (2)].decl) ); } 9298 break; 9299 9300 case 736: 9301 9302 /* Line 1806 of yacc.c */ 9303 #line 2779 "parser.yy" 9304 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9305 break; 9306 9307 case 737: 9308 9309 /* Line 1806 of yacc.c */ 9310 #line 2781 "parser.yy" 9311 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9312 break; 9313 9314 case 738: 9315 9316 /* Line 1806 of yacc.c */ 9317 #line 2783 "parser.yy" 9318 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9319 break; 9320 9321 case 739: 9322 9323 /* Line 1806 of yacc.c */ 9324 #line 2785 "parser.yy" 9325 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9326 break; 9327 9328 case 740: 9329 9330 /* Line 1806 of yacc.c */ 9331 #line 2787 "parser.yy" 9332 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewPointer( DeclarationNode::newPointer( 0 ) ); } 9333 break; 9334 9335 case 741: 9336 9337 /* Line 1806 of yacc.c */ 9338 #line 2789 "parser.yy" 9339 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewPointer( DeclarationNode::newPointer( (yyvsp[(1) - (3)].decl) ) ); } 9340 break; 9341 9342 case 742: 9353 case 745: 9343 9354 9344 9355 /* Line 1806 of yacc.c */ … … 9347 9358 break; 9348 9359 9349 case 74 3:9360 case 746: 9350 9361 9351 9362 /* Line 1806 of yacc.c */ … … 9354 9365 break; 9355 9366 9356 case 74 4:9367 case 747: 9357 9368 9358 9369 /* Line 1806 of yacc.c */ … … 9361 9372 break; 9362 9373 9363 case 745:9364 9365 /* Line 1806 of yacc.c */9366 #line 2802 "parser.yy"9367 { (yyval.decl) = (yyvsp[(3) - (3)].decl)->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9368 break;9369 9370 case 746:9371 9372 /* Line 1806 of yacc.c */9373 #line 2804 "parser.yy"9374 { (yyval.decl) = (yyvsp[(4) - (4)].decl)->addNewArray( (yyvsp[(3) - (4)].decl) )->addNewArray( DeclarationNode::newArray( 0, 0, false ) ); }9375 break;9376 9377 case 747:9378 9379 /* Line 1806 of yacc.c */9380 #line 2806 "parser.yy"9381 { (yyval.decl) = (yyvsp[(2) - (2)].decl)->addNewArray( (yyvsp[(1) - (2)].decl) ); }9382 break;9383 9384 9374 case 748: 9385 9375 9386 9376 /* Line 1806 of yacc.c */ 9387 #line 28 11"parser.yy"9377 #line 2805 "parser.yy" 9388 9378 { (yyval.decl) = DeclarationNode::newTuple( (yyvsp[(3) - (5)].decl) ); } 9389 9379 break; … … 9392 9382 9393 9383 /* Line 1806 of yacc.c */ 9394 #line 281 6"parser.yy"9384 #line 2810 "parser.yy" 9395 9385 { (yyval.decl) = DeclarationNode::newFunction( 0, DeclarationNode::newTuple( 0 ), (yyvsp[(4) - (5)].decl), 0 ); } 9396 9386 break; … … 9399 9389 9400 9390 /* Line 1806 of yacc.c */ 9401 #line 281 8"parser.yy"9391 #line 2812 "parser.yy" 9402 9392 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0 ); } 9403 9393 break; … … 9406 9396 9407 9397 /* Line 1806 of yacc.c */ 9408 #line 28 20"parser.yy"9398 #line 2814 "parser.yy" 9409 9399 { (yyval.decl) = DeclarationNode::newFunction( 0, (yyvsp[(1) - (6)].decl), (yyvsp[(4) - (6)].decl), 0 ); } 9410 9400 break; … … 9413 9403 9414 9404 /* Line 1806 of yacc.c */ 9415 #line 28 44"parser.yy"9405 #line 2838 "parser.yy" 9416 9406 { (yyval.en) = 0; } 9417 9407 break; … … 9420 9410 9421 9411 /* Line 1806 of yacc.c */ 9422 #line 284 6"parser.yy"9412 #line 2840 "parser.yy" 9423 9413 { (yyval.en) = (yyvsp[(2) - (2)].en); } 9424 9414 break; … … 9427 9417 9428 9418 /* Line 1806 of yacc.c */ 9429 #line 94 30 "Parser/parser.cc"9419 #line 9420 "Parser/parser.cc" 9430 9420 default: break; 9431 9421 } … … 9658 9648 9659 9649 /* Line 2067 of yacc.c */ 9660 #line 284 9"parser.yy"9650 #line 2843 "parser.yy" 9661 9651 9662 9652 // ----end of grammar---- -
src/Parser/parser.h
rc331406 r5070fe4 274 274 LabelNode *label; 275 275 InitializerNode *in; 276 OperatorNode::Type op;277 276 bool flag; 278 277 … … 280 279 281 280 /* Line 2068 of yacc.c */ 282 #line 28 3"Parser/parser.h"281 #line 282 "Parser/parser.h" 283 282 } YYSTYPE; 284 283 # define YYSTYPE_IS_TRIVIAL 1 -
src/Parser/parser.yy
rc331406 r5070fe4 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Aug 5 08:15:57201613 // Update Count : 1 72112 // Last Modified On : Sat Jul 23 17:01:30 2016 13 // Update Count : 1668 14 14 // 15 15 … … 119 119 LabelNode *label; 120 120 InitializerNode *in; 121 OperatorNode::Type op;122 121 bool flag; 123 122 } … … 130 129 %type<constant> constant 131 130 %type<en> tuple tuple_expression_list 132 %type<op> ptrref_operator 133 %type<en> unary_operator assignment_operator 131 %type<en> ptrref_operator unary_operator assignment_operator 134 132 %type<en> primary_expression postfix_expression unary_expression 135 133 %type<en> cast_expression multiplicative_expression additive_expression shift_expression … … 152 150 %type<sn> block_item_list block_item 153 151 %type<sn> case_clause 154 %type<en> case_value 155 %type<sn> case_ value_list case_label case_label_list152 %type<en> case_value case_value_list 153 %type<sn> case_label case_label_list 156 154 %type<sn> switch_clause_list_opt switch_clause_list choose_clause_list_opt choose_clause_list 157 155 %type<pn> handler_list handler_clause finally_clause … … 356 354 // little advantage to this feature and many disadvantages. It is possible to write x[(i,j)] in CFA, which is 357 355 // equivalent to the old x[i,j]. 358 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Index, $1, $4 )); }356 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Index ), $1, $4 ); } 359 357 | postfix_expression '(' argument_expression_list ')' 360 358 { $$ = new CompositeExprNode( $1, $3 ); } … … 362 360 // struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1; 363 361 | postfix_expression '.' no_attr_identifier 364 { $$ = new CompositeExprNode 2( build_fieldSel( $1, new VarRefNode( $3 ) )); }362 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), $1, new VarRefNode( $3 )); } 365 363 | postfix_expression '.' '[' push field_list pop ']' // CFA, tuple field selector 366 364 | postfix_expression ARROW no_attr_identifier 367 { $$ = new CompositeExprNode 2( build_pfieldSel( $1, new VarRefNode( $3 ) )); }365 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), $1, new VarRefNode( $3 )); } 368 366 | postfix_expression ARROW '[' push field_list pop ']' // CFA, tuple field selector 369 367 | postfix_expression ICR 370 { $$ = new CompositeExprNode2( build_opr1( OperatorNode::IncrPost, $1 )); }368 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::IncrPost ), $1 ); } 371 369 | postfix_expression DECR 372 { $$ = new CompositeExprNode2( build_opr1( OperatorNode::DecrPost, $1 )); }370 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::DecrPost ), $1 ); } 373 371 | '(' type_name_no_function ')' '{' initializer_list comma_opt '}' // C99 374 372 { $$ = new CompoundLiteralNode( $2, new InitializerNode( $5, true ) ); } … … 412 410 // struct S { int 0, 1; } s; s. 0 = 0; s. 1 = 1; 413 411 | no_attr_identifier '.' field 414 { $$ = new CompositeExprNode 2( build_fieldSel( $3, new VarRefNode( $1 ) )); }412 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( $1 ), $3 ); } 415 413 | no_attr_identifier '.' '[' push field_list pop ']' 416 { $$ = new CompositeExprNode 2( build_fieldSel( $5, new VarRefNode( $1 ) )); }414 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::FieldSel ), new VarRefNode( $1 ), $5 ); } 417 415 | no_attr_identifier ARROW field 418 { $$ = new CompositeExprNode 2( build_pfieldSel( $3, new VarRefNode( $1 ) )); }416 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), new VarRefNode( $1 ), $3 ); } 419 417 | no_attr_identifier ARROW '[' push field_list pop ']' 420 { $$ = new CompositeExprNode 2( build_pfieldSel( $5, new VarRefNode( $1 ) )); }418 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::PFieldSel ), new VarRefNode( $1 ), $5 ); } 421 419 ; 422 420 … … 431 429 | EXTENSION cast_expression // GCC 432 430 { $$ = $2->set_extension( true ); } 431 | ptrref_operator cast_expression // CFA 432 { $$ = new CompositeExprNode( $1, $2 ); } 433 433 // '*' ('&') is separated from unary_operator because of shift/reduce conflict in: 434 434 // { * X; } // dereference X 435 435 // { * int X; } // CFA declaration of pointer to int 436 | ptrref_operator cast_expression // CFA437 { $$ = $1 == OperatorNode::AddressOf ? (ExpressionNode*) new CompositeExprNode2( build_addressOf( $2 ) )438 : (ExpressionNode*)new CompositeExprNode( new OperatorNode ( $1 ), $2 ); }439 436 | unary_operator cast_expression 440 437 { $$ = new CompositeExprNode( $1, $2 ); } 441 438 | ICR unary_expression 442 { $$ = new CompositeExprNode2( build_opr1( OperatorNode::Incr, $2 )); }439 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Incr ), $2 ); } 443 440 | DECR unary_expression 444 { $$ = new CompositeExprNode2( build_opr1( OperatorNode::Decr, $2 )); }441 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Decr ), $2 ); } 445 442 | SIZEOF unary_expression 446 { $$ = new CompositeExprNode 2( build_sizeOf( $2 )); }443 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), $2 ); } 447 444 | SIZEOF '(' type_name_no_function ')' 448 { $$ = new CompositeExprNode 2( build_sizeOf( new TypeValueNode( $3 ) )); }445 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::SizeOf ), new TypeValueNode( $3 )); } 449 446 | OFFSETOF '(' type_name_no_function ',' no_attr_identifier ')' 450 { $$ = new CompositeExprNode 2( build_offsetOf( new TypeValueNode( $3 ), new VarRefNode( $5 ) )); }447 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::OffsetOf ), new TypeValueNode( $3 ), new VarRefNode( $5 )); } 451 448 | ATTR_IDENTIFIER 452 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 ) ); }449 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 )); } 453 450 | ATTR_IDENTIFIER '(' type_name ')' 454 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 ), new TypeValueNode( $3 ) ); }451 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 ), new TypeValueNode( $3 )); } 455 452 | ATTR_IDENTIFIER '(' argument_expression ')' 456 453 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Attr ), new VarRefNode( $1 ), $3 ); } 457 454 | ALIGNOF unary_expression // GCC, variable alignment 458 { $$ = new CompositeExprNode 2( build_alignOf( $2 )); }455 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), $2 ); } 459 456 | ALIGNOF '(' type_name_no_function ')' // GCC, type alignment 460 { $$ = new CompositeExprNode 2( build_alignOf( new TypeValueNode( $3 )) ); }457 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::AlignOf ), new TypeValueNode( $3 ) ); } 461 458 // | ANDAND IDENTIFIER // GCC, address of label 462 459 // { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LabelAddress ), new VarRefNode( $2, true ) ); } … … 464 461 465 462 ptrref_operator: 466 '*' { $$ = OperatorNode::PointTo; }467 | '&' { $$ = OperatorNode::AddressOf; }463 '*' { $$ = new OperatorNode( OperatorNode::PointTo ); } 464 | '&' { $$ = new OperatorNode( OperatorNode::AddressOf ); } 468 465 // GCC, address of label must be handled by semantic check for ref,ref,label 469 | ANDAND { $$ = OperatorNode::And; }466 | ANDAND { $$ = new OperatorNode( OperatorNode::And ); } 470 467 ; 471 468 … … 480 477 unary_expression 481 478 | '(' type_name_no_function ')' cast_expression 482 { $$ = new CompositeExprNode 2( build_cast( new TypeValueNode( $2 ), $4 )); }479 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Cast ), new TypeValueNode( $2 ), $4 ); } 483 480 | '(' type_name_no_function ')' tuple 484 { $$ = new CompositeExprNode 2( build_cast( new TypeValueNode( $2 ), $4 )); }481 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Cast ), new TypeValueNode( $2 ), $4 ); } 485 482 ; 486 483 … … 488 485 cast_expression 489 486 | multiplicative_expression '*' cast_expression 490 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Mul, $1, $3 )); }487 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Mul ), $1, $3 ); } 491 488 | multiplicative_expression '/' cast_expression 492 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Div, $1, $3 )); }489 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Div ), $1, $3 ); } 493 490 | multiplicative_expression '%' cast_expression 494 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Mod, $1, $3 )); }491 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Mod ), $1, $3 ); } 495 492 ; 496 493 … … 498 495 multiplicative_expression 499 496 | additive_expression '+' multiplicative_expression 500 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Plus, $1, $3 )); }497 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Plus ), $1, $3 ); } 501 498 | additive_expression '-' multiplicative_expression 502 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Minus, $1, $3 )); }499 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Minus ), $1, $3 ); } 503 500 ; 504 501 … … 506 503 additive_expression 507 504 | shift_expression LS additive_expression 508 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::LShift, $1, $3 )); }505 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LShift ), $1, $3 ); } 509 506 | shift_expression RS additive_expression 510 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::RShift, $1, $3 )); }507 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::RShift ), $1, $3 ); } 511 508 ; 512 509 … … 514 511 shift_expression 515 512 | relational_expression '<' shift_expression 516 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::LThan, $1, $3 )); }513 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LThan ), $1, $3 ); } 517 514 | relational_expression '>' shift_expression 518 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::GThan, $1, $3 )); }515 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::GThan ), $1, $3 ); } 519 516 | relational_expression LE shift_expression 520 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::LEThan, $1, $3 )); }517 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::LEThan ), $1, $3 ); } 521 518 | relational_expression GE shift_expression 522 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::GEThan, $1, $3 )); }519 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::GEThan ), $1, $3 ); } 523 520 ; 524 521 … … 526 523 relational_expression 527 524 | equality_expression EQ relational_expression 528 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Eq, $1, $3 )); }525 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Eq ), $1, $3 ); } 529 526 | equality_expression NE relational_expression 530 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Neq, $1, $3 )); }527 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Neq ), $1, $3 ); } 531 528 ; 532 529 … … 534 531 equality_expression 535 532 | AND_expression '&' equality_expression 536 { $$ = new CompositeExprNode2( build_opr2( OperatorNode::BitAnd, $1, $3 )); }533 { $$ =new CompositeExprNode( new OperatorNode( OperatorNode::BitAnd ), $1, $3 ); } 537 534 ; 538 535 … … 540 537 AND_expression 541 538 | exclusive_OR_expression '^' AND_expression 542 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Xor, $1, $3 )); }539 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Xor ), $1, $3 ); } 543 540 ; 544 541 … … 546 543 exclusive_OR_expression 547 544 | inclusive_OR_expression '|' exclusive_OR_expression 548 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::BitOr, $1, $3 )); }545 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::BitOr ), $1, $3 ); } 549 546 ; 550 547 … … 552 549 inclusive_OR_expression 553 550 | logical_AND_expression ANDAND inclusive_OR_expression 554 { $$ = new CompositeExprNode 2( build_and_or( $1, $3, true )); }551 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::And ), $1, $3 ); } 555 552 ; 556 553 … … 558 555 logical_AND_expression 559 556 | logical_OR_expression OROR logical_AND_expression 560 { $$ = new CompositeExprNode 2( build_and_or( $1, $3, false )); }557 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Or ), $1, $3 ); } 561 558 ; 562 559 … … 564 561 logical_OR_expression 565 562 | logical_OR_expression '?' comma_expression ':' conditional_expression 566 { $$ = new CompositeExprNode 2( build_cond( $1, $3, $5) ); }563 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Cond ), (ExpressionNode *)mkList( (*$1, *$3, *$5 ) ) ); } 567 564 | logical_OR_expression '?' /* empty */ ':' conditional_expression // GCC, omitted first operand 568 { $$ =new CompositeExprNode( new OperatorNode( OperatorNode::NCond ), $1, $4 ); }565 { $$=new CompositeExprNode( new OperatorNode( OperatorNode::NCond ), $1, $4 ); } 569 566 | logical_OR_expression '?' comma_expression ':' tuple // CFA, tuple expression 570 { $$ = new CompositeExprNode 2( build_cond( $1, $3, $5) ); }567 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Cond ), (ExpressionNode *)mkList( (*$1, *$3, *$5 ) ) ); } 571 568 ; 572 569 … … 579 576 conditional_expression 580 577 | unary_expression '=' assignment_expression 581 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), $1, $3 ); }578 { $$ =new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), $1, $3 ); } 582 579 | unary_expression assignment_operator assignment_expression 583 { $$ = new CompositeExprNode( $2, $1, $3 ); }580 { $$ =new CompositeExprNode( $2, $1, $3 ); } 584 581 | tuple assignment_opt // CFA, tuple expression 585 582 { $$ = ( $2 == 0 ) ? $1 : new CompositeExprNode( new OperatorNode( OperatorNode::Assign ), $1, $2 ); } … … 627 624 assignment_expression 628 625 | comma_expression ',' assignment_expression // { $$ = (ExpressionNode *)$1->add_to_list( $3 ); } 629 //{ $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Comma ), $1, $3 ); } 630 { $$ = new CompositeExprNode2( build_comma( $1, $3 ) ); } 626 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Comma ), $1, $3 ); } 631 627 ; 632 628 … … 721 717 // *before* the transfer to the appropriate case clause by hoisting the declarations into a compound 722 718 // statement around the switch. Statements after the initial declaration list can never be executed, and 723 // therefore, are removed from the grammar even though C allows it. The change also applies to choose 724 // statement. 719 // therefore, are removed from the grammar even though C allows it. Change also applies to choose statement. 725 720 $$ = $7 != 0 ? new CompoundStmtNode( (StatementNode *)((new StatementNode( $7 ))->set_link( sw )) ) : sw; 726 721 } … … 740 735 constant_expression { $$ = $1; } 741 736 | constant_expression ELLIPSIS constant_expression // GCC, subrange 742 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Range, $1, $3 )); }737 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Range ), $1, $3 ); } 743 738 | subrange // CFA, subrange 744 739 ; 745 740 746 741 case_value_list: // CFA 747 case_value { $$ = new StatementNode( StatementNode::Case, $1, 0 ); }748 // convert case list, e.g., "case 1, 3, 5:" into "case 1: case 3: case 5"749 | case_value_list ',' case_value { $$ = (StatementNode *)($1->set_link( new StatementNode( StatementNode::Case, $3, 0 )) ); }742 case_value 743 | case_value_list ',' case_value 744 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::TupleC ), (ExpressionNode *)(tupleContents( $1 ))->set_link( $3 ) ); } 750 745 ; 751 746 752 747 case_label: // CFA 753 CASE case_value_list ':' { $$ = $2; }748 CASE case_value_list ':' { $$ = new StatementNode( StatementNode::Case, $2, 0 ); } 754 749 | DEFAULT ':' { $$ = new StatementNode( StatementNode::Default ); } 755 750 // A semantic check is required to ensure only one default clause per switch/choose statement. … … 1781 1776 { $$ = new DesignatorNode( $3, true ); } 1782 1777 | '[' push constant_expression ELLIPSIS constant_expression pop ']' // GCC, multiple array elements 1783 { $$ = new DesignatorNode( new CompositeExprNode 2( build_opr2( OperatorNode::Range, $3, $5 )), true ); }1778 { $$ = new DesignatorNode( new CompositeExprNode( new OperatorNode( OperatorNode::Range ), $3, $5 ), true ); } 1784 1779 | '.' '[' push field_list pop ']' // CFA, tuple field selector 1785 1780 { $$ = new DesignatorNode( $4 ); } … … 2110 2105 subrange: 2111 2106 constant_expression '~' constant_expression // CFA, integer subrange 2112 { $$ = new CompositeExprNode 2( build_opr2( OperatorNode::Range, $1, $3 )); }2107 { $$ = new CompositeExprNode( new OperatorNode( OperatorNode::Range ), $1, $3 ); } 2113 2108 ; 2114 2109 -
src/ResolvExpr/Resolver.cc
rc331406 r5070fe4 24 24 #include "SynTree/Initializer.h" 25 25 #include "SymTab/Indexer.h" 26 #include "SymTab/Autogen.h"27 26 #include "Common/utility.h" 28 27 #include "InitTweak/InitTweak.h" … … 42 41 43 42 virtual void visit( ArrayType * at ); 44 virtual void visit( PointerType * at );45 43 46 44 virtual void visit( ExprStmt *exprStmt ); … … 54 52 virtual void visit( BranchStmt *branchStmt ); 55 53 virtual void visit( ReturnStmt *returnStmt ); 54 virtual void visit( ImplicitCtorDtorStmt * impCtorDtorStmt ); 56 55 57 56 virtual void visit( SingleInit *singleInit ); … … 60 59 private: 61 60 typedef std::list< Initializer * >::iterator InitIterator; 62 63 template< typename PtrType >64 void handlePtrType( PtrType * type );65 61 66 62 void resolveAggrInit( AggregateDecl *, InitIterator &, InitIterator & ); … … 196 192 } 197 193 198 template< typename PtrType >199 void Resolver::handlePtrType( PtrType * type) {200 if ( type->get_dimension() ) {201 CastExpr *castExpr = new CastExpr( type->get_dimension(), SymTab::SizeType->clone() );194 void Resolver::visit( ArrayType * at ) { 195 if ( at->get_dimension() ) { 196 BasicType arrayLenType = BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ); 197 CastExpr *castExpr = new CastExpr( at->get_dimension(), arrayLenType.clone() ); 202 198 Expression *newExpr = findSingleExpression( castExpr, *this ); 203 delete type->get_dimension(); 204 type->set_dimension( newExpr ); 205 } 206 } 207 208 void Resolver::visit( ArrayType * at ) { 209 handlePtrType( at ); 199 delete at->get_dimension(); 200 at->set_dimension( newExpr ); 201 } 210 202 Visitor::visit( at ); 211 }212 213 void Resolver::visit( PointerType * pt ) {214 handlePtrType( pt );215 Visitor::visit( pt );216 203 } 217 204 … … 435 422 436 423 void Resolver::visit( ListInit * listInit ) { 437 InitIterator iter = listInit->begin ();438 InitIterator end = listInit->end ();424 InitIterator iter = listInit->begin_initializers(); 425 InitIterator end = listInit->end_initializers(); 439 426 440 427 if ( ArrayType * at = dynamic_cast< ArrayType * >( initContext ) ) { … … 534 521 // implicitly generated, there's no way for it to have side effects, so get rid of it 535 522 // to clean up generated code. 536 if ( InitTweak::isIn trinsicSingleArgCallStmt( ctorInit->get_ctor() ) ) {523 if ( InitTweak::isInstrinsicSingleArgCallStmt( ctorInit->get_ctor() ) ) { 537 524 delete ctorInit->get_ctor(); 538 525 ctorInit->set_ctor( NULL ); 539 526 } 540 541 // xxx - todo 542 // if ( InitTweak::isIntrinsicCallStmt( ctorInit->get_ctor() ) ) { 543 // // can reduce the constructor down to a SingleInit using the 544 // // second argument from the ctor call 545 // } 546 547 if ( InitTweak::isIntrinsicSingleArgCallStmt( ctorInit->get_dtor() ) ) { 527 if ( InitTweak::isInstrinsicSingleArgCallStmt( ctorInit->get_ctor() ) ) { 548 528 delete ctorInit->get_dtor(); 549 529 ctorInit->set_dtor( NULL ); 550 530 } 531 } 532 533 void Resolver::visit( ImplicitCtorDtorStmt * impCtorDtorStmt ) { 534 // before resolving ctor/dtor, need to remove type qualifiers from the first argument (the object being constructed). 535 // Do this through a cast expression to greatly simplify the code. 536 Expression * callExpr = InitTweak::getCtorDtorCall( impCtorDtorStmt ); 537 assert( callExpr ); 538 Expression *& constructee = InitTweak::getCallArg( callExpr, 0 ); 539 Type * type = 0; 540 541 // need to find the type of the first argument, which is unfortunately not uniform since array construction 542 // includes an untyped '+' expression. 543 if ( UntypedExpr * plusExpr = dynamic_cast< UntypedExpr * >( constructee ) ) { 544 // constructee is <array>+<index> 545 // get Variable <array>, then get the base type of the VariableExpr - this is the type that needs to be fixed 546 Expression * arr = InitTweak::getCallArg( plusExpr, 0 ); 547 assert( dynamic_cast< VariableExpr * >( arr ) || dynamic_cast< MemberExpr *>( arr ) ); 548 assert( arr && arr->get_results().size() == 1 ); 549 type = arr->get_results().front()->clone(); 550 } else { 551 // otherwise, constructing a plain object, which means the object's address is being taken. 552 // Need to get the type of the VariableExpr object, because the AddressExpr is rebuilt and uses the 553 // type of the VariableExpr to do so. 554 assert( constructee->get_results().size() == 1 ); 555 AddressExpr * addrExpr = dynamic_cast< AddressExpr * > ( constructee ); 556 assert( addrExpr && addrExpr->get_results().size() == 1 ); 557 type = addrExpr->get_results().front()->clone(); 558 } 559 // cast to T* with qualifiers removed. 560 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument 561 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever 562 // remove lvalue as a qualifier, this can change to 563 // type->get_qualifiers() = Type::Qualifiers(); 564 Type * base = InitTweak::getPointerBase( type ); 565 assert( base ); 566 base->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true, true); 567 // if pointer has lvalue qualifier, cast won't appear in output 568 type->set_isLvalue( false ); 569 constructee = new CastExpr( constructee, type ); 570 571 // finally, resolve the ctor/dtor 572 impCtorDtorStmt->get_callStmt()->accept( *this ); 551 573 } 552 574 } // namespace ResolvExpr -
src/SymTab/AddVisit.h
rc331406 r5070fe4 10 10 // Created On : Sun May 17 16:14:32 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:22:01201613 // Update Count : 912 // Last Modified On : Tue Jul 12 17:46:33 2016 13 // Update Count : 6 14 14 // 15 15 … … 33 33 template< typename Visitor > 34 34 inline void addVisit(SwitchStmt *switchStmt, Visitor &visitor) { 35 addVisitStatementList( switchStmt->get_ statements(), visitor );35 addVisitStatementList( switchStmt->get_branches(), visitor ); 36 36 maybeAccept( switchStmt->get_condition(), visitor ); 37 37 } -
src/SymTab/Autogen.cc
rc331406 r5070fe4 26 26 27 27 namespace SymTab { 28 Type * SizeType = 0;29 30 28 class AutogenerateRoutines : public Visitor { 31 29 public: … … 61 59 bool isUnnamedBitfield( ObjectDecl * obj ) { 62 60 return obj != NULL && obj->get_name() == "" && obj->get_bitfieldWidth() != NULL; 61 } 62 63 template< typename OutputIterator > 64 void makeScalarFunction( Expression *src, ObjectDecl *dstParam, DeclarationWithType *member, std::string fname, OutputIterator out ) { 65 ObjectDecl *obj = dynamic_cast<ObjectDecl *>( member ); 66 // unnamed bit fields are not copied as they cannot be accessed 67 if ( isUnnamedBitfield( obj ) ) return; 68 69 // want to be able to generate assignment, ctor, and dtor generically, 70 // so fname is either ?=?, ?{}, or ^?{} 71 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) ); 72 73 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) ); 74 derefExpr->get_args().push_back( new VariableExpr( dstParam ) ); 75 76 // do something special for unnamed members 77 Expression *dstselect = new AddressExpr( new MemberExpr( member, derefExpr ) ); 78 fExpr->get_args().push_back( dstselect ); 79 80 if ( src ) { 81 fExpr->get_args().push_back( src ); 82 } 83 84 Statement * callStmt = new ExprStmt( noLabels, fExpr ); 85 if ( (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) ) ) { 86 // implicitly generated ctor/dtor calls should be wrapped 87 // so that later passes are aware they were generated. 88 // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield, 89 // because this causes the address to be taken at codegen, which is illegal in C. 90 callStmt = new ImplicitCtorDtorStmt( callStmt ); 91 } 92 *out++ = callStmt; 63 93 } 64 94 … … 189 219 } 190 220 191 InitTweak::InitExpander srcParam( src );192 193 221 // assign to destination (and return value if generic) 194 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) ); 195 derefExpr->get_args().push_back( new VariableExpr( dstParam ) ); 196 Expression *dstselect = new MemberExpr( field, derefExpr ); 197 genImplicitCall( srcParam, dstselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward ); 198 199 if ( isDynamicLayout && returnVal ) { 200 UntypedExpr *derefRet = new UntypedExpr( new NameExpr( "*?" ) ); 201 derefRet->get_args().push_back( new VariableExpr( returnVal ) ); 202 Expression *retselect = new MemberExpr( field, derefRet ); 203 genImplicitCall( srcParam, retselect, func->get_name(), back_inserter( func->get_statements()->get_kids() ), field, forward ); 222 if ( ArrayType *array = dynamic_cast< ArrayType * >( field->get_type() ) ) { 223 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) ); 224 derefExpr->get_args().push_back( new VariableExpr( dstParam ) ); 225 Expression *dstselect = new MemberExpr( field, derefExpr ); 226 227 makeArrayFunction( src, dstselect, array, func->get_name(), back_inserter( func->get_statements()->get_kids() ), forward ); 228 if ( isDynamicLayout && returnVal ) { 229 UntypedExpr *derefRet = new UntypedExpr( new NameExpr( "*?" ) ); 230 derefRet->get_args().push_back( new VariableExpr( returnVal ) ); 231 Expression *retselect = new MemberExpr( field, derefRet ); 232 233 makeArrayFunction( src, retselect, array, func->get_name(), back_inserter( func->get_statements()->get_kids() ), forward ); 234 } 235 } else { 236 makeScalarFunction( src, dstParam, field, func->get_name(), back_inserter( func->get_statements()->get_kids() ) ); 237 if ( isDynamicLayout && returnVal ) makeScalarFunction( src, returnVal, field, func->get_name(), back_inserter( func->get_statements()->get_kids() ) ); 204 238 } // if 205 239 } -
src/SymTab/Autogen.h
rc331406 r5070fe4 22 22 #include "SynTree/Declaration.h" 23 23 #include "SynTree/Initializer.h" 24 #include "InitTweak/InitTweak.h"25 24 26 25 namespace SymTab { 27 /// Generates assignment operators, constructors, and destructor for aggregate types as required28 void autogenerateRoutines( std::list< Declaration * > &translationUnit );26 /// Generates assignment operators, constructors, and destructor for aggregate types as required 27 void autogenerateRoutines( std::list< Declaration * > &translationUnit ); 29 28 30 /// returns true if obj's name is the empty string and it has a bitfield width 31 bool isUnnamedBitfield( ObjectDecl * obj ); 29 // originally makeArrayAssignment - changed to Function because it is now used for ctors and dtors as well 30 // admittedly not a great name change. This used to live in Validate.cc, but has been moved so it can be reused elsewhere 32 31 33 /// size_t type - set when size_t typedef is seen. Useful in a few places, 34 /// such as in determining array dimension type 35 extern Type * SizeType; 32 /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments. 33 /// If forward is true, loop goes from 0 to N-1, else N-1 to 0 34 template< typename OutputIterator > 35 void makeArrayFunction( Expression *srcParam, Expression *dstParam, ArrayType *array, std::string fname, OutputIterator out, bool forward = true ) { 36 static UniqueName indexName( "_index" ); 36 37 37 /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. 38 template< typename OutputIterator > 39 Statement * genCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false, bool forward = true ); 38 // for a flexible array member nothing is done -- user must define own assignment 39 if ( ! array->get_dimension() ) return; 40 40 41 /// inserts into out a generated call expression to function fname with arguments dstParam and srcParam. Should only be called with non-array types. 42 /// optionally returns a statement which must be inserted prior to the containing loop, if there is one 43 template< typename OutputIterator > 44 Statement * genScalarCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false ) { 45 // want to be able to generate assignment, ctor, and dtor generically, 46 // so fname is either ?=?, ?{}, or ^?{} 47 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) ); 41 Expression * begin, * end, * update, * cmp; 42 if ( forward ) { 43 // generate: for ( int i = 0; i < 0; ++i ) 44 begin = new NameExpr( "0" ); 45 end = array->get_dimension()->clone(); 46 cmp = new NameExpr( "?<?" ); 47 update = new NameExpr( "++?" ); 48 } else { 49 // generate: for ( int i = N-1; i >= 0; --i ) 50 begin = new UntypedExpr( new NameExpr( "?-?" ) ); 51 ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() ); 52 ((UntypedExpr*)begin)->get_args().push_back( new NameExpr( "1" ) ); 53 end = new NameExpr( "0" ); 54 cmp = new NameExpr( "?>=?" ); 55 update = new NameExpr( "--?" ); 56 } 48 57 49 // do something special for unnamed members 50 dstParam = new AddressExpr( dstParam ); 51 if ( addCast ) { 52 // cast to T* with qualifiers removed, so that qualified objects can be constructed 53 // and destructed with the same functions as non-qualified objects. 54 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument 55 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever 56 // remove lvalue as a qualifier, this can change to 57 // type->get_qualifiers() = Type::Qualifiers(); 58 assert( type ); 59 Type * castType = type->clone(); 60 castType->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true, true); 61 castType->set_isLvalue( true ); // xxx - might not need this 62 dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) ); 63 } 64 fExpr->get_args().push_back( dstParam ); 58 ObjectDecl *index = new ObjectDecl( indexName.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), NULL ); 65 59 66 Statement * listInit = srcParam.buildListInit( fExpr ); 60 UntypedExpr *init = new UntypedExpr( new NameExpr( "?=?" ) ); 61 init->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) ); 62 init->get_args().push_back( begin ); 63 index->set_init( new SingleInit( init, std::list<Expression*>() ) ); 67 64 68 std::list< Expression * > args = *++srcParam; 69 fExpr->get_args().splice( fExpr->get_args().end(), args ); 65 UntypedExpr *cond = new UntypedExpr( cmp ); 66 cond->get_args().push_back( new VariableExpr( index ) ); 67 cond->get_args().push_back( end ); 70 68 71 *out++ = new ExprStmt( noLabels, fExpr ); 69 UntypedExpr *inc = new UntypedExpr( update ); 70 inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) ); 72 71 73 srcParam.clearArrayIndices(); 72 // want to be able to generate assignment, ctor, and dtor generically, 73 // so fname is either ?=?, ?{}, or ^?{} 74 UntypedExpr *fExpr = new UntypedExpr( new NameExpr( fname ) ); 74 75 75 return listInit; 76 } 76 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?+?" ) ); 77 dstIndex->get_args().push_back( dstParam ); 78 dstIndex->get_args().push_back( new VariableExpr( index ) ); 79 fExpr->get_args().push_back( dstIndex ); 77 80 78 /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments. 79 /// If forward is true, loop goes from 0 to N-1, else N-1 to 0 80 template< typename OutputIterator > 81 void genArrayCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, ArrayType *array, bool addCast = false, bool forward = true ) { 82 static UniqueName indexName( "_index" ); 81 // srcParam is NULL for default ctor/dtor 82 if ( srcParam ) { 83 UntypedExpr *srcIndex = new UntypedExpr( new NameExpr( "?[?]" ) ); 84 srcIndex->get_args().push_back( srcParam ); 85 srcIndex->get_args().push_back( new VariableExpr( index ) ); 86 fExpr->get_args().push_back( srcIndex ); 87 } 83 88 84 // for a flexible array member nothing is done -- user must define own assignment 85 if ( ! array->get_dimension() ) return ; 89 std::list<Statement *> initList; 90 CompoundStmt * block = new CompoundStmt( noLabels ); 91 block->get_kids().push_back( new DeclStmt( noLabels, index ) ); 92 block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, new ExprStmt( noLabels, fExpr ) ) ); 86 93 87 Expression * begin, * end, * update, * cmp; 88 if ( forward ) { 89 // generate: for ( int i = 0; i < 0; ++i ) 90 begin = new NameExpr( "0" ); 91 end = array->get_dimension()->clone(); 92 cmp = new NameExpr( "?<?" ); 93 update = new NameExpr( "++?" ); 94 } else { 95 // generate: for ( int i = N-1; i >= 0; --i ) 96 begin = new UntypedExpr( new NameExpr( "?-?" ) ); 97 ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() ); 98 ((UntypedExpr*)begin)->get_args().push_back( new NameExpr( "1" ) ); 99 end = new NameExpr( "0" ); 100 cmp = new NameExpr( "?>=?" ); 101 update = new NameExpr( "--?" ); 102 } 103 104 ObjectDecl *index = new ObjectDecl( indexName.newName(), DeclarationNode::NoStorageClass, LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), NULL ); 105 106 UntypedExpr *init = new UntypedExpr( new NameExpr( "?=?" ) ); 107 init->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) ); 108 init->get_args().push_back( begin ); 109 index->set_init( new SingleInit( init, std::list<Expression*>() ) ); 110 111 UntypedExpr *cond = new UntypedExpr( cmp ); 112 cond->get_args().push_back( new VariableExpr( index ) ); 113 cond->get_args().push_back( end ); 114 115 UntypedExpr *inc = new UntypedExpr( update ); 116 inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) ); 117 118 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) ); 119 dstIndex->get_args().push_back( dstParam ); 120 dstIndex->get_args().push_back( new VariableExpr( index ) ); 121 dstParam = dstIndex; 122 123 // srcParam must keep track of the array indices to build the 124 // source parameter and/or array list initializer 125 srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone() ); 126 127 // for stmt's body, eventually containing call 128 CompoundStmt * body = new CompoundStmt( noLabels ); 129 Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward ); 130 131 // block containing for stmt and index variable 132 std::list<Statement *> initList; 133 CompoundStmt * block = new CompoundStmt( noLabels ); 134 block->get_kids().push_back( new DeclStmt( noLabels, index ) ); 135 if ( listInit ) block->get_kids().push_back( listInit ); 136 block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) ); 137 138 *out++ = block; 139 } 140 141 template< typename OutputIterator > 142 Statement * genCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) { 143 if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) { 144 genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward ); 145 return 0; 146 } else { 147 return genScalarCall( srcParam, dstParam, fname, out, type, addCast ); 148 } 149 } 150 151 /// inserts into out a generated call expression to function fname with arguments dstParam 152 /// and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. decl is the 153 /// object being constructed. The function wraps constructor and destructor calls in an 154 /// ImplicitCtorDtorStmt node. 155 template< typename OutputIterator > 156 void genImplicitCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) { 157 ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl ); 158 assert( obj ); 159 // unnamed bit fields are not copied as they cannot be accessed 160 if ( isUnnamedBitfield( obj ) ) return; 161 162 bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) ); 163 std::list< Statement * > stmts; 164 genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward ); 165 166 // currently genCall should produce at most one element, but if that changes then the next line needs to be updated to grab the statement which contains the call 167 assert( stmts.size() <= 1 ); 168 if ( stmts.size() == 1 ) { 169 Statement * callStmt = stmts.front(); 170 if ( addCast ) { 171 // implicitly generated ctor/dtor calls should be wrapped 172 // so that later passes are aware they were generated. 173 // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield, 174 // because this causes the address to be taken at codegen, which is illegal in C. 175 callStmt = new ImplicitCtorDtorStmt( callStmt ); 176 } 177 *out++ = callStmt; 178 } 179 } 94 Statement * stmt = block; 95 if ( fname == "?{}" || fname == "^?{}" ) { 96 // implicitly generated ctor/dtor calls should be wrapped 97 // so that later passes are aware they were generated 98 stmt = new ImplicitCtorDtorStmt( stmt ); 99 } 100 *out++ = stmt; 101 } 180 102 } // namespace SymTab 181 103 #endif // AUTOGEN_H -
src/SymTab/FixFunction.cc
rc331406 r5070fe4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // FixFunction.cc -- 7 // FixFunction.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 44 44 45 45 Type * FixFunction::mutate(ArrayType *arrayType) { 46 // need to recursively mutate the base type in order for multi-dimensional arrays to work. 47 PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->get_base()->clone()->acceptMutator( *this ), maybeClone( arrayType->get_dimension() ), arrayType->get_isVarLen(), arrayType->get_isStatic() ); 46 PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), maybeClone( arrayType->get_base()->clone() ), maybeClone( arrayType->get_dimension() ), arrayType->get_isVarLen(), arrayType->get_isStatic() ); 48 47 delete arrayType; 49 48 return pointerType; -
src/SymTab/Validate.cc
rc331406 r5070fe4 174 174 175 175 virtual void visit( FunctionDecl *funcDecl ); 176 };176 }; 177 177 178 178 class CompoundLiteral : public GenPoly::DeclMutator { … … 191 191 EliminateTypedef::eliminateTypedef( translationUnit ); 192 192 HoistStruct::hoistStruct( translationUnit ); 193 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs Pass1194 193 acceptAll( translationUnit, pass1 ); 195 194 acceptAll( translationUnit, pass2 ); 196 195 ReturnChecker::checkFunctionReturns( translationUnit ); 197 compoundliteral.mutateDeclarationList( translationUnit ); 196 mutateAll( translationUnit, compoundliteral ); 197 autogenerateRoutines( translationUnit ); 198 198 acceptAll( translationUnit, pass3 ); 199 199 VerifyCtorDtor::verify( translationUnit ); … … 490 490 EliminateTypedef eliminator; 491 491 mutateAll( translationUnit, eliminator ); 492 if ( eliminator.typedefNames.count( "size_t" ) ) {493 // grab and remember declaration of size_t494 SizeType = eliminator.typedefNames["size_t"].first->get_base()->clone();495 } else {496 // xxx - missing global typedef for size_t - default to long unsigned int, even though that may be wrong497 // eventually should have a warning for this case.498 SizeType = new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt );499 }500 492 filter( translationUnit, isTypedef, true ); 501 502 493 } 503 494 … … 527 518 Declaration *EliminateTypedef::mutate( TypedefDecl * tyDecl ) { 528 519 Declaration *ret = Mutator::mutate( tyDecl ); 529 530 520 if ( typedefNames.count( tyDecl->get_name() ) == 1 && typedefNames[ tyDecl->get_name() ].second == scopeLevel ) { 531 521 // typedef to the same name from the same scope -
src/SynTree/AddStmtVisitor.cc
rc331406 r5070fe4 10 10 // Created On : Wed Jun 22 12:11:17 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:23:47201613 // Update Count : 1 612 // Last Modified On : Tue Jul 12 17:49:59 2016 13 // Update Count : 12 14 14 // 15 15 … … 71 71 72 72 void AddStmtVisitor::visit(SwitchStmt *switchStmt) { 73 visitStatementList( switchStmt->get_ statements() );73 visitStatementList( switchStmt->get_branches() ); 74 74 maybeAccept( switchStmt->get_condition(), *this ); 75 75 } -
src/SynTree/Declaration.cc
rc331406 r5070fe4 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Declaration.cc -- 7 // Declaration.cc -- 8 8 // 9 9 // Author : Richard C. Bilson … … 20 20 #include "Initializer.h" 21 21 #include "Type.h" 22 #include "Attribute.h"23 22 #include "Common/utility.h" 24 23 -
src/SynTree/Declaration.h
rc331406 r5070fe4 64 64 class DeclarationWithType : public Declaration { 65 65 public: 66 DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage , const std::list< Attribute * > & attributes);66 DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage ); 67 67 DeclarationWithType( const DeclarationWithType &other ); 68 68 virtual ~DeclarationWithType(); … … 75 75 int get_scopeLevel() const { return scopeLevel; } 76 76 void set_scopeLevel( int newValue ) { scopeLevel = newValue; } 77 78 std::list< Attribute * >& get_attributes() { return attributes; }79 const std::list< Attribute * >& get_attributes() const { return attributes; }80 77 81 78 virtual DeclarationWithType *clone() const = 0; … … 90 87 // shadowed identifiers can be accessed 91 88 int scopeLevel = 0; 92 93 std::list< Attribute * > attributes;94 89 }; 95 90 … … 97 92 typedef DeclarationWithType Parent; 98 93 public: 99 ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes = std::list< Attribute * >(),bool isInline = false, bool isNoreturn = false );94 ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline = false, bool isNoreturn = false ); 100 95 ObjectDecl( const ObjectDecl &other ); 101 96 virtual ~ObjectDecl(); … … 136 131 std::list< std::string >& get_oldIdents() { return oldIdents; } 137 132 std::list< Declaration* >& get_oldDecls() { return oldDecls; } 133 std::list< Attribute * >& get_attributes() { return attributes; } 138 134 139 135 virtual FunctionDecl *clone() const { return new FunctionDecl( *this ); } … … 147 143 std::list< std::string > oldIdents; 148 144 std::list< Declaration* > oldDecls; 145 std::list< Attribute * > attributes; 149 146 }; 150 147 -
src/SynTree/DeclarationWithType.cc
rc331406 r5070fe4 16 16 #include "Declaration.h" 17 17 #include "Type.h" 18 #include "Attribute.h"19 18 #include "Common/utility.h" 20 19 21 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage , const std::list< Attribute * > & attributes)22 : Declaration( name, sc, linkage ) , attributes( attributes ){20 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage ) 21 : Declaration( name, sc, linkage ) { 23 22 } 24 23 25 24 DeclarationWithType::DeclarationWithType( const DeclarationWithType &other ) 26 25 : Declaration( other ), mangleName( other.mangleName ), scopeLevel( other.scopeLevel ) { 27 cloneAll( other.attributes, attributes );28 26 } 29 27 30 28 DeclarationWithType::~DeclarationWithType() { 31 deleteAll( attributes );32 29 } 33 30 -
src/SynTree/Expression.cc
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 3 17:06:51201613 // Update Count : 4 512 // Last Modified On : Mon Jun 13 16:03:39 2016 13 // Update Count : 42 14 14 // 15 15 … … 344 344 } 345 345 346 //// is this right? It's cloning the member, but the member is a declaration so probably shouldn't be cloned...347 346 MemberExpr::MemberExpr( const MemberExpr &other ) : 348 Expression( other ), member( other.member), aggregate( maybeClone( other.aggregate ) ) {347 Expression( other ), member( maybeClone( other.member ) ), aggregate( maybeClone( other.aggregate ) ) { 349 348 } 350 349 351 350 MemberExpr::~MemberExpr() { 352 //delete member;351 delete member; 353 352 delete aggregate; 354 353 } … … 529 528 } 530 529 531 RangeExpr::RangeExpr( ConstantExpr *low, ConstantExpr *high ) : low( low ), high( high ) {}532 RangeExpr::RangeExpr( const RangeExpr &other ) : low( other.low->clone() ), high( other.high->clone() ) {}533 void RangeExpr::print( std::ostream &os, int indent ) const {534 os << std::string( indent, ' ' ) << "Range Expression: ";535 low->print( os, indent );536 os << " ... ";537 high->print( os, indent );538 }539 530 540 531 std::ostream & operator<<( std::ostream & out, Expression * expr ) { -
src/SynTree/Expression.h
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 3 17:08:44201613 // Update Count : 2 712 // Last Modified On : Mon Jul 4 14:45:32 2016 13 // Update Count : 23 14 14 // 15 15 … … 18 18 19 19 #include <map> 20 #include <memory>21 20 #include "SynTree.h" 22 21 #include "Visitor.h" … … 635 634 }; 636 635 637 class RangeExpr : public Expression {638 public:639 RangeExpr( ConstantExpr *low, ConstantExpr *high );640 RangeExpr( const RangeExpr &other );641 642 ConstantExpr * get_low() const { return low.get(); }643 ConstantExpr * get_high() const { return high.get(); }644 RangeExpr * set_low( ConstantExpr *low ) { RangeExpr::low.reset( low ); return this; }645 RangeExpr * set_high( ConstantExpr *high ) { RangeExpr::high.reset( high ); return this; }646 647 virtual RangeExpr *clone() const { return new RangeExpr( *this ); }648 virtual void accept( Visitor &v ) { v.visit( this ); }649 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); }650 virtual void print( std::ostream &os, int indent = 0 ) const;651 private:652 std::unique_ptr<ConstantExpr> low, high;653 };654 655 636 std::ostream & operator<<( std::ostream & out, Expression * expr ); 656 637 -
src/SynTree/FunctionDecl.cc
rc331406 r5070fe4 23 23 24 24 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn, std::list< Attribute * > attributes ) 25 : Parent( name, sc, linkage , attributes ), type( type ), statements( statements ) {25 : Parent( name, sc, linkage ), type( type ), statements( statements ), attributes( attributes ) { 26 26 set_isInline( isInline ); 27 27 set_isNoreturn( isNoreturn ); … … 34 34 FunctionDecl::FunctionDecl( const FunctionDecl &other ) 35 35 : Parent( other ), type( maybeClone( other.type ) ), statements( maybeClone( other.statements ) ) { 36 cloneAll( other.attributes, attributes ); 36 37 } 37 38 … … 39 40 delete type; 40 41 delete statements; 42 deleteAll( attributes ); 41 43 } 42 44 … … 67 69 } // if 68 70 69 printAll( get_attributes(), os, indent );71 printAll( attributes, os, indent ); 70 72 71 73 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { -
src/SynTree/Initializer.h
rc331406 r5070fe4 93 93 std::list<Initializer*> &get_initializers() { return initializers; } 94 94 95 typedef std::list<Initializer*>::iterator iterator; 96 iterator begin() { return initializers.begin(); } 97 iterator end() { return initializers.end(); } 95 std::list<Initializer*>::iterator begin_initializers() { return initializers.begin(); } 96 std::list<Initializer*>::iterator end_initializers() { return initializers.end(); } 98 97 99 98 virtual ListInit *clone() const { return new ListInit( *this ); } -
src/SynTree/Label.h
rc331406 r5070fe4 24 24 class Label { 25 25 public: 26 Label( const std::string & name = "", Statement * labelled = 0 , const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : name( name ), labelled( labelled ), attributes( attributes) {}26 Label( const std::string & name = "", Statement * labelled = 0 ) : name( name ), labelled( labelled ) {} 27 27 Label( const char * name, Statement * labelled = 0 ) : name( name ), labelled( labelled ) {} 28 28 -
src/SynTree/Mutator.cc
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:23:21201613 // Update Count : 1 912 // Last Modified On : Tue Jul 12 17:51:19 2016 13 // Update Count : 17 14 14 // 15 15 … … 126 126 Statement *Mutator::mutate( SwitchStmt *switchStmt ) { 127 127 switchStmt->set_condition( maybeMutate( switchStmt->get_condition(), *this ) ); 128 mutateAll( switchStmt->get_ statements(), *this );128 mutateAll( switchStmt->get_branches(), *this ); 129 129 return switchStmt; 130 130 } … … 349 349 compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) ); 350 350 return compLitExpr; 351 }352 353 Expression *Mutator::mutate( RangeExpr *rangeExpr ) {354 rangeExpr->set_low( maybeMutate( rangeExpr->get_low(), *this ) );355 rangeExpr->set_high( maybeMutate( rangeExpr->get_high(), *this ) );356 return rangeExpr;357 351 } 358 352 -
src/SynTree/Mutator.h
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 3 16:59:45201613 // Update Count : 1 212 // Last Modified On : Tue Jul 12 17:51:43 2016 13 // Update Count : 11 14 14 // 15 15 #include <cassert> … … 78 78 virtual Expression* mutate( UntypedValofExpr *valofExpr ); 79 79 virtual Expression* mutate( CompoundLiteralExpr *compLitExpr ); 80 virtual Expression* mutate( RangeExpr *rangeExpr );81 80 82 81 virtual Type* mutate( VoidType *basicType ); -
src/SynTree/ObjectDecl.cc
rc331406 r5070fe4 18 18 #include "Initializer.h" 19 19 #include "Expression.h" 20 #include "Attribute.h"21 20 #include "Common/utility.h" 22 21 #include "Statement.h" 23 22 24 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, const std::list< Attribute * > attributes,bool isInline, bool isNoreturn )25 : Parent( name, sc, linkage , attributes), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) {23 ObjectDecl::ObjectDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, Expression *bitfieldWidth, Type *type, Initializer *init, bool isInline, bool isNoreturn ) 24 : Parent( name, sc, linkage ), type( type ), init( init ), bitfieldWidth( bitfieldWidth ) { 26 25 set_isInline( isInline ); 27 26 set_isNoreturn( isNoreturn ); … … 46 45 os << LinkageSpec::toString( get_linkage() ) << " "; 47 46 } // if 48 49 printAll( get_attributes(), os, indent );50 47 51 48 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { … … 83 80 } // if 84 81 85 // xxx - should printShort print attributes?86 87 82 if ( get_storageClass() != DeclarationNode::NoStorageClass ) { 88 83 os << DeclarationNode::storageName[ get_storageClass() ] << ' '; -
src/SynTree/Statement.cc
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:25:20201613 // Update Count : 6112 // Last Modified On : Tue Jul 12 17:52:32 2016 13 // Update Count : 55 14 14 // 15 15 … … 143 143 } 144 144 145 SwitchStmt::SwitchStmt( std::list<Label> _labels, Expression * _condition, std::list<Statement *> &_ statements ):146 Statement( _labels ), condition( _condition ), statements( _statements ) {145 SwitchStmt::SwitchStmt( std::list<Label> _labels, Expression * _condition, std::list<Statement *> &_branches ): 146 Statement( _labels ), condition( _condition ), branches( _branches ) { 147 147 } 148 148 149 149 SwitchStmt::SwitchStmt( const SwitchStmt & other ): 150 150 Statement( other ), condition( maybeClone( other.condition ) ) { 151 cloneAll( other. statements, statements );151 cloneAll( other.branches, branches ); 152 152 } 153 153 154 154 SwitchStmt::~SwitchStmt() { 155 155 delete condition; 156 // destroy statements 157 } 156 // destroy branches 157 } 158 159 void SwitchStmt::add_case( CaseStmt *c ) {} 158 160 159 161 void SwitchStmt::print( std::ostream &os, int indent ) const { … … 162 164 os << endl; 163 165 164 // statements166 // branches 165 167 std::list<Statement *>::const_iterator i; 166 for ( i = statements.begin(); i != statements.end(); i++)168 for ( i = branches.begin(); i != branches.end(); i++) 167 169 (*i)->print( os, indent + 4 ); 168 170 169 //for_each( statements.begin(), statements.end(), mem_fun( bind1st(&Statement::print ), os ));171 //for_each( branches.begin(), branches.end(), mem_fun( bind1st(&Statement::print ), os )); 170 172 } 171 173 … … 185 187 } 186 188 187 CaseStmt * CaseStmt::makeDefault( std::list<Label> labels, std::list<Statement *> stmts ) {188 return new CaseStmt( labels, 0, stmts, true );189 CaseStmt * CaseStmt::makeDefault( std::list<Label> labels, std::list<Statement *> branches ) { 190 return new CaseStmt( labels, 0, branches, true ); 189 191 } 190 192 -
src/SynTree/Statement.h
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:26:02201613 // Update Count : 6412 // Last Modified On : Tue Jul 12 17:53:29 2016 13 // Update Count : 47 14 14 // 15 15 … … 129 129 class SwitchStmt : public Statement { 130 130 public: 131 SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> & statements );131 SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &branches ); 132 132 SwitchStmt( const SwitchStmt &other ); 133 133 virtual ~SwitchStmt(); … … 136 136 void set_condition( Expression *newValue ) { condition = newValue; } 137 137 138 std::list<Statement *> & get_statements() { return statements; } 138 std::list<Statement *> & get_branches() { return branches; } 139 void add_case( CaseStmt * ); 139 140 140 141 virtual void accept( Visitor &v ) { v.visit( this ); } … … 145 146 private: 146 147 Expression * condition; 147 std::list<Statement *> statements;148 std::list<Statement *> branches; // should be list of CaseStmt 148 149 }; 149 150 150 151 class CaseStmt : public Statement { 151 152 public: 152 CaseStmt( std::list<Label> labels, Expression *conditions, std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError); 153 CaseStmt( std::list<Label> labels, Expression *conditions, 154 std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError); 153 155 CaseStmt( const CaseStmt &other ); 154 156 virtual ~CaseStmt(); 155 157 156 static CaseStmt * makeDefault( std::list<Label> labels = std::list<Label>(), std::list<Statement *> stmts = std::list<Statement *>() ); 158 static CaseStmt * makeDefault( std::list<Label> labels = std::list<Label>(), 159 std::list<Statement *> stmts = std::list<Statement *>() ); 157 160 158 161 bool isDefault() const { return _isDefault; } -
src/SynTree/SynTree.h
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 3 17:02:34201613 // Update Count : 712 // Last Modified On : Tue Jul 12 17:54:02 2016 13 // Update Count : 6 14 14 // 15 15 … … 83 83 class UntypedValofExpr; 84 84 class CompoundLiteralExpr; 85 class RangeExpr;86 85 87 86 class Type; -
src/SynTree/Visitor.cc
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Aug 4 11:24:25201613 // Update Count : 2112 // Last Modified On : Tue Jul 12 17:54:39 2016 13 // Update Count : 19 14 14 // 15 15 … … 109 109 void Visitor::visit( SwitchStmt *switchStmt ) { 110 110 maybeAccept( switchStmt->get_condition(), *this ); 111 acceptAll( switchStmt->get_ statements(), *this );111 acceptAll( switchStmt->get_branches(), *this ); 112 112 } 113 113 … … 296 296 maybeAccept( compLitExpr->get_type(), *this ); 297 297 maybeAccept( compLitExpr->get_initializer(), *this ); 298 }299 300 void Visitor::visit( RangeExpr *rangeExpr ) {301 maybeAccept( rangeExpr->get_low(), *this );302 maybeAccept( rangeExpr->get_high(), *this );303 298 } 304 299 -
src/SynTree/Visitor.h
rc331406 r5070fe4 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 3 17:01:50201613 // Update Count : 912 // Last Modified On : Tue Jul 12 17:55:09 2016 13 // Update Count : 8 14 14 // 15 15 … … 78 78 virtual void visit( UntypedValofExpr *valofExpr ); 79 79 virtual void visit( CompoundLiteralExpr *compLitExpr ); 80 virtual void visit( RangeExpr *rangeExpr );81 80 82 81 virtual void visit( VoidType *basicType ); -
src/examples/gc_no_raii/bug-repro/return_template.c
rc331406 r5070fe4 5 5 }; 6 6 7 forall(otype T) void ?{}(wrap(T)* this);8 forall(otype T) void ?{}(wrap(T)* this, wrap(T)* rhs);9 forall(otype T) void ^?{}(wrap(T)* this);10 forall(otype T) void ?=?(wrap(T)* this, wrap(T)* rhs);11 12 7 forall(otype T) 13 wrap(T) test()8 static inline wrap(T) test() 14 9 { 15 10 wrap(T) tester; -
src/examples/gc_no_raii/src/gc.h
rc331406 r5070fe4 7 7 static inline gcpointer(T) gcmalloc() 8 8 { 9 gcpointer(T) ptr; 10 void* address = gc_allocate(sizeof(T)); 11 (&ptr){ address }; 12 ctor(&ptr, address); 13 gc_conditional_collect(); 14 return ptr; 9 gcpointer(T) test; 10 // ctor(&test, gc_allocate(sizeof(T))); 11 // gc_conditional_collect(); 12 return test; 15 13 } -
src/examples/gc_no_raii/src/gcpointers.c
rc331406 r5070fe4 1 1 #include "gcpointers.h" 2 2 3 //#include "gc.h"3 #include "gc.h" 4 4 #include "internal/collector.h" 5 5 #include "internal/object_header.h" -
src/examples/gc_no_raii/src/gcpointers.h
rc331406 r5070fe4 10 10 }; 11 11 12 void ?{}(gcpointer_t* this);13 void ?{}(gcpointer_t* this, void* address);14 void ?{}(gcpointer_t* this, gcpointer_tother);15 void ^?{}(gcpointer_t* this);16 gcpointer_t* ?=?(gcpointer_t this, gcpointer_trhs);12 void gcpointer_ctor(gcpointer_t* this); 13 void gcpointer_ctor(gcpointer_t* this, void* address); 14 void gcpointer_ctor(gcpointer_t* this, gcpointer_t* other); 15 void gcpointer_dtor(gcpointer_t* this); 16 gcpointer_t* gcpointer_assign(gcpointer_t* this, gcpointer_t* rhs); 17 17 18 18 //Logical operators … … 27 27 }; 28 28 29 // 30 forall(otype T) void ?{}(gcpointer(T)* this); 31 forall(otype T) void ?{}(gcpointer(T)* this, void* address); 32 forall(otype T) void ctor(gcpointer(T)* this, void* address); 33 forall(otype T) void ?{}(gcpointer(T)* this, gcpointer(T)* other); 34 forall(otype T) void ^?{}(gcpointer(T)* this); 35 forall(otype T) gcpointer(T) ?=?(gcpointer(T) this, gcpointer(T) rhs); 29 forall(otype T) 30 static inline void ctor(gcpointer(T)* this) 31 { 32 gcpointer_ctor(&this->internal); 33 } 36 34 35 // forall(otype T) 36 // static inline void ctor(gcpointer(T)* this, int null) 37 // { 38 // gcpointer_ctor(&this->internal, NULL); 39 // } 37 40 38 forall(otype T) T *?(gcpointer(T) this); 41 forall(otype T) 42 static inline void ctor(gcpointer(T)* this, void* address) 43 { 44 gcpointer_ctor(&this->internal, address); 45 } 46 47 forall(otype T) 48 static inline void ctor(gcpointer(T)* this, gcpointer(T)* other) 49 { 50 gcpointer_ctor(&this->internal, other); 51 } 52 53 forall(otype T) 54 static inline void dtor(gcpointer(T)* this) 55 { 56 gcpointer_dtor(&this->internal); 57 } 58 59 forall(otype T) 60 static inline gcpointer(T)* ?=?(gcpointer(T)* this, gcpointer(T)* rhs) 61 { 62 gcpointer_assign(&this->internal, &rhs->internal); 63 return this; 64 } 65 66 forall(otype T) 67 static inline T *?(gcpointer(T) this) 68 { 69 return *(T*)this.internal.ptr; 70 } 39 71 40 72 //Logical operators 41 forall(otype T) int ?!=?(gcpointer(T) this, gcpointer(T) rhs); 42 forall(otype T) int ?==?(gcpointer(T) this, gcpointer(T) rhs); 73 forall(otype T) 74 static inline int ?!=?(gcpointer(T) this, gcpointer(T) rhs) 75 { 76 return this.internal.ptr != rhs.internal.ptr; 77 } 78 79 forall(otype T) 80 static inline int ?==?(gcpointer(T) this, gcpointer(T) rhs) 81 { 82 return !(this == rhs); 83 } 84 85 forall(otype T) 86 extern struct gcpointer(T) 0; -
src/examples/gc_no_raii/src/internal/memory_pool.h
rc331406 r5070fe4 3 3 extern "C" { 4 4 #include <stdbool.h> 5 #include <stddef.h>6 5 #include <stdint.h> 7 6 } -
src/examples/gc_no_raii/src/internal/state.h
rc331406 r5070fe4 1 1 #pragma once 2 2 3 #ifdef __cforall4 extern "C" {5 #endif6 3 #include <stddef.h> 7 4 #include <stdint.h> 8 #ifdef __cforall9 }10 #endif11 #include <vector>12 5 13 6 #include "tools.h" 7 #include "vector.h" 14 8 15 9 typedef vector(struct gc_memory_pool*, heap_allocator(struct gc_memory_pool*)) pools_table_t; -
src/examples/gc_no_raii/src/tools/worklist.h
rc331406 r5070fe4 10 10 #endif 11 11 12 #include <vector>12 #include "vector.h" 13 13 14 14 typedef vector(intptr_t*, heap_allocator(intptr_t*)) worklist_t; -
src/examples/gc_no_raii/test/badlll.c
rc331406 r5070fe4 7 7 }; 8 8 9 void ?{}(List_t* this);10 List_t* ?=?(List_t* this, List_t* rhs);11 12 9 typedef gcpointer(List_t) LLL; 13 10 14 11 #define MAX (1024 * 1024) 15 12 16 // LLL buildLLL(int sz) 17 void bla() 13 LLL buildLLL(int sz) 18 14 { 19 15 int i; 20 // LLL ll0;//, lll, llc;21 // 22 //ll0 = gcmalloc();23 //ll0->val = 0;24 //lll = ll0;25 // 26 //for (i = 1; i < sz; i++)27 //{28 //llc = gcmalloc();29 //llc->val = i;30 //lll->next = llc;31 //lll = llc;32 //}33 // 34 //return ll0;16 LLL ll0, lll, llc; 17 18 ll0 = gcmalloc(); 19 ll0->val = 0; 20 lll = ll0; 21 22 for (i = 1; i < sz; i++) 23 { 24 llc = gcmalloc(); 25 llc->val = i; 26 lll->next = llc; 27 lll = llc; 28 } 29 30 return ll0; 35 31 } 36 // 37 //void testLLL(LLL lll)38 //{39 //unsigned char *counted;40 // 41 //counted = (unsigned char *) calloc(MAX, sizeof(unsigned char));42 //while (lll)43 //{44 //counted[lll->val]++;45 //if (counted[lll->val] > 1)46 //{47 //fprintf(stderr, "ERROR! Encountered %d twice!\n", lll->val);48 //exit(1);49 //}50 //lll = lll->next;51 //}52 // 53 //return;54 //}32 33 void testLLL(LLL lll) 34 { 35 unsigned char *counted; 36 37 counted = (unsigned char *) calloc(MAX, sizeof(unsigned char)); 38 while (lll) 39 { 40 counted[lll->val]++; 41 if (counted[lll->val] > 1) 42 { 43 fprintf(stderr, "ERROR! Encountered %d twice!\n", lll->val); 44 exit(1); 45 } 46 lll = lll->next; 47 } 48 49 return; 50 } 55 51 56 52 int main(void) … … 58 54 LLL mylll; 59 55 60 //mylll = buildLLL(MAX);61 // 62 //testLLL(mylll);56 mylll = buildLLL(MAX); 57 58 testLLL(mylll); 63 59 64 60 return 0; -
src/examples/gc_no_raii/test/gctest.c
rc331406 r5070fe4 7 7 int main() { 8 8 sout | "Bonjour au monde!\n"; 9 10 gcpointer(int) anInt = gcmalloc();11 9 } -
src/main.cc
rc331406 r5070fe4 43 43 #include "InitTweak/GenInit.h" 44 44 #include "InitTweak/FixInit.h" 45 #include "InitTweak/FixGlobalInit.h" 45 46 //#include "Explain/GenProlog.h" 46 47 //#include "Try/Visit.h" … … 282 283 OPTPRINT( "fixNames" ) 283 284 CodeGen::fixNames( translationUnit ); 285 OPTPRINT( "fixGlobalInit" ); 286 InitTweak::fixGlobalInit( translationUnit, filename, libcfap || treep ); 284 287 OPTPRINT( "tweakInit" ) 285 288 InitTweak::genInit( translationUnit ); … … 302 305 } 303 306 307 OPTPRINT( "fixInit" ) 304 308 // fix ObjectDecl - replaces ConstructorInit nodes 305 OPTPRINT( "fixInit" ) 306 InitTweak::fix( translationUnit, filename, libcfap || treep ); 309 InitTweak::fix( translationUnit ); 307 310 if ( ctorinitp ) { 308 311 dump ( translationUnit ); -
src/tests/.expect/64/extension.txt
rc331406 r5070fe4 100 100 ((void)((__extension__ __a__i_2 , __extension__ __b__i_2) , __extension__ __c__i_2)); 101 101 } 102 __attribute__ ((constructor(),)) static void _init_extension(void){ 103 int _global_init0; 104 ((void)((*((int *)(&__a__i_1)))=_global_init0) /* ?{} */); 105 int _global_init1; 106 ((void)((*((int *)(&__b__i_1)))=_global_init1) /* ?{} */); 107 int _global_init2; 108 ((void)((*((int *)(&__c__i_1)))=_global_init2) /* ?{} */); 109 } 110 __attribute__ ((destructor(),)) static void _destroy_extension(void){ 111 ((void)((*((int *)(&__c__i_1)))) /* ^?{} */); 112 ((void)((*((int *)(&__b__i_1)))) /* ^?{} */); 113 ((void)((*((int *)(&__a__i_1)))) /* ^?{} */); 114 } -
src/tests/init_once.c
rc331406 r5070fe4 92 92 init_once y = x; 93 93 94 void static_variable() {95 static init_once x;96 }97 98 94 int main() { 99 95 // local variables … … 183 179 } 184 180 } 185 186 // function-scoped static variable187 for (int i = 0; i < 10; i++) {188 static_variable();189 }190 181 } 191 182 -
src/tests/switch.c
rc331406 r5070fe4 10 10 // Created On : Tue Jul 12 06:50:22 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 4 11:44:29201613 // Update Count : 3 112 // Last Modified On : Sat Jul 30 14:41:32 2016 13 // Update Count : 30 14 14 // 15 15 … … 39 39 case 4: 40 40 j = 0; 41 }42 43 switch ( i ) {44 case 1, 2, 3:45 switch ( i ) {46 case 2, 3, 4:47 7;48 }49 41 } 50 42
Note:
See TracChangeset
for help on using the changeset viewer.