[llvm] r218775 - C API: Add LLVMCloneModule()

Tom Stellard thomas.stellard at amd.com
Wed Oct 1 10:14:57 PDT 2014


Author: tstellar
Date: Wed Oct  1 12:14:57 2014
New Revision: 218775

URL: http://llvm.org/viewvc/llvm-project?rev=218775&view=rev
Log:
C API: Add LLVMCloneModule()

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

Modified: llvm/trunk/include/llvm-c/Core.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm-c/Core.h?rev=218775&r1=218774&r2=218775&view=diff
==============================================================================
--- llvm/trunk/include/llvm-c/Core.h (original)
+++ llvm/trunk/include/llvm-c/Core.h Wed Oct  1 12:14:57 2014
@@ -560,6 +560,10 @@ LLVMModuleRef LLVMModuleCreateWithName(c
  */
 LLVMModuleRef LLVMModuleCreateWithNameInContext(const char *ModuleID,
                                                 LLVMContextRef C);
+/**
+ * Return an exact copy of the specified module.
+ */
+LLVMModuleRef LLVMCloneModule(LLVMModuleRef M);
 
 /**
  * Destroy a module instance.

Modified: llvm/trunk/lib/Transforms/Utils/CloneModule.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneModule.cpp?rev=218775&r1=218774&r2=218775&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneModule.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneModule.cpp Wed Oct  1 12:14:57 2014
@@ -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 *
 
   return New;
 }
+
+extern "C" {
+
+LLVMModuleRef LLVMCloneModule(LLVMModuleRef M) {
+  return wrap(CloneModule(unwrap(M)));
+}
+
+}





More information about the llvm-commits mailing list