Drop unused argument for GenericValue.pointer().
This commit is contained in:
parent
9aadd489c3
commit
4783429804
2 changed files with 25 additions and 7 deletions
|
|
@ -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);
|
||||
|
|
|
|||
24
llvm/ee.py
24
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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue