From f42a40c120d623009ef51a0e1e75baf2785d7146 Mon Sep 17 00:00:00 2001 From: "mdevan.foobar" Date: Tue, 9 Sep 2008 12:33:48 +0000 Subject: [PATCH] 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 --- llvm/_core.c | 4 ++++ llvm/core.py | 6 ++++++ 2 files changed, 10 insertions(+) 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.