Expose preserve flag for Module.link_in
This commit is contained in:
parent
d491d91dd2
commit
03e54f2c12
1 changed files with 7 additions and 7 deletions
|
|
@ -450,7 +450,7 @@ class Module(llvm.Ownable, llvm.Cacheable):
|
||||||
llvm::Module::AnyPointerSize."""
|
llvm::Module::AnyPointerSize."""
|
||||||
return _core.LLVMModuleGetPointerSize(self.ptr)
|
return _core.LLVMModuleGetPointerSize(self.ptr)
|
||||||
|
|
||||||
def link_in(self, other):
|
def link_in(self, other, preserve=False):
|
||||||
"""Link the `other' module into this one.
|
"""Link the `other' module into this one.
|
||||||
|
|
||||||
The `other' module is linked into this one such that types,
|
The `other' module is linked into this one such that types,
|
||||||
|
|
@ -463,10 +463,10 @@ class Module(llvm.Ownable, llvm.Cacheable):
|
||||||
Linker class.
|
Linker class.
|
||||||
"""
|
"""
|
||||||
check_is_module(other)
|
check_is_module(other)
|
||||||
|
if not preserve:
|
||||||
other.forget() # remove it from object cache
|
other.forget() # remove it from object cache
|
||||||
ret = _core.LLVMLinkModules(self.ptr, other.ptr)
|
_core.LLVMLinkModules(self.ptr, other.ptr, int(bool(preserve)))
|
||||||
if isinstance(ret, str):
|
if not preserve:
|
||||||
raise llvm.LLVMException(ret)
|
|
||||||
# Do not try to destroy the other module's llvm::Module*.
|
# Do not try to destroy the other module's llvm::Module*.
|
||||||
other._own(llvm.DummyOwner())
|
other._own(llvm.DummyOwner())
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue