Removed cyclic dependency _util <-> core. Added testcases. Passes in _core.c. Code cleanup.

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@32 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
mdevan.foobar 2008-08-11 17:11:57 +00:00
commit 4ee007190c
7 changed files with 293 additions and 92 deletions

View file

@ -2,7 +2,6 @@
Used only in other modules, not for public use."""
import llvm.core as core
import llvm
@ -17,15 +16,6 @@ def check_gen(obj, type):
msg = "argument not an instance of llvm.core.%s" % type_str
raise TypeError, msg
def check_is_type(obj): check_gen(obj, core.Type)
def check_is_value(obj): check_gen(obj, core.Value)
def check_is_pointer(obj): check_gen(obj, core.Pointer)
def check_is_constant(obj): check_gen(obj, core.Constant)
def check_is_function(obj): check_gen(obj, core.Function)
def check_is_basic_block(obj): check_gen(obj, core.BasicBlock)
def check_is_module(obj): check_gen(obj, core.Module)
def check_is_module_provider(obj): check_gen(obj, core.ModuleProvider)
def check_is_unowned(ownable):
if ownable.owner:
raise llvm.LLVMException, "object is already owned"
@ -41,10 +31,6 @@ def unpack_gen(objlist, check_fn):
for obj in objlist: check_fn(obj)
return [ obj.ptr for obj in objlist ]
def unpack_types(objlist): return unpack_gen(objlist, check_is_type)
def unpack_values(objlist): return unpack_gen(objlist, check_is_value)
def unpack_constants(objlist): return unpack_gen(objlist, check_is_constant)
#===----------------------------------------------------------------------===
# Helper to wrap over iterables (LLVMFirstXXX, LLVMNextXXX). This used