Changes in / [925b7f4:35df560]
- Location:
- src
- Files:
-
- 26 edited
-
CodeGen/FixNames.cc (modified) (2 diffs)
-
Common/PassVisitor.h (modified) (3 diffs)
-
Common/PassVisitor.impl.h (modified) (23 diffs)
-
GenPoly/Box.cc (modified) (6 diffs)
-
InitTweak/FixInit.cc (modified) (7 diffs)
-
Parser/ExpressionNode.cc (modified) (10 diffs)
-
Parser/ParseNode.h (modified) (1 diff)
-
Parser/StatementNode.cc (modified) (1 diff)
-
Parser/parseutility.cc (modified) (2 diffs)
-
SymTab/Autogen.h (modified) (2 diffs)
-
SymTab/Indexer.cc (modified) (1 diff)
-
SymTab/Indexer.h (modified) (1 diff)
-
SymTab/Validate.cc (modified) (17 diffs)
-
SynTree/BaseSyntaxNode.h (modified) (1 diff)
-
SynTree/Constant.cc (modified) (3 diffs)
-
SynTree/Constant.h (modified) (3 diffs)
-
SynTree/Expression.cc (modified) (4 diffs)
-
SynTree/Expression.h (modified) (3 diffs)
-
SynTree/Mutator.cc (modified) (1 diff)
-
SynTree/Mutator.h (modified) (1 diff)
-
SynTree/ObjectDecl.cc (modified) (1 diff)
-
SynTree/Statement.cc (modified) (2 diffs)
-
SynTree/Statement.h (modified) (3 diffs)
-
SynTree/Visitor.cc (modified) (1 diff)
-
SynTree/Visitor.h (modified) (2 diffs)
-
Tuples/TupleExpansion.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/FixNames.cc
r925b7f4 r35df560 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 14:22:59201713 // Update Count : 1 912 // Last Modified On : Thu Mar 16 07:50:30 2017 13 // Update Count : 16 14 14 // 15 15 … … 114 114 throw SemanticError("Main expected to have 0, 2 or 3 arguments\n", functionDecl); 115 115 } 116 functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant ::from_int( 0) ) ) );116 functionDecl->get_statements()->get_kids().push_back( new ReturnStmt( noLabels, new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), "0") ) ) ); 117 117 CodeGen::FixMain::registerMain( functionDecl ); 118 118 } -
src/Common/PassVisitor.h
r925b7f4 r35df560 18 18 // Templated visitor type 19 19 // To use declare a PassVisitor< YOUR VISITOR TYPE > 20 // The visitor type should specify the previsit/postvisit/premutate/postmutate for types that are desired. 21 // Note: previsit/postvisit/premutate/postmutate must be **public** members 22 // 23 // Several additional features are available through inheritance 24 // | WithTypeSubstitution - provides polymorphic TypeSubstitution * env for the current expression 25 // | WithStmtsToAdd - provides the ability to insert statements before or after the current statement by adding new statements into 26 // stmtsToAddBefore or stmtsToAddAfter respectively. 27 // | WithShortCircuiting - provides the ability to skip visiting child nodes; set skip_children to true if pre{visit,mutate} to skip visiting children 28 // | WithScopes - provides the ability to save/restore data like a LIFO stack; to save, call GuardValue with the variable to save, the variable 29 // will automatically be restored to its previous value after the corresponding postvisit/postmutate teminates. 20 // The visitor type should specify the previsit/postvisit for types that are desired. 30 21 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 31 22 template< typename pass_type > … … 95 86 virtual void visit( ConstructorExpr * ctorExpr ) override final; 96 87 virtual void visit( CompoundLiteralExpr *compLitExpr ) override final; 88 virtual void visit( UntypedValofExpr *valofExpr ) override final; 97 89 virtual void visit( RangeExpr *rangeExpr ) override final; 98 90 virtual void visit( UntypedTupleExpr *tupleExpr ) override final; … … 180 172 virtual Expression* mutate( ConstructorExpr *ctorExpr ) override final; 181 173 virtual Expression* mutate( CompoundLiteralExpr *compLitExpr ) override final; 174 virtual Expression* mutate( UntypedValofExpr *valofExpr ) override final; 182 175 virtual Expression* mutate( RangeExpr *rangeExpr ) override final; 183 176 virtual Expression* mutate( UntypedTupleExpr *tupleExpr ) override final; -
src/Common/PassVisitor.impl.h
r925b7f4 r35df560 6 6 call_previsit( node ); \ 7 7 if( visit_children() ) { \ 8 reset_visit(); \ 8 9 9 10 #define VISIT_END( node ) \ 10 11 } \ 11 reset_visit(); \12 12 call_postvisit( node ); \ 13 13 … … 17 17 call_premutate( node ); \ 18 18 if( visit_children() ) { \ 19 reset_visit(); \ 19 20 20 21 #define MUTATE_END( type, node ) \ 21 22 } \ 22 reset_visit(); \23 23 return call_postmutate< type * >( node ); \ 24 24 … … 159 159 template< typename pass_type > 160 160 void PassVisitor< pass_type >::visit( ObjectDecl * node ) { 161 VISIT_BODY( node ); 161 VISIT_BODY( node ); 162 162 } 163 163 164 164 template< typename pass_type > 165 165 void PassVisitor< pass_type >::visit( FunctionDecl * node ) { 166 VISIT_BODY( node ); 166 VISIT_BODY( node ); 167 167 } 168 168 169 169 template< typename pass_type > 170 170 void PassVisitor< pass_type >::visit( StructDecl * node ) { 171 VISIT_BODY( node ); 171 VISIT_BODY( node ); 172 172 } 173 173 174 174 template< typename pass_type > 175 175 void PassVisitor< pass_type >::visit( UnionDecl * node ) { 176 VISIT_BODY( node ); 176 VISIT_BODY( node ); 177 177 } 178 178 179 179 template< typename pass_type > 180 180 void PassVisitor< pass_type >::visit( EnumDecl * node ) { 181 VISIT_BODY( node ); 181 VISIT_BODY( node ); 182 182 } 183 183 184 184 template< typename pass_type > 185 185 void PassVisitor< pass_type >::visit( TraitDecl * node ) { 186 VISIT_BODY( node ); 186 VISIT_BODY( node ); 187 187 } 188 188 189 189 template< typename pass_type > 190 190 void PassVisitor< pass_type >::visit( TypeDecl * node ) { 191 VISIT_BODY( node ); 191 VISIT_BODY( node ); 192 192 } 193 193 194 194 template< typename pass_type > 195 195 void PassVisitor< pass_type >::visit( TypedefDecl * node ) { 196 VISIT_BODY( node ); 196 VISIT_BODY( node ); 197 197 } 198 198 199 199 template< typename pass_type > 200 200 void PassVisitor< pass_type >::visit( AsmDecl * node ) { 201 VISIT_BODY( node ); 201 VISIT_BODY( node ); 202 202 } 203 203 … … 250 250 template< typename pass_type > 251 251 void PassVisitor< pass_type >::visit( AsmStmt * node ) { 252 VISIT_BODY( node ); 252 VISIT_BODY( node ); 253 253 } 254 254 … … 257 257 template< typename pass_type > 258 258 void PassVisitor< pass_type >::visit( IfStmt * node ) { 259 VISIT_START( node ); 259 VISIT_START( node ); 260 260 261 261 visitExpression( node->get_condition() ); … … 268 268 template< typename pass_type > 269 269 Statement * PassVisitor< pass_type >::mutate( IfStmt * node ) { 270 MUTATE_START( node ); 270 MUTATE_START( node ); 271 271 272 272 node->set_condition( mutateExpression( node->get_condition() ) ); … … 281 281 template< typename pass_type > 282 282 void PassVisitor< pass_type >::visit( WhileStmt * node ) { 283 VISIT_START( node ); 283 VISIT_START( node ); 284 284 285 285 visitExpression( node->get_condition() ); … … 291 291 template< typename pass_type > 292 292 Statement * PassVisitor< pass_type >::mutate( WhileStmt * node ) { 293 MUTATE_START( node ); 293 MUTATE_START( node ); 294 294 295 295 node->set_condition( mutateExpression( node->get_condition() ) ); … … 303 303 template< typename pass_type > 304 304 void PassVisitor< pass_type >::visit( ForStmt * node ) { 305 VISIT_START( node ); 305 VISIT_START( node ); 306 306 307 307 acceptAll( node->get_initialization(), *this ); … … 315 315 template< typename pass_type > 316 316 Statement * PassVisitor< pass_type >::mutate( ForStmt * node ) { 317 MUTATE_START( node ); 317 MUTATE_START( node ); 318 318 319 319 mutateAll( node->get_initialization(), *this ); … … 329 329 template< typename pass_type > 330 330 void PassVisitor< pass_type >::visit( SwitchStmt * node ) { 331 VISIT_START( node ); 331 VISIT_START( node ); 332 332 333 333 visitExpression( node->get_condition() ); … … 339 339 template< typename pass_type > 340 340 Statement * PassVisitor< pass_type >::mutate( SwitchStmt * node ) { 341 MUTATE_START( node ); 342 341 MUTATE_START( node ); 342 343 343 node->set_condition( mutateExpression( node->get_condition() ) ); 344 344 mutateStatementList( node->get_statements() ); 345 345 346 346 MUTATE_END( Statement, node ); 347 347 } … … 351 351 template< typename pass_type > 352 352 void PassVisitor< pass_type >::visit( CaseStmt * node ) { 353 VISIT_START( node ); 354 353 VISIT_START( node ); 354 355 355 visitExpression( node->get_condition() ); 356 356 visitStatementList( node->get_statements() ); 357 357 358 358 VISIT_END( node ); 359 359 } … … 361 361 template< typename pass_type > 362 362 Statement * PassVisitor< pass_type >::mutate( CaseStmt * node ) { 363 MUTATE_START( node ); 364 363 MUTATE_START( node ); 364 365 365 node->set_condition( mutateExpression( node->get_condition() ) ); 366 366 mutateStatementList( node->get_statements() ); 367 367 368 368 MUTATE_END( Statement, node ); 369 369 } … … 371 371 template< typename pass_type > 372 372 void PassVisitor< pass_type >::visit( BranchStmt * node ) { 373 VISIT_BODY( node ); 373 VISIT_BODY( node ); 374 374 } 375 375 … … 425 425 node->set_block( maybeMutate( node->get_block(), *this ) ); 426 426 mutateAll( node->get_catchers(), *this ); 427 427 428 428 MUTATE_END( Statement, node ); 429 429 } … … 444 444 Statement * PassVisitor< pass_type >::mutate( CatchStmt * node ) { 445 445 MUTATE_START( node ); 446 446 447 447 node->set_body( mutateStatement( node->get_body() ) ); 448 448 node->set_decl( maybeMutate( node->get_decl(), *this ) ); 449 449 450 450 MUTATE_END( Statement, node ); 451 451 } … … 453 453 template< typename pass_type > 454 454 void PassVisitor< pass_type >::visit( FinallyStmt * node ) { 455 VISIT_BODY( node ); 455 VISIT_BODY( node ); 456 456 } 457 457 458 458 template< typename pass_type > 459 459 void PassVisitor< pass_type >::visit( NullStmt * node ) { 460 VISIT_BODY( node ); 460 VISIT_BODY( node ); 461 461 } 462 462 463 463 template< typename pass_type > 464 464 void PassVisitor< pass_type >::visit( DeclStmt * node ) { 465 VISIT_BODY( node ); 465 VISIT_BODY( node ); 466 466 } 467 467 468 468 template< typename pass_type > 469 469 void PassVisitor< pass_type >::visit( ImplicitCtorDtorStmt * node ) { 470 VISIT_BODY( node ); 470 VISIT_BODY( node ); 471 471 } 472 472 473 473 template< typename pass_type > 474 474 void PassVisitor< pass_type >::visit( ApplicationExpr * node ) { 475 VISIT_BODY( node ); 475 VISIT_BODY( node ); 476 476 } 477 477 … … 502 502 template< typename pass_type > 503 503 void PassVisitor< pass_type >::visit( NameExpr * node ) { 504 VISIT_BODY( node ); 504 VISIT_BODY( node ); 505 505 } 506 506 507 507 template< typename pass_type > 508 508 void PassVisitor< pass_type >::visit( CastExpr * node ) { 509 VISIT_BODY( node ); 509 VISIT_BODY( node ); 510 510 } 511 511 512 512 template< typename pass_type > 513 513 void PassVisitor< pass_type >::visit( AddressExpr * node ) { 514 VISIT_BODY( node ); 514 VISIT_BODY( node ); 515 515 } 516 516 517 517 template< typename pass_type > 518 518 void PassVisitor< pass_type >::visit( LabelAddressExpr * node ) { 519 VISIT_BODY( node ); 519 VISIT_BODY( node ); 520 520 } 521 521 522 522 template< typename pass_type > 523 523 void PassVisitor< pass_type >::visit( UntypedMemberExpr * node ) { 524 VISIT_BODY( node ); 524 VISIT_BODY( node ); 525 525 } 526 526 527 527 template< typename pass_type > 528 528 void PassVisitor< pass_type >::visit( MemberExpr * node ) { 529 VISIT_BODY( node ); 529 VISIT_BODY( node ); 530 530 } 531 531 532 532 template< typename pass_type > 533 533 void PassVisitor< pass_type >::visit( VariableExpr * node ) { 534 VISIT_BODY( node ); 534 VISIT_BODY( node ); 535 535 } 536 536 537 537 template< typename pass_type > 538 538 void PassVisitor< pass_type >::visit( ConstantExpr * node ) { 539 VISIT_BODY( node ); 539 VISIT_BODY( node ); 540 540 } 541 541 542 542 template< typename pass_type > 543 543 void PassVisitor< pass_type >::visit( SizeofExpr * node ) { 544 VISIT_BODY( node ); 544 VISIT_BODY( node ); 545 545 } 546 546 547 547 template< typename pass_type > 548 548 void PassVisitor< pass_type >::visit( AlignofExpr * node ) { 549 VISIT_BODY( node ); 549 VISIT_BODY( node ); 550 550 } 551 551 552 552 template< typename pass_type > 553 553 void PassVisitor< pass_type >::visit( UntypedOffsetofExpr * node ) { 554 VISIT_BODY( node ); 554 VISIT_BODY( node ); 555 555 } 556 556 557 557 template< typename pass_type > 558 558 void PassVisitor< pass_type >::visit( OffsetofExpr * node ) { 559 VISIT_BODY( node ); 559 VISIT_BODY( node ); 560 560 } 561 561 562 562 template< typename pass_type > 563 563 void PassVisitor< pass_type >::visit( OffsetPackExpr * node ) { 564 VISIT_BODY( node ); 564 VISIT_BODY( node ); 565 565 } 566 566 567 567 template< typename pass_type > 568 568 void PassVisitor< pass_type >::visit( AttrExpr * node ) { 569 VISIT_BODY( node ); 569 VISIT_BODY( node ); 570 570 } 571 571 572 572 template< typename pass_type > 573 573 void PassVisitor< pass_type >::visit( LogicalExpr * node ) { 574 VISIT_BODY( node ); 574 VISIT_BODY( node ); 575 575 } 576 576 577 577 template< typename pass_type > 578 578 void PassVisitor< pass_type >::visit( ConditionalExpr * node ) { 579 VISIT_BODY( node ); 579 VISIT_BODY( node ); 580 580 } 581 581 582 582 template< typename pass_type > 583 583 void PassVisitor< pass_type >::visit( CommaExpr * node ) { 584 VISIT_BODY( node ); 584 VISIT_BODY( node ); 585 585 } 586 586 587 587 template< typename pass_type > 588 588 void PassVisitor< pass_type >::visit( TypeExpr * node ) { 589 VISIT_BODY( node ); 589 VISIT_BODY( node ); 590 590 } 591 591 592 592 template< typename pass_type > 593 593 void PassVisitor< pass_type >::visit( AsmExpr * node ) { 594 VISIT_BODY( node ); 594 VISIT_BODY( node ); 595 595 } 596 596 597 597 template< typename pass_type > 598 598 void PassVisitor< pass_type >::visit( ImplicitCopyCtorExpr * node ) { 599 VISIT_BODY( node ); 599 VISIT_BODY( node ); 600 600 } 601 601 602 602 template< typename pass_type > 603 603 void PassVisitor< pass_type >::visit( ConstructorExpr * node ) { 604 VISIT_BODY( node ); 604 VISIT_BODY( node ); 605 605 } 606 606 607 607 template< typename pass_type > 608 608 void PassVisitor< pass_type >::visit( CompoundLiteralExpr * node ) { 609 VISIT_BODY( node ); 609 VISIT_BODY( node ); 610 } 611 612 template< typename pass_type > 613 void PassVisitor< pass_type >::visit( UntypedValofExpr * node ) { 614 VISIT_BODY( node ); 610 615 } 611 616 612 617 template< typename pass_type > 613 618 void PassVisitor< pass_type >::visit( RangeExpr * node ) { 614 VISIT_BODY( node ); 619 VISIT_BODY( node ); 615 620 } 616 621 617 622 template< typename pass_type > 618 623 void PassVisitor< pass_type >::visit( UntypedTupleExpr * node ) { 619 VISIT_BODY( node ); 624 VISIT_BODY( node ); 620 625 } 621 626 622 627 template< typename pass_type > 623 628 void PassVisitor< pass_type >::visit( TupleExpr * node ) { 624 VISIT_BODY( node ); 629 VISIT_BODY( node ); 625 630 } 626 631 627 632 template< typename pass_type > 628 633 void PassVisitor< pass_type >::visit( TupleIndexExpr * node ) { 629 VISIT_BODY( node ); 634 VISIT_BODY( node ); 630 635 } 631 636 632 637 template< typename pass_type > 633 638 void PassVisitor< pass_type >::visit( TupleAssignExpr * node ) { 634 VISIT_BODY( node ); 639 VISIT_BODY( node ); 635 640 } 636 641 … … 654 659 Expression * PassVisitor< pass_type >::mutate( StmtExpr * node ) { 655 660 MUTATE_START( node ); 656 661 657 662 // don't want statements from outer CompoundStmts to be added to this StmtExpr 658 663 ValueGuardPtr< TypeSubstitution * > oldEnv ( get_env_ptr() ); … … 667 672 template< typename pass_type > 668 673 void PassVisitor< pass_type >::visit( UniqueExpr * node ) { 669 VISIT_BODY( node ); 674 VISIT_BODY( node ); 670 675 } 671 676 672 677 template< typename pass_type > 673 678 void PassVisitor< pass_type >::visit( VoidType * node ) { 674 VISIT_BODY( node ); 679 VISIT_BODY( node ); 675 680 } 676 681 677 682 template< typename pass_type > 678 683 void PassVisitor< pass_type >::visit( BasicType * node ) { 679 VISIT_BODY( node ); 684 VISIT_BODY( node ); 680 685 } 681 686 682 687 template< typename pass_type > 683 688 void PassVisitor< pass_type >::visit( PointerType * node ) { 684 VISIT_BODY( node ); 689 VISIT_BODY( node ); 685 690 } 686 691 687 692 template< typename pass_type > 688 693 void PassVisitor< pass_type >::visit( ArrayType * node ) { 689 VISIT_BODY( node ); 694 VISIT_BODY( node ); 690 695 } 691 696 692 697 template< typename pass_type > 693 698 void PassVisitor< pass_type >::visit( FunctionType * node ) { 694 VISIT_BODY( node ); 699 VISIT_BODY( node ); 695 700 } 696 701 697 702 template< typename pass_type > 698 703 void PassVisitor< pass_type >::visit( StructInstType * node ) { 699 VISIT_BODY( node ); 704 VISIT_BODY( node ); 700 705 } 701 706 702 707 template< typename pass_type > 703 708 void PassVisitor< pass_type >::visit( UnionInstType * node ) { 704 VISIT_BODY( node ); 709 VISIT_BODY( node ); 705 710 } 706 711 707 712 template< typename pass_type > 708 713 void PassVisitor< pass_type >::visit( EnumInstType * node ) { 709 VISIT_BODY( node ); 714 VISIT_BODY( node ); 710 715 } 711 716 712 717 template< typename pass_type > 713 718 void PassVisitor< pass_type >::visit( TraitInstType * node ) { 714 VISIT_BODY( node ); 719 VISIT_BODY( node ); 715 720 } 716 721 717 722 template< typename pass_type > 718 723 void PassVisitor< pass_type >::visit( TypeInstType * node ) { 719 VISIT_BODY( node ); 724 VISIT_BODY( node ); 720 725 } 721 726 722 727 template< typename pass_type > 723 728 void PassVisitor< pass_type >::visit( TupleType * node ) { 724 VISIT_BODY( node ); 729 VISIT_BODY( node ); 725 730 } 726 731 727 732 template< typename pass_type > 728 733 void PassVisitor< pass_type >::visit( TypeofType * node ) { 729 VISIT_BODY( node ); 734 VISIT_BODY( node ); 730 735 } 731 736 732 737 template< typename pass_type > 733 738 void PassVisitor< pass_type >::visit( AttrType * node ) { 734 VISIT_BODY( node ); 739 VISIT_BODY( node ); 735 740 } 736 741 737 742 template< typename pass_type > 738 743 void PassVisitor< pass_type >::visit( VarArgsType * node ) { 739 VISIT_BODY( node ); 744 VISIT_BODY( node ); 740 745 } 741 746 742 747 template< typename pass_type > 743 748 void PassVisitor< pass_type >::visit( ZeroType * node ) { 744 VISIT_BODY( node ); 749 VISIT_BODY( node ); 745 750 } 746 751 747 752 template< typename pass_type > 748 753 void PassVisitor< pass_type >::visit( OneType * node ) { 749 VISIT_BODY( node ); 754 VISIT_BODY( node ); 750 755 } 751 756 … … 772 777 template< typename pass_type > 773 778 void PassVisitor< pass_type >::visit( ListInit * node ) { 774 VISIT_BODY( node ); 779 VISIT_BODY( node ); 775 780 } 776 781 777 782 template< typename pass_type > 778 783 void PassVisitor< pass_type >::visit( ConstructorInit * node ) { 779 VISIT_BODY( node ); 784 VISIT_BODY( node ); 780 785 } 781 786 782 787 template< typename pass_type > 783 788 void PassVisitor< pass_type >::visit( Subrange * node ) { 784 VISIT_BODY( node ); 789 VISIT_BODY( node ); 785 790 } 786 791 787 792 template< typename pass_type > 788 793 void PassVisitor< pass_type >::visit( Constant * node ) { 789 VISIT_BODY( node ); 794 VISIT_BODY( node ); 790 795 } 791 796 … … 983 988 984 989 template< typename pass_type > 990 Expression * PassVisitor< pass_type >::mutate( UntypedValofExpr * node ) { 991 MUTATE_BODY( Expression, node ); 992 } 993 994 template< typename pass_type > 985 995 Expression * PassVisitor< pass_type >::mutate( RangeExpr * node ) { 986 996 MUTATE_BODY( Expression, node ); -
src/GenPoly/Box.cc
r925b7f4 r35df560 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 15:49:59201713 // Update Count : 34 612 // Last Modified On : Sat May 13 09:26:38 2017 13 // Update Count : 341 14 14 // 15 15 … … 341 341 Statement *makeAlignTo( Expression *lhs, Expression *rhs ) { 342 342 // check that the lhs is zeroed out to the level of rhs 343 Expression *ifCond = makeOp( "?&?", lhs, makeOp( "?-?", rhs, new ConstantExpr( Constant ::from_ulong( 1) ) ) );343 Expression *ifCond = makeOp( "?&?", lhs, makeOp( "?-?", rhs, new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "1" ) ) ) ); 344 344 // if not aligned, increment to alignment 345 345 Expression *ifExpr = makeOp( "?+=?", lhs->clone(), makeOp( "?-?", rhs->clone(), ifCond->clone() ) ); … … 384 384 385 385 // initialize size and alignment to 0 and 1 (will have at least one member to re-edit size) 386 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant ::from_ulong( 0) ) ) );387 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant ::from_ulong( 1) ) ) );386 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "0" ) ) ) ); 387 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "1" ) ) ) ); 388 388 unsigned long n_members = 0; 389 389 bool firstMember = true; … … 441 441 442 442 // calculate union layout in function body 443 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant ::from_ulong( 1) ) ) );444 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant ::from_ulong( 1) ) ) );443 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( sizeParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "1" ) ) ) ); 444 addExpr( layoutDecl->get_statements(), makeOp( "?=?", derefVar( alignParam ), new ConstantExpr( Constant( sizeAlignType->clone(), "1" ) ) ) ); 445 445 for ( std::list< Declaration* >::const_iterator member = unionDecl->get_members().begin(); member != unionDecl->get_members().end(); ++member ) { 446 446 DeclarationWithType *dwt = dynamic_cast< DeclarationWithType * >( *member ); … … 1564 1564 /// Returns an index expression into the offset array for a type 1565 1565 Expression *makeOffsetIndex( Type *objectType, long i ) { 1566 ConstantExpr *fieldIndex = new ConstantExpr( Constant::from_ulong( i ) ); 1566 std::stringstream offset_namer; 1567 offset_namer << i; 1568 ConstantExpr *fieldIndex = new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), offset_namer.str() ) ); 1567 1569 UntypedExpr *fieldOffset = new UntypedExpr( new NameExpr( "?[?]" ) ); 1568 1570 fieldOffset->get_args().push_back( new NameExpr( offsetofName( mangleType( objectType ) ) ) ); … … 1777 1779 // all union members are at offset zero 1778 1780 delete offsetofExpr; 1779 return new ConstantExpr( Constant ::from_ulong( 0) );1781 return new ConstantExpr( Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), "0" ) ); 1780 1782 } else return offsetofExpr; 1781 1783 } -
src/InitTweak/FixInit.cc
r925b7f4 r35df560 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 17:35:05201713 // Update Count : 7 412 // Last Modified On : Fri Mar 17 09:13:47 2017 13 // Update Count : 71 14 14 // 15 15 … … 56 56 typedef std::unordered_map< int, int > UnqCount; 57 57 58 class InsertImplicitCalls : public WithTypeSubstitution{58 class InsertImplicitCalls { 59 59 public: 60 60 /// wrap function application expressions as ImplicitCopyCtorExpr nodes so that it is easy to identify which … … 69 69 // collects environments for relevant nodes 70 70 EnvMap & envMap; 71 TypeSubstitution * env; //Magically populated by the PassVisitor 71 72 }; 72 73 … … 191 192 }; 192 193 193 class FixInit : public WithStmtsToAdd{194 class FixInit { 194 195 public: 195 196 /// expand each object declaration to use its constructor after it is declared. … … 199 200 200 201 std::list< Declaration * > staticDtorDecls; 202 std::list< Statement * > stmtsToAddAfter; // found by PassVisitor 201 203 }; 202 204 … … 724 726 // static bool __objName_uninitialized = true 725 727 BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool ); 726 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant ::from_int( 1) ), noDesignators );728 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant( boolType->clone(), "1" ) ), noDesignators ); 727 729 ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, boolType, boolInitExpr ); 728 730 isUninitializedVar->fixUniqueId(); … … 731 733 UntypedExpr * setTrue = new UntypedExpr( new NameExpr( "?=?" ) ); 732 734 setTrue->get_args().push_back( new VariableExpr( isUninitializedVar ) ); 733 setTrue->get_args().push_back( new ConstantExpr( Constant ::from_int( 0) ) );735 setTrue->get_args().push_back( new ConstantExpr( Constant( boolType->clone(), "0" ) ) ); 734 736 735 737 // generate body of if -
src/Parser/ExpressionNode.cc
r925b7f4 r35df560 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 16:44:46201713 // Update Count : 5 4112 // Last Modified On : Wed May 17 21:31:01 2017 13 // Update Count : 527 14 14 // 15 15 … … 62 62 bool dec = true, Unsigned = false; // decimal, unsigned constant 63 63 int size; // 0 => int, 1 => long, 2 => long long 64 unsigned long long intv; // converted integral value64 unsigned long long v; // converted integral value 65 65 size_t last = str.length() - 1; // last character of constant 66 66 … … 118 118 } // if 119 119 120 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str , v) );120 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[Unsigned][size] ), str ) ); 121 121 delete &str; // created by lex 122 122 return ret; … … 133 133 // floating-point constant has minimum of 2 characters: 1. or .1 134 134 size_t last = str.length() - 1; 135 double v;136 137 sscanf( str.c_str(), "%lg", &v );138 135 139 136 if ( checkI( str[last] ) ) { // imaginary ? … … 153 150 } // if 154 151 155 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str , v) );152 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, kind[complx][size] ), str ) ); 156 153 delete &str; // created by lex 157 154 return ret; … … 159 156 160 157 Expression *build_constantChar( const std::string & str ) { 161 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str , (unsigned long long int)(unsigned char)str[1]) );158 Expression * ret = new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::Char ), str ) ); 162 159 delete &str; // created by lex 163 160 return ret; … … 167 164 // string should probably be a primitive type 168 165 ArrayType *at = new ArrayType( emptyQualifiers, new BasicType( Type::Qualifiers( Type::Const ), BasicType::Char ), 169 new ConstantExpr( Constant::from_ulong( str.size() + 1 - 2 ) ), // +1 for '\0' and -2 for '"' 166 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::UnsignedInt ), 167 toString( str.size()+1-2 ) ) ), // +1 for '\0' and -2 for '"' 170 168 false, false ); 171 // constant 0 is ignored for pure string value 172 ConstantExpr * ret = new ConstantExpr( Constant( at, str, (unsigned long long int)0 ) ); 169 ConstantExpr * ret = new ConstantExpr( Constant( at, str ) ); 173 170 delete &str; // created by lex 174 171 return ret; … … 176 173 177 174 Expression *build_constantZeroOne( const std::string & str ) { 178 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str, 179 str == "0" ? (unsigned long long int)0 : (unsigned long long int)1 ) ); 175 Expression * ret = new ConstantExpr( Constant( str == "0" ? (Type *)new ZeroType( emptyQualifiers ) : (Type*)new OneType( emptyQualifiers ), str ) ); 180 176 delete &str; // created by lex 181 177 return ret; … … 188 184 std::stringstream ss( str ); 189 185 ss >> a >> dot >> b; 190 UntypedMemberExpr * ret = new UntypedMemberExpr( new ConstantExpr( Constant::from_int( b ) ), new ConstantExpr( Constant::from_int( a ) ) ); 186 UntypedMemberExpr * ret = new UntypedMemberExpr( 187 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::SignedInt ), toString( b ) ) ), 188 new ConstantExpr( Constant( new BasicType( emptyQualifiers, BasicType::SignedInt ), toString( a ) ) ) ); 191 189 delete &str; 192 190 return ret; … … 348 346 349 347 Expression *build_valexpr( StatementNode *s ) { 350 return new StmtExpr( dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(s) ));348 return new UntypedValofExpr( maybeMoveBuild< Statement >(s), nullptr ); 351 349 } 352 350 Expression *build_typevalue( DeclarationNode *decl ) { -
src/Parser/ParseNode.h
r925b7f4 r35df560 415 415 result->location = cur->location; 416 416 * out++ = result; 417 } else {418 assertf(false, "buildList unknown type");419 417 } // if 420 418 } catch( SemanticError &e ) { -
src/Parser/StatementNode.cc
r925b7f4 r35df560 175 175 176 176 Statement *build_try( StatementNode *try_stmt, StatementNode *catch_stmt, StatementNode *finally_stmt ) { 177 std::list< CatchStmt * > branches;178 buildMoveList< CatchStmt, StatementNode >( catch_stmt, branches );177 std::list< Statement * > branches; 178 buildMoveList< Statement, StatementNode >( catch_stmt, branches ); 179 179 CompoundStmt *tryBlock = safe_dynamic_cast< CompoundStmt * >(maybeMoveBuild< Statement >(try_stmt)); 180 180 FinallyStmt *finallyBlock = dynamic_cast< FinallyStmt * >(maybeMoveBuild< Statement >(finally_stmt) ); -
src/Parser/parseutility.cc
r925b7f4 r35df560 10 10 // Created On : Sat May 16 15:30:39 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 15:33:41 201713 // Update Count : 512 // Last Modified On : Sun Aug 14 23:45:03 2016 13 // Update Count : 3 14 14 // 15 15 … … 26 26 UntypedExpr *comparison = new UntypedExpr( new NameExpr( "?!=?" ) ); 27 27 comparison->get_args().push_back( orig ); 28 comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0" , (unsigned long long int)0) ) );28 comparison->get_args().push_back( new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0" ) ) ); 29 29 return new CastExpr( comparison, new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 30 30 } -
src/SymTab/Autogen.h
r925b7f4 r35df560 10 10 // Created On : Sun May 17 21:53:34 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 17:25:26201713 // Update Count : 1412 // Last Modified On : Fri Mar 17 09:10:41 2017 13 // Update Count : 9 14 14 // 15 15 … … 25 25 26 26 namespace SymTab { 27 /// Generates assignment operators, constructors, and destructor for aggregate types as required28 void autogenerateRoutines( std::list< Declaration * > &translationUnit );27 /// Generates assignment operators, constructors, and destructor for aggregate types as required 28 void autogenerateRoutines( std::list< Declaration * > &translationUnit ); 29 29 30 /// returns true if obj's name is the empty string and it has a bitfield width31 bool isUnnamedBitfield( ObjectDecl * obj );30 /// returns true if obj's name is the empty string and it has a bitfield width 31 bool isUnnamedBitfield( ObjectDecl * obj ); 32 32 33 /// size_t type - set when size_t typedef is seen. Useful in a few places,34 /// such as in determining array dimension type35 extern Type * SizeType;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; 36 36 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 >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 39 Statement * genCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast = false, bool forward = true ); 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 one43 template< typename OutputIterator >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 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 ) );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 ) ); 48 48 49 // do something special for unnamed members50 dstParam = new AddressExpr( dstParam );51 if ( addCast ) {52 // cast to T* with qualifiers removed, so that qualified objects can be constructed53 // and destructed with the same functions as non-qualified objects.54 // unfortunately, lvalue is considered a qualifier. For AddressExpr to resolve, its argument55 // must have an lvalue qualified type, so remove all qualifiers except lvalue. If we ever56 // remove lvalue as a qualifier, this can change to57 // type->get_qualifiers() = Type::Qualifiers();58 assert( type );59 Type * castType = type->clone();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 60 // castType->get_qualifiers() -= Type::Qualifiers(true, true, true, false, true, false); 61 castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );62 castType->set_lvalue( true ); // xxx - might not need this63 dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) );64 }65 fExpr->get_args().push_back( dstParam );61 castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 62 castType->set_lvalue( true ); // xxx - might not need this 63 dstParam = new CastExpr( dstParam, new PointerType( Type::Qualifiers(), castType ) ); 64 } 65 fExpr->get_args().push_back( dstParam ); 66 66 67 Statement * listInit = srcParam.buildListInit( fExpr );67 Statement * listInit = srcParam.buildListInit( fExpr ); 68 68 69 std::list< Expression * > args = *++srcParam;70 fExpr->get_args().splice( fExpr->get_args().end(), args );69 std::list< Expression * > args = *++srcParam; 70 fExpr->get_args().splice( fExpr->get_args().end(), args ); 71 71 72 *out++ = new ExprStmt( noLabels, fExpr );72 *out++ = new ExprStmt( noLabels, fExpr ); 73 73 74 srcParam.clearArrayIndices();74 srcParam.clearArrayIndices(); 75 75 76 return listInit; 77 } 78 79 /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments. 80 /// If forward is true, loop goes from 0 to N-1, else N-1 to 0 81 template< typename OutputIterator > 82 void genArrayCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, ArrayType *array, bool addCast = false, bool forward = true ) { 83 static UniqueName indexName( "_index" ); 84 85 // for a flexible array member nothing is done -- user must define own assignment 86 if ( ! array->get_dimension() ) return ; 87 88 Expression * begin, * end, * update, * cmp; 89 if ( forward ) { 90 // generate: for ( int i = 0; i < N; ++i ) 91 begin = new ConstantExpr( Constant::from_int( 0 ) ); 92 end = array->get_dimension()->clone(); 93 cmp = new NameExpr( "?<?" ); 94 update = new NameExpr( "++?" ); 95 } else { 96 // generate: for ( int i = N-1; i >= 0; --i ) 97 begin = new UntypedExpr( new NameExpr( "?-?" ) ); 98 ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() ); 99 ((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant::from_int( 1 ) ) ); 100 end = new ConstantExpr( Constant::from_int( 0 ) ); 101 cmp = new NameExpr( "?>=?" ); 102 update = new NameExpr( "--?" ); 76 return listInit; 103 77 } 104 78 105 ObjectDecl *index = new ObjectDecl( indexName.newName(), Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin, std::list<Expression*>() ) ); 79 /// Store in out a loop which calls fname on each element of the array with srcParam and dstParam as arguments. 80 /// If forward is true, loop goes from 0 to N-1, else N-1 to 0 81 template< typename OutputIterator > 82 void genArrayCall( InitTweak::InitExpander & srcParam, Expression *dstParam, const std::string & fname, OutputIterator out, ArrayType *array, bool addCast = false, bool forward = true ) { 83 static UniqueName indexName( "_index" ); 106 84 107 UntypedExpr *cond = new UntypedExpr( cmp ); 108 cond->get_args().push_back( new VariableExpr( index ) ); 109 cond->get_args().push_back( end ); 85 // for a flexible array member nothing is done -- user must define own assignment 86 if ( ! array->get_dimension() ) return ; 110 87 111 UntypedExpr *inc = new UntypedExpr( update ); 112 inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) ); 88 Expression * begin, * end, * update, * cmp; 89 if ( forward ) { 90 // generate: for ( int i = 0; i < 0; ++i ) 91 begin = new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0" ) ); 92 end = array->get_dimension()->clone(); 93 cmp = new NameExpr( "?<?" ); 94 update = new NameExpr( "++?" ); 95 } else { 96 // generate: for ( int i = N-1; i >= 0; --i ) 97 begin = new UntypedExpr( new NameExpr( "?-?" ) ); 98 ((UntypedExpr*)begin)->get_args().push_back( array->get_dimension()->clone() ); 99 ((UntypedExpr*)begin)->get_args().push_back( new ConstantExpr( Constant( new OneType( emptyQualifiers ), "1" ) ) ); 100 end = new ConstantExpr( Constant( new ZeroType( emptyQualifiers ), "0" ) ); 101 cmp = new NameExpr( "?>=?" ); 102 update = new NameExpr( "--?" ); 103 } 113 104 114 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) ); 115 dstIndex->get_args().push_back( dstParam ); 116 dstIndex->get_args().push_back( new VariableExpr( index ) ); 117 dstParam = dstIndex; 105 ObjectDecl *index = new ObjectDecl( indexName.newName(), Type::StorageClasses(), LinkageSpec::C, 0, new BasicType( Type::Qualifiers(), BasicType::SignedInt ), new SingleInit( begin, std::list<Expression*>() ) ); 118 106 119 // srcParam must keep track of the array indices to build the120 // source parameter and/or array list initializer121 srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone());107 UntypedExpr *cond = new UntypedExpr( cmp ); 108 cond->get_args().push_back( new VariableExpr( index ) ); 109 cond->get_args().push_back( end ); 122 110 123 // for stmt's body, eventually containing call 124 CompoundStmt * body = new CompoundStmt( noLabels ); 125 Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward ); 111 UntypedExpr *inc = new UntypedExpr( update ); 112 inc->get_args().push_back( new AddressExpr( new VariableExpr( index ) ) ); 126 113 127 // block containing for stmt and index variable 128 std::list<Statement *> initList; 129 CompoundStmt * block = new CompoundStmt( noLabels ); 130 block->get_kids().push_back( new DeclStmt( noLabels, index ) ); 131 if ( listInit ) block->get_kids().push_back( listInit ); 132 block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) ); 114 UntypedExpr *dstIndex = new UntypedExpr( new NameExpr( "?[?]" ) ); 115 dstIndex->get_args().push_back( dstParam ); 116 dstIndex->get_args().push_back( new VariableExpr( index ) ); 117 dstParam = dstIndex; 133 118 134 *out++ = block; 135 } 119 // srcParam must keep track of the array indices to build the 120 // source parameter and/or array list initializer 121 srcParam.addArrayIndex( new VariableExpr( index ), array->get_dimension()->clone() ); 136 122 137 template< typename OutputIterator > 123 // for stmt's body, eventually containing call 124 CompoundStmt * body = new CompoundStmt( noLabels ); 125 Statement * listInit = genCall( srcParam, dstParam, fname, back_inserter( body->get_kids() ), array->get_base(), addCast, forward ); 126 127 // block containing for stmt and index variable 128 std::list<Statement *> initList; 129 CompoundStmt * block = new CompoundStmt( noLabels ); 130 block->get_kids().push_back( new DeclStmt( noLabels, index ) ); 131 if ( listInit ) block->get_kids().push_back( listInit ); 132 block->get_kids().push_back( new ForStmt( noLabels, initList, cond, inc, body ) ); 133 134 *out++ = block; 135 } 136 137 template< typename OutputIterator > 138 138 Statement * genCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, Type * type, bool addCast, bool forward ) { 139 if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) { 140 genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward ); 141 return 0; 142 } else { 143 return genScalarCall( srcParam, dstParam, fname, out, type, addCast ); 139 if ( ArrayType * at = dynamic_cast< ArrayType * >( type ) ) { 140 genArrayCall( srcParam, dstParam, fname, out, at, addCast, forward ); 141 return 0; 142 } else { 143 return genScalarCall( srcParam, dstParam, fname, out, type, addCast ); 144 } 144 145 } 145 }146 146 147 /// inserts into out a generated call expression to function fname with arguments dstParam148 /// and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. decl is the149 /// object being constructed. The function wraps constructor and destructor calls in an150 /// ImplicitCtorDtorStmt node.151 template< typename OutputIterator >147 /// inserts into out a generated call expression to function fname with arguments dstParam 148 /// and srcParam. Intended to be used with generated ?=?, ?{}, and ^?{} calls. decl is the 149 /// object being constructed. The function wraps constructor and destructor calls in an 150 /// ImplicitCtorDtorStmt node. 151 template< typename OutputIterator > 152 152 void genImplicitCall( InitTweak::InitExpander & srcParam, Expression * dstParam, const std::string & fname, OutputIterator out, DeclarationWithType * decl, bool forward = true ) { 153 ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl );154 assert( obj );155 // unnamed bit fields are not copied as they cannot be accessed156 if ( isUnnamedBitfield( obj ) ) return;153 ObjectDecl *obj = dynamic_cast<ObjectDecl *>( decl ); 154 assert( obj ); 155 // unnamed bit fields are not copied as they cannot be accessed 156 if ( isUnnamedBitfield( obj ) ) return; 157 157 158 bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) );159 std::list< Statement * > stmts;160 genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward );158 bool addCast = (fname == "?{}" || fname == "^?{}") && ( !obj || ( obj && obj->get_bitfieldWidth() == NULL ) ); 159 std::list< Statement * > stmts; 160 genCall( srcParam, dstParam, fname, back_inserter( stmts ), obj->get_type(), addCast, forward ); 161 161 162 // 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 163 assert( stmts.size() <= 1 ); 164 if ( stmts.size() == 1 ) { 165 Statement * callStmt = stmts.front(); 166 if ( addCast ) { 167 // implicitly generated ctor/dtor calls should be wrapped 168 // so that later passes are aware they were generated. 169 // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield, 170 // because this causes the address to be taken at codegen, which is illegal in C. 171 callStmt = new ImplicitCtorDtorStmt( callStmt ); 172 } 173 *out++ = callStmt; 162 // 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 163 assert( stmts.size() <= 1 ); 164 if ( stmts.size() == 1 ) { 165 Statement * callStmt = stmts.front(); 166 if ( addCast ) { 167 // implicitly generated ctor/dtor calls should be wrapped 168 // so that later passes are aware they were generated. 169 // xxx - don't mark as an implicit ctor/dtor if obj is a bitfield, 170 // because this causes the address to be taken at codegen, which is illegal in C. 171 callStmt = new ImplicitCtorDtorStmt( callStmt ); 172 } 173 *out++ = callStmt; 174 } 174 175 } 175 }176 176 } // namespace SymTab 177 177 #endif // AUTOGEN_H -
src/SymTab/Indexer.cc
r925b7f4 r35df560 493 493 acceptNewScope( compLitExpr->get_result(), *this ); 494 494 maybeAccept( compLitExpr->get_initializer(), *this ); 495 } 496 497 void Indexer::visit( UntypedValofExpr *valofExpr ) { 498 acceptNewScope( valofExpr->get_result(), *this ); 499 maybeAccept( valofExpr->get_body(), *this ); 495 500 } 496 501 -
src/SymTab/Indexer.h
r925b7f4 r35df560 69 69 virtual void visit( ConstructorExpr * ctorExpr ); 70 70 virtual void visit( CompoundLiteralExpr *compLitExpr ); 71 virtual void visit( UntypedValofExpr *valofExpr ); 71 72 virtual void visit( RangeExpr *rangeExpr ); 72 73 virtual void visit( UntypedTupleExpr *tupleExpr ); -
src/SymTab/Validate.cc
r925b7f4 r35df560 115 115 116 116 /// Replaces enum types by int, and function or array types in function parameter and return lists by appropriate pointers. 117 class EnumAndPointerDecay {118 public:119 v oid previsit( EnumDecl *aggregateDecl );120 v oid previsit( FunctionType *func );117 class EnumAndPointerDecayPass final : public Visitor { 118 typedef Visitor Parent; 119 virtual void visit( EnumDecl *aggregateDecl ); 120 virtual void visit( FunctionType *func ); 121 121 }; 122 122 … … 126 126 public: 127 127 LinkReferenceToTypes( bool doDebug, const Indexer *indexer ); 128 private: 128 129 using Parent::visit; 129 130 void visit( EnumInstType *enumInst ) final; … … 135 136 void visit( UnionDecl *unionDecl ) final; 136 137 void visit( TypeInstType *typeInst ) final; 137 private: 138 138 139 const Indexer *indexer; 139 140 … … 146 147 }; 147 148 148 /// Replaces array and function types in forall lists by appropriate pointer type and assigns each Object and Function declaration a unique ID.149 class ForallPointerDecayfinal : public Indexer {149 /// Replaces array and function types in forall lists by appropriate pointer type 150 class Pass3 final : public Indexer { 150 151 typedef Indexer Parent; 151 152 public: 152 153 using Parent::visit; 153 ForallPointerDecay( const Indexer *indexer );154 154 Pass3( const Indexer *indexer ); 155 private: 155 156 virtual void visit( ObjectDecl *object ) override; 156 157 virtual void visit( FunctionDecl *func ) override; … … 159 160 }; 160 161 161 class ReturnChecker : public WithScopes{162 class ReturnChecker { 162 163 public: 163 164 /// Checks that return statements return nothing if their return type is void … … 166 167 private: 167 168 void previsit( FunctionDecl * functionDecl ); 169 void postvisit( FunctionDecl * functionDecl ); 168 170 void previsit( ReturnStmt * returnStmt ); 169 171 170 172 typedef std::list< DeclarationWithType * > ReturnVals; 171 173 ReturnVals returnVals; 174 std::stack< ReturnVals > returnValsStack; 172 175 }; 173 176 … … 245 248 246 249 void validate( std::list< Declaration * > &translationUnit, bool doDebug ) { 247 PassVisitor<EnumAndPointerDecay>epc;250 EnumAndPointerDecayPass epc; 248 251 LinkReferenceToTypes lrt( doDebug, 0 ); 249 ForallPointerDecay fpd( 0 );252 Pass3 pass3( 0 ); 250 253 CompoundLiteral compoundliteral; 251 254 PassVisitor<ValidateGenericParameters> genericParams; … … 259 262 VerifyCtorDtorAssign::verify( translationUnit ); // must happen before autogen, because autogen examines existing ctor/dtors 260 263 Concurrency::applyKeywords( translationUnit ); 261 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecay 264 autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecayPass 262 265 Concurrency::implementMutexFuncs( translationUnit ); 263 266 Concurrency::implementThreadStarter( translationUnit ); 264 267 ReturnChecker::checkFunctionReturns( translationUnit ); 265 268 compoundliteral.mutateDeclarationList( translationUnit ); 266 acceptAll( translationUnit, fpd);269 acceptAll( translationUnit, pass3 ); 267 270 ArrayLength::computeLength( translationUnit ); 268 271 } 269 272 270 273 void validateType( Type *type, const Indexer *indexer ) { 271 PassVisitor<EnumAndPointerDecay>epc;274 EnumAndPointerDecayPass epc; 272 275 LinkReferenceToTypes lrt( false, indexer ); 273 ForallPointerDecay fpd( indexer );276 Pass3 pass3( indexer ); 274 277 type->accept( epc ); 275 278 type->accept( lrt ); 276 type->accept( fpd);279 type->accept( pass3 ); 277 280 } 278 281 … … 353 356 } 354 357 355 void EnumAndPointerDecay ::previsit( EnumDecl *enumDecl ) {358 void EnumAndPointerDecayPass::visit( EnumDecl *enumDecl ) { 356 359 // Set the type of each member of the enumeration to be EnumConstant 357 360 for ( std::list< Declaration * >::iterator i = enumDecl->get_members().begin(); i != enumDecl->get_members().end(); ++i ) { … … 360 363 obj->set_type( new EnumInstType( Type::Qualifiers( Type::Const ), enumDecl->get_name() ) ); 361 364 } // for 365 Parent::visit( enumDecl ); 362 366 } 363 367 … … 366 370 void fixFunctionList( DWTList & dwts, FunctionType * func ) { 367 371 // the only case in which "void" is valid is where it is the only one in the list; then it should be removed 368 // entirely .other fix ups are handled by the FixFunction class372 // entirely other fix ups are handled by the FixFunction class 369 373 typedef typename DWTList::iterator DWTIterator; 370 374 DWTIterator begin( dwts.begin() ), end( dwts.end() ); … … 385 389 for ( ; i != end; ++i ) { 386 390 FixFunction fixer; 387 *i = (*i )->acceptMutator( fixer );391 *i = (*i )->acceptMutator( fixer ); 388 392 if ( fixer.get_isVoid() ) { 389 393 throw SemanticError( "invalid type void in function type ", func ); … … 394 398 } 395 399 396 void EnumAndPointerDecay ::previsit( FunctionType *func ) {400 void EnumAndPointerDecayPass::visit( FunctionType *func ) { 397 401 // Fix up parameters and return types 398 402 fixFunctionList( func->get_parameters(), func ); 399 403 fixFunctionList( func->get_returnVals(), func ); 404 Visitor::visit( func ); 400 405 } 401 406 … … 544 549 } 545 550 546 ForallPointerDecay::ForallPointerDecay( const Indexer *other_indexer ) : Indexer( false ) {551 Pass3::Pass3( const Indexer *other_indexer ) : Indexer( false ) { 547 552 if ( other_indexer ) { 548 553 indexer = other_indexer; … … 582 587 } 583 588 584 void ForallPointerDecay::visit( ObjectDecl *object ) {589 void Pass3::visit( ObjectDecl *object ) { 585 590 forallFixer( object->get_type() ); 586 591 if ( PointerType *pointer = dynamic_cast< PointerType * >( object->get_type() ) ) { … … 591 596 } 592 597 593 void ForallPointerDecay::visit( FunctionDecl *func ) {598 void Pass3::visit( FunctionDecl *func ) { 594 599 forallFixer( func->get_type() ); 595 600 Parent::visit( func ); … … 603 608 604 609 void ReturnChecker::previsit( FunctionDecl * functionDecl ) { 605 GuardValue( returnVals );610 returnValsStack.push( returnVals ); 606 611 returnVals = functionDecl->get_functionType()->get_returnVals(); 612 } 613 void ReturnChecker::postvisit( __attribute__((unused)) FunctionDecl * functionDecl ) { 614 returnVals = returnValsStack.top(); 615 returnValsStack.pop(); 607 616 } 608 617 -
src/SynTree/BaseSyntaxNode.h
r925b7f4 r35df560 24 24 CodeLocation location; 25 25 26 virtual ~BaseSyntaxNode() {} 27 28 virtual void accept( Visitor & v ) = 0; 26 virtual void accept( Visitor & v ) = 0; // temporary -- needs to be here so that BaseSyntaxNode is polymorphic and can be dynamic_cast 29 27 }; 30 28 -
src/SynTree/Constant.cc
r925b7f4 r35df560 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 16:44:48 201713 // Update Count : 2712 // Last Modified On : Thu Jul 30 15:18:38 2015 13 // Update Count : 12 14 14 // 15 15 … … 21 21 #include "Type.h" 22 22 23 Constant::Constant( Type * type, std::string rep, unsigned long long val ) : type( type ), rep( rep ), val( val ) {} 24 Constant::Constant( Type * type, std::string rep, double val ) : type( type ), rep( rep ), val( val ) {} 23 Constant::Constant( Type *type_, std::string value_ ) : type( type_ ), value( value_ ) {} 25 24 26 Constant::Constant( const Constant &other ) : rep( other.rep ), val( other.val ){25 Constant::Constant( const Constant &other ) { 27 26 type = other.type->clone(); 27 value = other.value; 28 28 } 29 29 … … 31 31 32 32 Constant Constant::from_int( int i ) { 33 return Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), std::to_string( i ) , (unsigned long long int)i);33 return Constant( new BasicType( Type::Qualifiers(), BasicType::SignedInt ), std::to_string( i ) ); 34 34 } 35 35 36 36 Constant Constant::from_ulong( unsigned long i ) { 37 return Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), std::to_string( i ) , (unsigned long long int)i);37 return Constant( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), std::to_string( i ) ); 38 38 } 39 39 40 40 Constant Constant::from_double( double d ) { 41 return Constant( new BasicType( Type::Qualifiers(), BasicType::Double ), std::to_string( d ) , d);41 return Constant( new BasicType( Type::Qualifiers(), BasicType::Double ), std::to_string( d ) ); 42 42 } 43 43 44 Constant *Constant::clone() const { assert( false ); return 0; } 45 44 46 void Constant::print( std::ostream &os ) const { 45 os << "(" << rep << " " << val.ival;47 os << "(" << value; 46 48 if ( type ) { 47 49 os << ": "; -
src/SynTree/Constant.h
r925b7f4 r35df560 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 16:44:48 201713 // Update Count : 1412 // Last Modified On : Thu Jun 30 13:33:17 2016 13 // Update Count : 6 14 14 // 15 15 … … 23 23 class Constant { 24 24 public: 25 Constant( Type * type, std::string rep, unsigned long long val ); 26 Constant( Type * type, std::string rep, double val ); 27 Constant( const Constant & other ); 25 Constant( Type *type, std::string value ); 26 Constant( const Constant &other ); 28 27 virtual ~Constant(); 29 28 30 Type * get_type() { return type; }31 void set_type( Type * newValue ) { type = newValue; }32 std::string & get_value() { return rep; }33 void set_value( std::string newValue ) { rep= newValue; }29 Type *get_type() { return type; } 30 void set_type( Type *newValue ) { type = newValue; } 31 std::string &get_value() { return value; } 32 void set_value( std::string newValue ) { value = newValue; } 34 33 35 34 /// generates an integer constant of the given int … … 40 39 static Constant from_double( double d ); 41 40 42 virtual void accept( Visitor & v ) { v.visit( this ); } 43 virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); } 44 virtual void print( std::ostream & os ) const; 41 virtual Constant *clone() const; 42 virtual void accept( Visitor &v ) { v.visit( this ); } 43 virtual Constant *acceptMutator( Mutator &m ) { return m.mutate( this ); } 44 virtual void print( std::ostream &os ) const; 45 45 private: 46 Type * type; 47 std::string rep; 48 union Val { 49 unsigned long long ival; 50 double dval; 51 Val( unsigned long long ival ) : ival( ival ) {} 52 Val( double dval ) : dval( dval ) {} 53 } val; 46 Type *type; 47 std::string value; 54 48 }; 55 49 -
src/SynTree/Expression.cc
r925b7f4 r35df560 288 288 } 289 289 290 // CastExpr *CastExpr::clone() const { return 0; } 291 290 292 void CastExpr::print( std::ostream &os, int indent ) const { 291 293 os << "Cast of:" << std::endl << std::string( indent+2, ' ' ); … … 353 355 } 354 356 357 //// is this right? It's cloning the member, but the member is a declaration so probably shouldn't be cloned... 355 358 MemberExpr::MemberExpr( const MemberExpr &other ) : 356 359 Expression( other ), member( other.member ), aggregate( maybeClone( other.aggregate ) ) { … … 358 361 359 362 MemberExpr::~MemberExpr() { 360 // d on't delete the member declaration, since it points somewhere else in the tree363 // delete member; 361 364 delete aggregate; 362 365 } … … 588 591 } 589 592 593 UntypedValofExpr::UntypedValofExpr( const UntypedValofExpr & other ) : Expression( other ), body ( maybeClone( other.body ) ) {} 594 595 UntypedValofExpr::~UntypedValofExpr() { delete body; } 596 597 void UntypedValofExpr::print( std::ostream &os, int indent ) const { 598 os << std::string( indent, ' ' ) << "Valof Expression: " << std::endl; 599 if ( get_body() != 0 ) 600 get_body()->print( os, indent + 2 ); 601 } 602 590 603 RangeExpr::RangeExpr( Expression *low, Expression *high ) : low( low ), high( high ) {} 591 604 RangeExpr::RangeExpr( const RangeExpr &other ) : Expression( other ), low( other.low->clone() ), high( other.high->clone() ) {} -
src/SynTree/Expression.h
r925b7f4 r35df560 226 226 }; 227 227 228 /// MemberExpr represents a member selection operation, e.g. q.p after processing by the expression analyzer. 229 /// Does not take ownership of member. 228 /// MemberExpr represents a member selection operation, e.g. q.p after processing by the expression analyzer 230 229 class MemberExpr : public Expression { 231 230 public: … … 248 247 }; 249 248 250 /// VariableExpr represents an expression that simply refers to the value of a named variable. 251 /// Does not take ownership of var. 249 /// VariableExpr represents an expression that simply refers to the value of a named variable 252 250 class VariableExpr : public Expression { 253 251 public: … … 600 598 }; 601 599 600 /// ValofExpr represents a GCC 'lambda expression' 601 class UntypedValofExpr : public Expression { 602 public: 603 UntypedValofExpr( Statement *_body, Expression *_aname = nullptr ) : Expression( _aname ), body ( _body ) {} 604 UntypedValofExpr( const UntypedValofExpr & other ); 605 virtual ~UntypedValofExpr(); 606 607 Expression * get_value(); 608 Statement * get_body() const { return body; } 609 610 virtual UntypedValofExpr * clone() const { return new UntypedValofExpr( * this ); } 611 virtual void accept( Visitor & v ) { v.visit( this ); } 612 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 613 virtual void print( std::ostream & os, int indent = 0 ) const; 614 private: 615 Statement * body; 616 }; 617 602 618 /// RangeExpr represents a range e.g. '3 ... 5' or '1~10' 603 619 class RangeExpr : public Expression { -
src/SynTree/Mutator.cc
r925b7f4 r35df560 380 380 } 381 381 382 Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) { 383 valofExpr->set_env( maybeMutate( valofExpr->get_env(), *this ) ); 384 valofExpr->set_result( maybeMutate( valofExpr->get_result(), *this ) ); 385 return valofExpr; 386 } 387 382 388 Expression *Mutator::mutate( RangeExpr *rangeExpr ) { 383 389 rangeExpr->set_env( maybeMutate( rangeExpr->get_env(), *this ) ); -
src/SynTree/Mutator.h
r925b7f4 r35df560 78 78 virtual Expression* mutate( ConstructorExpr *ctorExpr ); 79 79 virtual Expression* mutate( CompoundLiteralExpr *compLitExpr ); 80 virtual Expression* mutate( UntypedValofExpr *valofExpr ); 80 81 virtual Expression* mutate( RangeExpr *rangeExpr ); 81 82 virtual Expression* mutate( UntypedTupleExpr *tupleExpr ); -
src/SynTree/ObjectDecl.cc
r925b7f4 r35df560 56 56 57 57 if ( init ) { 58 os << " with initializer " << std::endl;59 init->print( os, indent +2);60 os << std::endl << std::string(indent +2, ' ');58 os << " with initializer "; 59 init->print( os, indent ); 60 os << std::endl << std::string(indent, ' '); 61 61 os << "maybeConstructed? " << init->get_maybeConstructed(); 62 62 } // if -
src/SynTree/Statement.cc
r925b7f4 r35df560 313 313 } 314 314 315 TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list< CatchStmt *> &_handlers, FinallyStmt *_finallyBlock ) :315 TryStmt::TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<Statement *> &_handlers, FinallyStmt *_finallyBlock ) : 316 316 Statement( labels ), block( tryBlock ), handlers( _handlers ), finallyBlock( _finallyBlock ) { 317 317 } … … 334 334 // handlers 335 335 os << string( indent + 2, ' ' ) << "and handlers: " << endl; 336 for ( std::list< CatchStmt *>::const_iterator i = handlers.begin(); i != handlers.end(); i++)336 for ( std::list<Statement *>::const_iterator i = handlers.begin(); i != handlers.end(); i++) 337 337 (*i )->print( os, indent + 4 ); 338 338 -
src/SynTree/Statement.h
r925b7f4 r35df560 315 315 class TryStmt : public Statement { 316 316 public: 317 TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list< CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 );317 TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<Statement *> &handlers, FinallyStmt *finallyBlock = 0 ); 318 318 TryStmt( const TryStmt &other ); 319 319 virtual ~TryStmt(); … … 321 321 CompoundStmt *get_block() const { return block; } 322 322 void set_block( CompoundStmt *newValue ) { block = newValue; } 323 std::list< CatchStmt *>& get_catchers() { return handlers; }323 std::list<Statement *>& get_catchers() { return handlers; } 324 324 325 325 FinallyStmt *get_finally() const { return finallyBlock; } … … 333 333 private: 334 334 CompoundStmt *block; 335 std::list< CatchStmt *> handlers;335 std::list<Statement *> handlers; 336 336 FinallyStmt *finallyBlock; 337 337 }; -
src/SynTree/Visitor.cc
r925b7f4 r35df560 301 301 } 302 302 303 void Visitor::visit( UntypedValofExpr *valofExpr ) { 304 maybeAccept( valofExpr->get_result(), *this ); 305 maybeAccept( valofExpr->get_body(), *this ); 306 } 307 303 308 void Visitor::visit( RangeExpr *rangeExpr ) { 304 309 maybeAccept( rangeExpr->get_low(), *this ); -
src/SynTree/Visitor.h
r925b7f4 r35df560 81 81 virtual void visit( ConstructorExpr * ctorExpr ); 82 82 virtual void visit( CompoundLiteralExpr *compLitExpr ); 83 virtual void visit( UntypedValofExpr *valofExpr ); 83 84 virtual void visit( RangeExpr *rangeExpr ); 84 85 virtual void visit( UntypedTupleExpr *tupleExpr ); … … 162 163 } // if 163 164 } catch( SemanticError &e ) { 164 e.set_location( (*i)->location ); 165 e.set_location( (*i)->location ); 165 166 errors.append( e ); 166 167 } // try -
src/Tuples/TupleExpansion.cc
r925b7f4 r35df560 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 21 17:35:04201713 // Update Count : 1 912 // Last Modified On : Thu Mar 16 08:05:17 2017 13 // Update Count : 15 14 14 // 15 15 … … 191 191 commaExpr->set_arg1( nullptr ); 192 192 } 193 ObjectDecl * finished = new ObjectDecl( toString( "_unq", id, "_finished_" ), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::Bool ),194 new SingleInit( new ConstantExpr( Constant::from_int( 0) ), noDesignators ) );193 BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool ); 194 ObjectDecl * finished = new ObjectDecl( toString( "_unq", id, "_finished_" ), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, new BasicType( Type::Qualifiers(), BasicType::Bool ), new SingleInit( new ConstantExpr( Constant( boolType->clone(), "0" ) ), noDesignators ) ); 195 195 addDeclaration( finished ); 196 196 // (finished ? _unq_expr_N : (_unq_expr_N = <unqExpr->get_expr()>, finished = 1, _unq_expr_N)) 197 197 // This pattern ensures that each unique expression is evaluated once, regardless of evaluation order of the generated C code. 198 Expression * assignFinished = UntypedExpr::createAssign( new VariableExpr(finished), new ConstantExpr( Constant ::from_int( 1) ) );198 Expression * assignFinished = UntypedExpr::createAssign( new VariableExpr(finished), new ConstantExpr( Constant( boolType->clone(), "1" ) ) ); 199 199 ConditionalExpr * condExpr = new ConditionalExpr( new VariableExpr( finished ), var->clone(), 200 200 new CommaExpr( new CommaExpr( assignUnq, assignFinished ), var->clone() ) );
Note:
See TracChangeset
for help on using the changeset viewer.