diff --git a/llvm/_core.cpp b/llvm/_core.cpp index 52310f1..765d106 100644 --- a/llvm/_core.cpp +++ b/llvm/_core.cpp @@ -1180,18 +1180,18 @@ _wLLVMCreateGenericValueOfFloat(PyObject *self, PyObject *args) static PyObject * _wLLVMCreateGenericValueOfPointer(PyObject *self, PyObject *args) { - PyObject *obj1; - LLVMTypeRef ty; +// PyObject *obj1; +// LLVMTypeRef ty; //unused? unsigned long long n_; size_t n; LLVMGenericValueRef gv; - if (!PyArg_ParseTuple(args, "OL", &obj1, &n_)) + if (!PyArg_ParseTuple(args, "L", &n_)) return NULL; n=n_; - ty = (LLVMTypeRef) PyCapsule_GetPointer(obj1, NULL); +// ty = (LLVMTypeRef) PyCapsule_GetPointer(obj1, NULL); gv = LLVMCreateGenericValueOfPointer((void*)n); return ctor_LLVMGenericValueRef(gv); diff --git a/llvm/ee.py b/llvm/ee.py index 62795a0..904716e 100644 --- a/llvm/ee.py +++ b/llvm/ee.py @@ -36,7 +36,9 @@ import llvm # top-level, for common stuff import llvm.core as core # module, function etc. import llvm._core as _core # C wrappers import llvm._util as _util # utility functions +import logging +logger = logging.getLogger(__name__) #===----------------------------------------------------------------------=== # Enumerations @@ -141,9 +143,25 @@ class GenericValue(object): return GenericValue(ptr) @staticmethod - def pointer(ty, intval): - core.check_is_type(ty) - ptr = _core.LLVMCreateGenericValueOfPointer(ty.ptr, intval) + def pointer(*args): + ''' + One argument version takes (addr). + Two argument version takes (ty, addr). [Deprecated] + + `ty` is unused. + `addr` is an integer representing an address. + + TODO: remove two argument version. + ''' + if len(args)==2: + logger.warning("Deprecated: Two argument version of " + "GenericValue.pointer() is deprecated.") + addr = args[1] + elif len(args)!=1: + raise TypeError("pointer() takes 1 or 2 arguments.") + else: + addr = args[0] + ptr = _core.LLVMCreateGenericValueOfPointer(addr) return GenericValue(ptr) def __init__(self, ptr):