File: typehandle.py

package info (click to toggle)
llvm-py 0.6%2Bsvn105-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 2,060 kB
  • sloc: python: 3,844; ansic: 1,963; cpp: 508; pascal: 87; makefile: 9; sh: 1
file content (19 lines) | stat: -rwxr-xr-x 396 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python

from llvm.core import *

# create a type handle object
th = TypeHandle.new(Type.opaque())

# create the struct with an opaque* instead of self*
ts = Type.struct([ Type.int(), Type.pointer(th.type) ])

# unify the types
th.type.refine(ts)

# create a module, and add a "typedef"
m = Module.new('mod1')
m.add_type_name("struct.node", th.type)

# show what we created
print m