summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/Analysis.cpp
diff options
context:
space:
mode:
authorGordon Henriksen <gordonhenriksen@mac.com>2007-10-06 21:00:36 +0000
committerGordon Henriksen <gordonhenriksen@mac.com>2007-10-06 21:00:36 +0000
commitc3d661a0eec50ac21f9b0c2564d7a11be2001d97 (patch)
treeb3b2d5fb60e4ff6e0ecae9d1d9bed1f954fe3400 /llvm/lib/Analysis/Analysis.cpp
parentae0ec1d09fd68828adc5f0bb0186e4e15c6a8589 (diff)
downloadbcm5719-llvm-c3d661a0eec50ac21f9b0c2564d7a11be2001d97.tar.gz
bcm5719-llvm-c3d661a0eec50ac21f9b0c2564d7a11be2001d97.zip
Bindings for the verifier.
llvm-svn: 42707
Diffstat (limited to 'llvm/lib/Analysis/Analysis.cpp')
-rw-r--r--llvm/lib/Analysis/Analysis.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/Analysis.cpp b/llvm/lib/Analysis/Analysis.cpp
new file mode 100644
index 00000000000..6403f2d7faf
--- /dev/null
+++ b/llvm/lib/Analysis/Analysis.cpp
@@ -0,0 +1,38 @@
+//===-- Analysis.cpp ------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm-c/Analysis.h"
+#include "llvm/Analysis/Verifier.h"
+#include <fstream>
+
+using namespace llvm;
+
+int LLVMVerifyModule(LLVMModuleRef M, LLVMVerifierFailureAction Action,
+ char **OutMessages) {
+ std::string Messages;
+
+ int Result = verifyModule(*unwrap(M),
+ static_cast<VerifierFailureAction>(Action),
+ OutMessages? &Messages : 0);
+
+ if (OutMessages)
+ *OutMessages = strdup(Messages.c_str());
+
+ return Result;
+}
+
+void LLVMDisposeVerifierMessage(char *Message) {
+ free(Message);
+}
+
+int LLVMVerifyFunction(LLVMValueRef Fn, LLVMVerifierFailureAction Action) {
+ return verifyFunction(*unwrap<Function>(Fn),
+ static_cast<VerifierFailureAction>(Action));
+}
+
OpenPOWER on IntegriCloud