Changeset a16e246
- Timestamp:
- May 23, 2019, 5:34:16 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 94b1f718
- Parents:
- af1e8f56
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Print.cpp
raf1e8f56 ra16e246 231 231 --indent; 232 232 } 233 233 234 234 if ( node->extension ) { 235 235 os << std::endl << indent << "... with extension"; … … 659 659 660 660 virtual const ast::Expr * visit( const ast::SizeofExpr * node ) { 661 os << "Sizeof Expression on: "; 662 ++indent; 663 if ( node->type ) node->type->accept( *this ); 664 else safe_print( node->expr ); 665 --indent; 666 postprint( node ); 667 661 668 return node; 662 669 } 663 670 664 671 virtual const ast::Expr * visit( const ast::AlignofExpr * node ) { 672 os << "Alignof Expression on: "; 673 ++indent; 674 if ( node->type ) node->type->accept( *this ); 675 else safe_print( node->expr ); 676 --indent; 677 postprint( node ); 678 665 679 return node; 666 680 } 667 681 668 682 virtual const ast::Expr * visit( const ast::UntypedOffsetofExpr * node ) { 683 os << "Untyped Offsetof Expression on member " << node->member << " of "; 684 ++indent; 685 safe_print( node->type ); 686 --indent; 687 postprint( node ); 688 669 689 return node; 670 690 } 671 691 672 692 virtual const ast::Expr * visit( const ast::OffsetofExpr * node ) { 693 os << "Offsetof Expression on member " << node->member->name << " of "; 694 ++indent; 695 safe_print( node->type ); 696 --indent; 697 postprint( node ); 698 673 699 return node; 674 700 } 675 701 676 702 virtual const ast::Expr * visit( const ast::OffsetPackExpr * node ) { 703 os << "Offset Pack Expression on: "; 704 ++indent; 705 safe_print( node->type ); 706 --indent; 707 postprint( node ); 708 677 709 return node; 678 710 } 679 711 680 712 virtual const ast::Expr * visit( const ast::LogicalExpr * node ) { 713 os << "Short-circuited operation (" << (node->isAnd ? "and" : "or") << ") on: "; 714 safe_print( node->arg1 ); 715 os << " and "; 716 safe_print( node->arg2 ); 717 postprint( node ); 718 681 719 return node; 682 720 } 683 721 684 722 virtual const ast::Expr * visit( const ast::ConditionalExpr * node ) { 723 ++indent; 724 os << "Conditional expression on:" << std::endl << indent; 725 safe_print( node->arg1 ); 726 os << indent-1 << "First alternative:" << std::endl << indent; 727 safe_print( node->arg2 ); 728 os << indent-1 << "Second alternative:" << std::endl << indent; 729 safe_print( node->arg3 ); 730 --indent; 731 postprint( node ); 732 685 733 return node; 686 734 } 687 735 688 736 virtual const ast::Expr * visit( const ast::CommaExpr * node ) { 737 ++indent; 738 os << "Comma Expression:" << std::endl << indent; 739 safe_print( node->arg1 ); 740 os << std::endl << indent; 741 safe_print( node->arg2 ); 742 --indent; 743 postprint( node ); 744 689 745 return node; 690 746 } 691 747 692 748 virtual const ast::Expr * visit( const ast::TypeExpr * node ) { 749 safe_print( node->type ); 750 postprint( node ); 751 693 752 return node; 694 753 } 695 754 696 755 virtual const ast::Expr * visit( const ast::AsmExpr * node ) { 756 os << "Asm Expression:" << std::endl; 757 ++indent; 758 if ( node->inout ) node->inout->accept( *this ); 759 if ( node->constraint ) node->constraint->accept( *this ); 760 if ( node->operand ) node->operand->accept( *this ); 761 --indent; 762 697 763 return node; 698 764 } 699 765 700 766 virtual const ast::Expr * visit( const ast::ImplicitCopyCtorExpr * node ) { 767 ++indent; 768 os << "Implicit Copy Constructor Expression:" << std::endl << indent; 769 safe_print( node->callExpr ); 770 os << std::endl << indent-1 << "... with temporaries:" << std::endl; 771 printAll( node->tempDecls ); 772 os << std::endl << indent-1 << "... with return temporaries:" << std::endl; 773 printAll( node->returnDecls ); 774 --indent; 775 postprint( node ); 776 701 777 return node; 702 778 } 703 779 704 780 virtual const ast::Expr * visit( const ast::ConstructorExpr * node ) { 781 os << "Constructor Expression:" << std::endl << indent+1; 782 indent += 2; 783 safe_print( node->callExpr ); 784 indent -= 2; 785 postprint( node ); 786 705 787 return node; 706 788 } 707 789 708 790 virtual const ast::Expr * visit( const ast::CompoundLiteralExpr * node ) { 791 ++indent; 792 os << "Compound Literal Expression: " << std::endl << indent; 793 safe_print( node->result ); 794 os << indent; 795 safe_print( node->init ); 796 --indent; 797 postprint( node ); 798 709 799 return node; 710 800 } 711 801 712 802 virtual const ast::Expr * visit( const ast::RangeExpr * node ) { 803 os << "Range Expression: "; 804 safe_print( node->low ); 805 os << " ... "; 806 safe_print( node->high ); 807 postprint( node ); 808 713 809 return node; 714 810 } 715 811 716 812 virtual const ast::Expr * visit( const ast::UntypedTupleExpr * node ) { 813 os << "Untyped Tuple:" << std::endl; 814 ++indent; 815 printAll( node->exprs ); 816 --indent; 817 postprint( node ); 818 717 819 return node; 718 820 } 719 821 720 822 virtual const ast::Expr * visit( const ast::TupleExpr * node ) { 823 os << "Tuple:" << std::endl; 824 ++indent; 825 printAll( node->exprs ); 826 --indent; 827 postprint( node ); 828 721 829 return node; 722 830 } 723 831 724 832 virtual const ast::Expr * visit( const ast::TupleIndexExpr * node ) { 833 os << "Tuple Index Expression, with tuple:" << std::endl; 834 ++indent; 835 os << indent; 836 safe_print( node->tuple ); 837 os << indent << "with index: " << node->index << std::endl; 838 --indent; 839 postprint( node ); 840 725 841 return node; 726 842 } 727 843 728 844 virtual const ast::Expr * visit( const ast::TupleAssignExpr * node ) { 845 os << "Tuple Assignment Expression, with stmt expr:" << std::endl; 846 ++indent; 847 os << indent; 848 safe_print( node->stmtExpr ); 849 --indent; 850 postprint( node ); 851 729 852 return node; 730 853 } 731 854 732 855 virtual const ast::Expr * visit( const ast::StmtExpr * node ) { 856 ++indent; 857 os << "Statement Expression:" << std::endl << indent; 858 safe_print( node->stmts ); 859 if ( ! node->returnDecls.empty() ) { 860 os << indent << "... with returnDecls: "; 861 printAll( node->returnDecls ); 862 } 863 if ( ! node->dtors.empty() ) { 864 os << indent << "... with dtors: "; 865 printAll( node->dtors ); 866 } 867 --indent; 868 postprint( node ); 869 733 870 return node; 734 871 } 735 872 736 873 virtual const ast::Expr * visit( const ast::UniqueExpr * node ) { 874 ++indent; 875 os << "Unique Expression with id: " << node->id << std::endl << indent; 876 safe_print( node->expr ); 877 if ( node->object ) { 878 os << indent-1 << "... with decl: "; 879 short_print( node->object ); 880 } 881 --indent; 882 postprint( node ); 883 737 884 return node; 738 885 } 739 886 740 887 virtual const ast::Expr * visit( const ast::UntypedInitExpr * node ) { 888 ++indent; 889 os << "Untyped Init Expression" << std::endl << indent; 890 safe_print( node->expr ); 891 if ( ! node->initAlts.empty() ) { 892 for ( const InitAlternative & alt : node->initAlts ) { 893 os << indent << "InitAlternative: "; 894 safe_print( alt.type ); 895 safe_print( alt.designation ); 896 } 897 } 898 --indent; 899 741 900 return node; 742 901 } 743 902 744 903 virtual const ast::Expr * visit( const ast::InitExpr * node ) { 904 ++indent; 905 os << "Init Expression" << std::endl << indent; 906 safe_print( node->expr ); 907 os << indent << "... with designation: "; 908 safe_print( node->designation ); 909 --indent; 910 745 911 return node; 746 912 } 747 913 748 914 virtual const ast::Expr * visit( const ast::DeletedExpr * node ) { 915 ++indent; 916 os << "Deleted Expression" << std::endl << indent; 917 safe_print( node->expr ); 918 os << std::endl << indent << "... deleted by: "; 919 safe_print( node->deleteStmt ); 920 --indent; 921 749 922 return node; 750 923 } 751 924 752 925 virtual const ast::Expr * visit( const ast::DefaultArgExpr * node ) { 926 ++indent; 927 os << "Default Argument Expression" << std::endl << indent; 928 safe_print( node->expr ); 929 --indent; 930 753 931 return node; 754 932 } 755 933 756 934 virtual const ast::Expr * visit( const ast::GenericExpr * node ) { 935 ++indent; 936 os << "C11 _Generic Expression" << std::endl << indent; 937 safe_print( node->control ); 938 os << std::endl << indent << "... with associations:" << std::endl; 939 for ( const auto & assoc : node->associations ) { 940 os << indent; 941 if ( assoc.type ) { 942 os << "... type: "; 943 assoc.type->accept( *this ); 944 os << std::endl << indent << "... expression: "; 945 safe_print( assoc.expr ); 946 } else { 947 os << "... default: "; 948 safe_print( assoc.expr ); 949 } 950 os << std::endl; 951 } 952 --indent; 953 757 954 return node; 758 955 }
Note: See TracChangeset
for help on using the changeset viewer.