C API: Add LLVMCloneModule()
authorTom Stellard <thomas.stellard@amd.com>
Wed, 1 Oct 2014 17:14:57 +0000 (17:14 +0000)
committerTom Stellard <thomas.stellard@amd.com>
Wed, 1 Oct 2014 17:14:57 +0000 (17:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218775 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm-c/Core.h
lib/Transforms/Utils/CloneModule.cpp

index e5d5f3f99bd4edade9683208a547f770ae7b6306..bfbc632290254beba495b821625fcfb47e127560 100644 (file)
@@ -560,6 +560,10 @@ LLVMModuleRef LLVMModuleCreateWithName(const char *ModuleID);
  */
 LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID,
                                                 LLVMContextRef C);
+/**
+ * Return an exact copy of the specified module.
+ */
+LLVMModuleRef LLVMCloneModule(LLVMModuleRef M);
 
 /**
  * Destroy a module instance.
index 3f75b3e677eead94ffb46f522a1dbecd5ebd6b67..d078c96f3720de6ee146a51a9baab5ecf5c3452a 100644 (file)
@@ -17,6 +17,7 @@
 #include "llvm/IR/DerivedTypes.h"
 #include "llvm/IR/Module.h"
 #include "llvm/Transforms/Utils/ValueMapper.h"
+#include "llvm-c/Core.h"
 using namespace llvm;
 
 /// CloneModule - Return an exact copy of the specified module.  This is not as
@@ -122,3 +123,11 @@ Module *llvm::CloneModule(const Module *M, ValueToValueMapTy &VMap) {
 
   return New;
 }
+
+extern "C" {
+
+LLVMModuleRef LLVMCloneModule(LLVMModuleRef M) {
+  return wrap(CloneModule(unwrap(M)));
+}
+
+}