From 7880cdd3badbe861d34982941b2c3497635a177d Mon Sep 17 00:00:00 2001 From: Siu Kwan Lam Date: Wed, 15 Aug 2012 16:09:08 -0700 Subject: [PATCH] Fix get intrinsic --- llvm/extra.cpp | 4 ++-- llvm/wrap.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/extra.cpp b/llvm/extra.cpp index 2fde2ba..500367f 100644 --- a/llvm/extra.cpp +++ b/llvm/extra.cpp @@ -706,7 +706,7 @@ template void unwrap_vec(W *values, unsigned n, std::vector& out) { out.clear(); - + out.reserve(n); while (n--) { UW *p = llvm::unwrap(*values); assert(p); @@ -847,7 +847,7 @@ LLVMValueRef LLVMGetIntrinsic(LLVMModuleRef module, int id, assert(modulep); llvm::Function *intfunc = llvm::Intrinsic::getDeclaration(modulep, - llvm::Intrinsic::ID(id), types_vec[0]); + llvm::Intrinsic::ID(id), types_vec); return wrap(intfunc); } diff --git a/llvm/wrap.h b/llvm/wrap.h index 5d1c736..3fa84d9 100644 --- a/llvm/wrap.h +++ b/llvm/wrap.h @@ -1054,7 +1054,7 @@ _w ## func (PyObject *self, PyObject *args) \ { \ PyObject *obj1, *obj2; \ intype1 arg1; \ - intype2 *arg2v; \ + intype2 *arg2v = NULL; \ unsigned arg2n; \ int arg3; \ outtype ret; \ @@ -1064,7 +1064,7 @@ _w ## func (PyObject *self, PyObject *args) \ \ arg1 = ( intype1 ) PyCapsule_GetPointer(obj1, NULL); \ arg2n = (unsigned) PyList_Size(obj2); \ - if (!(arg2v = ( intype2 *)make_array_from_list(obj2, arg2n)))\ + if (arg2n && !(arg2v = ( intype2 *)make_array_from_list(obj2, arg2n)))\ return PyErr_NoMemory(); \ \ ret = func (arg1, arg2v, arg2n, arg3); \