can now clone modules
This commit is contained in:
parent
e0d1b94053
commit
d781e83bd1
5 changed files with 64 additions and 0 deletions
|
|
@ -297,6 +297,7 @@ _wLLVMLinkModules(PyObject *self, PyObject *args)
|
|||
|
||||
_wrap_objstr2obj(LLVMModuleGetOrInsertNamedMetaData, LLVMModuleRef, LLVMNamedMDRef)
|
||||
_wrap_objstr2obj(LLVMModuleGetNamedMetaData, LLVMModuleRef, LLVMNamedMDRef)
|
||||
_wrap_obj2obj(LLVMCloneModule, LLVMModuleRef, LLVMModuleRef)
|
||||
|
||||
/*===----------------------------------------------------------------------===*/
|
||||
/* Types */
|
||||
|
|
@ -1577,6 +1578,7 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMLinkModules )
|
||||
_method( LLVMModuleGetOrInsertNamedMetaData )
|
||||
_method( LLVMModuleGetNamedMetaData )
|
||||
_method( LLVMCloneModule )
|
||||
|
||||
/* Types */
|
||||
|
||||
|
|
|
|||
|
|
@ -582,6 +582,9 @@ class Module(llvm.Ownable, llvm.Cacheable):
|
|||
ptr = _core.LLVMModuleGetNamedMetaData(self.ptr, name)
|
||||
return NamedMetaData(ptr)
|
||||
|
||||
def clone(self):
|
||||
return Module(_core.LLVMCloneModule(self.ptr))
|
||||
|
||||
#===----------------------------------------------------------------------===
|
||||
# Types
|
||||
#===----------------------------------------------------------------------===
|
||||
|
|
|
|||
|
|
@ -135,6 +135,12 @@ const CodeGenOpt::Level OptLevelMap[] = {
|
|||
};
|
||||
} // end anony namespace
|
||||
|
||||
LLVMModuleRef LLVMCloneModule(LLVMModuleRef mod)
|
||||
{
|
||||
using namespace llvm;
|
||||
return wrap(CloneModule(unwrap(mod)));
|
||||
}
|
||||
|
||||
const char * LLVMDumpNamedMDToString(LLVMNamedMDRef nmd)
|
||||
{
|
||||
using namespace llvm;
|
||||
|
|
|
|||
|
|
@ -54,6 +54,13 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Wraps llvm::CloneModule
|
||||
*/
|
||||
LLVMModuleRef LLVMCloneModule(LLVMModuleRef mod);
|
||||
|
||||
|
||||
/*
|
||||
* Wraps NamedMDNode::print()
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue