Added viewCFG methods to Function class, patch from ph.silva#gmail.com

git-svn-id: http://llvm-py.googlecode.com/svn/trunk@39 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
mdevan.foobar 2008-09-09 12:33:48 +00:00
commit f42a40c120
2 changed files with 10 additions and 0 deletions

View file

@ -418,6 +418,8 @@ _wrap_obj2obj(LLVMGetFunctionCallConv, LLVMValueRef, int)
_wrap_objint2none(LLVMSetFunctionCallConv, LLVMValueRef)
_wrap_obj2str(LLVMGetCollector, LLVMValueRef)
_wrap_objstr2none(LLVMSetCollector, LLVMValueRef)
_wrap_obj2none(LLVMViewFunctionCFG, LLVMValueRef)
_wrap_obj2none(LLVMViewFunctionCFGOnly, LLVMValueRef)
static PyObject *
_wLLVMVerifyFunction(PyObject *self, PyObject *args)
@ -1101,6 +1103,8 @@ static PyMethodDef core_methods[] = {
_method( LLVMGetCollector )
_method( LLVMSetCollector )
_method( LLVMVerifyFunction )
_method( LLVMViewFunctionCFG )
_method( LLVMViewFunctionCFGOnly )
/* Arguments */
_method( LLVMCountParams )

View file

@ -1645,6 +1645,12 @@ class Function(GlobalValue):
return wrapiter(_core.LLVMGetFirstBasicBlock,
_core.LLVMGetNextBasicBlock, self.ptr, BasicBlock)
def viewCFG(self):
return _core.LLVMViewFunctionCFG(self.ptr)
def viewCFGOnly(self):
return _core.LLVMViewFunctionCFGOnly(self.ptr)
def verify(self):
# Although we're just asking LLVM to return the success or
# failure, it appears to print result to stderr and abort.