Add llvm::Module::addLibrary to exposed API
This commit is contained in:
parent
4307287b39
commit
7b6aac79fb
4 changed files with 16 additions and 0 deletions
|
|
@ -87,6 +87,7 @@ _wrap_obj2str(LLVMGetDataLayout, LLVMModuleRef)
|
|||
_wrap_objstr2none(LLVMSetDataLayout, LLVMModuleRef)
|
||||
_wrap_obj2str(LLVMGetTarget, LLVMModuleRef)
|
||||
_wrap_objstr2none(LLVMSetTarget, LLVMModuleRef)
|
||||
_wrap_objstr2none(LLVMModuleAddLibrary, LLVMModuleRef)
|
||||
_wrap_objstr2obj(LLVMGetTypeByName, LLVMModuleRef, LLVMTypeRef)
|
||||
_wrap_obj2none(LLVMDumpModule, LLVMModuleRef)
|
||||
_wrap_obj2none(LLVMDisposeModule, LLVMModuleRef)
|
||||
|
|
@ -1321,6 +1322,7 @@ static PyMethodDef core_methods[] = {
|
|||
_method( LLVMSetDataLayout )
|
||||
_method( LLVMGetTarget )
|
||||
_method( LLVMSetTarget )
|
||||
_method( LLVMModuleAddLibrary )
|
||||
_method( LLVMGetTypeByName )
|
||||
_method( LLVMDumpModule )
|
||||
_method( LLVMDisposeModule )
|
||||
|
|
|
|||
|
|
@ -505,6 +505,9 @@ class Module(llvm.Ownable, llvm.Cacheable):
|
|||
raise llvm.LLVMException("Unable to create bitcode")
|
||||
fileobj.write(data)
|
||||
|
||||
def add_library(self, name):
|
||||
return _core.LLVMModuleAddLibrary(self.ptr, name)
|
||||
|
||||
|
||||
#===----------------------------------------------------------------------===
|
||||
# Types
|
||||
|
|
|
|||
|
|
@ -100,6 +100,14 @@ char *LLVMDumpModuleToString(LLVMModuleRef module)
|
|||
return strdup(buf.str().c_str());
|
||||
}
|
||||
|
||||
void LLVMModuleAddLibrary(LLVMModuleRef module, const char *name)
|
||||
{
|
||||
llvm::Module *M = llvm::unwrap(module);
|
||||
llvm::StringRef namestr = llvm::StringRef(name);
|
||||
M->addLibrary(namestr);
|
||||
return;
|
||||
}
|
||||
|
||||
char *LLVMDumpTypeToString(LLVMTypeRef type)
|
||||
{
|
||||
return do_print<LLVMTypeRef, llvm::Type>(type);
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@ extern "C" {
|
|||
* LLVMDisposeMessage(). */
|
||||
char *LLVMDumpModuleToString(LLVMModuleRef module);
|
||||
|
||||
/* Wraps llvm::Module::addLibrary(name). */
|
||||
void LLVMModuleAddLibrary(LLVMModuleRef module, const char *name);
|
||||
|
||||
/* Wraps llvm::Type::print(). Dispose the returned string after use, via
|
||||
* LLVMDisposeMessage(). */
|
||||
char *LLVMDumpTypeToString(LLVMTypeRef type);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue