diff --git a/llvm/_core.c b/llvm/_core.c index 46df19d..775e48d 100644 --- a/llvm/_core.c +++ b/llvm/_core.c @@ -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 ) diff --git a/llvm/core.py b/llvm/core.py index 372d523..3e52e56 100644 --- a/llvm/core.py +++ b/llvm/core.py @@ -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.