github.com/Konstantin8105/c4go@v0.0.0-20240505174241-768bb1c65a51/ast/decl_ref_expr_test.go (about)

     1  package ast
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestDeclRefExpr(t *testing.T) {
     8  	nodes := map[string]Node{
     9  		`0x7fc972064460 <col:8> 'FILE *' lvalue ParmVar 0x7fc9720642d0 '_p' 'FILE *'`: &DeclRefExpr{
    10  			Addr:       0x7fc972064460,
    11  			Pos:        NewPositionFromString("col:8"),
    12  			Type:       "FILE *",
    13  			Type1:      "",
    14  			IsLvalue:   true,
    15  			For:        "ParmVar",
    16  			Address2:   "0x7fc9720642d0",
    17  			Name:       "_p",
    18  			Type2:      "FILE *",
    19  			Type3:      "",
    20  			ChildNodes: []Node{},
    21  		},
    22  		`0x7fc97206a958 <col:11> 'int (int, FILE *)' Function 0x7fc972064198 '__swbuf' 'int (int, FILE *)'`: &DeclRefExpr{
    23  			Addr:       0x7fc97206a958,
    24  			Pos:        NewPositionFromString("col:11"),
    25  			Type:       "int (int, FILE *)",
    26  			Type1:      "",
    27  			IsLvalue:   false,
    28  			For:        "Function",
    29  			Address2:   "0x7fc972064198",
    30  			Name:       "__swbuf",
    31  			Type2:      "int (int, FILE *)",
    32  			Type3:      "",
    33  			ChildNodes: []Node{},
    34  		},
    35  		`0x7fa36680f170 <col:19> 'struct programming':'struct programming' lvalue Var 0x7fa36680dc20 'variable' 'struct programming':'struct programming'`: &DeclRefExpr{
    36  			Addr:       0x7fa36680f170,
    37  			Pos:        NewPositionFromString("col:19"),
    38  			Type:       "struct programming",
    39  			Type1:      "struct programming",
    40  			IsLvalue:   true,
    41  			For:        "Var",
    42  			Address2:   "0x7fa36680dc20",
    43  			Name:       "variable",
    44  			Type2:      "struct programming",
    45  			Type3:      "struct programming",
    46  			ChildNodes: []Node{},
    47  		},
    48  		`0x35cb438 <col:13> 'int' EnumConstant 0x35ca300 'Jan' 'int'`: &DeclRefExpr{
    49  			Addr:       0x35cb438,
    50  			Pos:        NewPositionFromString("col:13"),
    51  			Type:       "int",
    52  			Type1:      "",
    53  			IsLvalue:   false,
    54  			For:        "EnumConstant",
    55  			Address2:   "0x35ca300",
    56  			Name:       "Jan",
    57  			Type2:      "int",
    58  			Type3:      "",
    59  			ChildNodes: []Node{},
    60  		},
    61  		`0x1ff8770 <col:33> 'T_ENUM':'T_ENUM' lvalue Var 0x1ff8600 'cc' 'T_ENUM':'T_ENUM'`: &DeclRefExpr{
    62  			Addr:       0x1ff8770,
    63  			Pos:        NewPositionFromString("col:33"),
    64  			Type:       "T_ENUM",
    65  			Type1:      "T_ENUM",
    66  			IsLvalue:   true,
    67  			For:        "Var",
    68  			Address2:   "0x1ff8600",
    69  			Name:       "cc",
    70  			Type2:      "T_ENUM",
    71  			Type3:      "T_ENUM",
    72  			ChildNodes: []Node{},
    73  		},
    74  		`0x2961ea8 <col:109> 'YYSTYPE *' lvalue Var 0x295fd88 'yyvs' 'YYSTYPE *' non_odr_use_unevaluated`: &DeclRefExpr{
    75  			Addr:       0x2961ea8,
    76  			Pos:        NewPositionFromString("col:109"),
    77  			Type:       "YYSTYPE *",
    78  			IsLvalue:   true,
    79  			For:        "Var",
    80  			Address2:   "0x295fd88",
    81  			Name:       "yyvs",
    82  			Type2:      "YYSTYPE *",
    83  			Other:      " non_odr_use_unevaluated",
    84  			ChildNodes: []Node{},
    85  		},
    86  		`0x1f54868 <col:44> 'struct plotframe_type':'struct plotframe_type' lvalue Var 0x1ec6a60 'plot' 'struct plotframe_type':'struct plotframe_type' non_odr_use_unevaluated`: &DeclRefExpr{
    87  			Addr:       0x1f54868,
    88  			Pos:        NewPositionFromString("col:44"),
    89  			Type:       "struct plotframe_type",
    90  			Type1:      "struct plotframe_type",
    91  			IsLvalue:   true,
    92  			For:        "Var",
    93  			Address2:   "0x1ec6a60",
    94  			Name:       "plot",
    95  			Type2:      "struct plotframe_type",
    96  			Type3:      "struct plotframe_type",
    97  			Other:      " non_odr_use_unevaluated",
    98  			ChildNodes: []Node{},
    99  		},
   100  	}
   101  
   102  	runNodeTests(t, nodes)
   103  }