module.get_X_named() methods throws if object of given name is not found.
updated docs. git-svn-id: http://llvm-py.googlecode.com/svn/trunk@27 8d1e9007-1d4e-0410-b67e-1979fd6579aa
This commit is contained in:
parent
6d57b0e5bc
commit
95dd7669ca
14 changed files with 238 additions and 106 deletions
10
llvm/core.py
10
llvm/core.py
|
|
@ -1483,7 +1483,10 @@ class GlobalVariable(GlobalValue):
|
|||
|
||||
@staticmethod
|
||||
def get(module, name):
|
||||
return GlobalVariable(_core.LLVMGetNamedGlobal(module.ptr, name), module)
|
||||
ptr = _core.LLVMGetNamedGlobal(module.ptr, name)
|
||||
if not ptr:
|
||||
raise llvm.LLVMException, ("no global named `%s`" % name)
|
||||
return GlobalVariable(ptr, name)
|
||||
|
||||
def __init__(self, ptr, module):
|
||||
GlobalValue.__init__(self, ptr, module)
|
||||
|
|
@ -1539,7 +1542,10 @@ class Function(GlobalValue):
|
|||
|
||||
@staticmethod
|
||||
def get(module, name):
|
||||
return Function(_core.LLVMGetNamedFunction(module.ptr, name), module)
|
||||
ptr = _core.LLVMGetNamedFunction(module.ptr, name)
|
||||
if not ptr:
|
||||
raise llvm.LLVMException, ("no function named `%s`" % name)
|
||||
return Function(ptr, module)
|
||||
|
||||
@staticmethod
|
||||
def intrinsic(module, id, types):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue