File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change 17
17
<http://www.gnu.org/licenses/>.
18
18
*/
19
19
20
+ typedef int mytype ;
21
+ typedef mytype nestedtype ;
Original file line number Diff line number Diff line change @@ -55,5 +55,18 @@ def dump_real_type(t):
55
55
dump_real_type (gcc .Type .float ())
56
56
dump_real_type (gcc .Type .double ())
57
57
58
+ def dump_typedef (td ):
59
+ t = td .type
60
+ print ('gcc.TypeDecl: %r' % str (td ))
61
+ print (' td.original_type: %r' % td .original_type )
62
+ print (' td.original_type is gcc.Type.int(): %r' % (td .original_type is gcc .Type .int ()))
63
+ mytype = gccutils .get_global_typedef ('mytype' )
64
+ print (' td.original_type.name: %r' % td .original_type .name )
65
+ print (' td.original_type.name is mytype: %r' % (td .original_type .name is mytype ))
66
+ dump_integer_type (t )
67
+
68
+ dump_typedef (gccutils .get_global_typedef ('mytype' ))
69
+ dump_typedef (gccutils .get_global_typedef ('nestedtype' ))
70
+
58
71
gcc .register_callback (gcc .PLUGIN_FINISH_UNIT ,
59
72
on_finish_unit )
Original file line number Diff line number Diff line change @@ -25,3 +25,27 @@ gcc.Type: 'double'
25
25
t.const: False
26
26
t.precision: 64
27
27
t.sizeof: 8
28
+ gcc.TypeDecl: 'mytype'
29
+ td.original_type: gcc.IntegerType(name=gcc.TypeDecl('int'))
30
+ td.original_type is gcc.Type.int(): True
31
+ td.original_type.name: gcc.TypeDecl('int')
32
+ td.original_type.name is mytype: False
33
+ gcc.Type: 'mytype'
34
+ t.const: False
35
+ t.unsigned: False
36
+ t.precision: 32
37
+ t.min_value.constant: -2147483648
38
+ t.max_value.constant: 2147483647
39
+ t.sizeof: 4
40
+ gcc.TypeDecl: 'nestedtype'
41
+ td.original_type: gcc.IntegerType(name=gcc.TypeDecl('mytype'))
42
+ td.original_type is gcc.Type.int(): False
43
+ td.original_type.name: gcc.TypeDecl('mytype')
44
+ td.original_type.name is mytype: True
45
+ gcc.Type: 'nestedtype'
46
+ t.const: False
47
+ t.unsigned: False
48
+ t.precision: 32
49
+ t.min_value.constant: -2147483648
50
+ t.max_value.constant: 2147483647
51
+ t.sizeof: 4
You can’t perform that action at this time.
0 commit comments