1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00

C API: Add LLVMCloneModule()

llvm-svn: 218775
This commit is contained in:
Tom Stellard 2014-10-01 17:14:57 +00:00
parent 784352be06
commit a5133e90d3
2 changed files with 13 additions and 0 deletions

View 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.

View 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)));
}
}