Expose Function::viewCFG and Function::viewCFGOnly to bindings.
[oota-llvm.git] / lib / Analysis / Analysis.cpp
index 6403f2d7faf94023577d96ecb5906281efd7903c..493c6e88b3f8ed978dab0daab73ec53833bdb54a 100644 (file)
@@ -2,14 +2,15 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Gordon Henriksen and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 
 #include "llvm-c/Analysis.h"
 #include "llvm/Analysis/Verifier.h"
 #include <fstream>
+#include <cstring>
 
 using namespace llvm;
 
@@ -27,12 +28,17 @@ int LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
   return Result;
 }
 
-void LLVMDisposeVerifierMessage(char *Message) {
-  free(Message);
-}
-
 int LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action) {
   return verifyFunction(*unwrap<Function>(Fn),
                         static_cast<VerifierFailureAction>(Action));
 }
 
+void LLVMViewFunctionCFG(LLVMValueRef Fn) {
+  Function *F = unwrap<Function>(Fn);
+  F->viewCFG();
+}
+
+void LLVMViewFunctionCFGOnly(LLVMValueRef Fn) {
+  Function *F = unwrap<Function>(Fn);
+  F->viewCFGOnly();
+}