llvmpy/test/malloc.py
Siu Kwan Lam a09394cacd Fix a lots of bugs in the newbinding to pass all the tests.
NOTE: debug info has not been implemented yet.
2013-02-13 15:52:53 -06:00

16 lines
421 B
Python

from llvm.core import *
def test():
m = Module.new('sdf')
f = m.add_function(Type.function(Type.void(), []), 'foo')
bb = f.append_basic_block('entry')
b = Builder.new(bb)
alloc = b.malloc(Type.int(), 'ha')
inst = b.free(alloc)
alloc = b.malloc_array(Type.int(), Constant.int(Type.int(), 10), 'hee')
inst = b.free(alloc)
b.ret_void()
print m
if __name__ == '__main__':
test()