llvmpy/test/typehandle.py
mdevan.foobar df4365921d Patch for OpenBSD, x86_64 support (Laurence Tratt)
Added JIT tutorial ports (Sebastien Binet)
Updated documentation

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@23 8d1e9007-1d4e-0410-b67e-1979fd6579aa
2008-07-05 06:33:51 +00:00

19 lines
396 B
Python

#!/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