Allow function.verify to raise exception on error.
This commit is contained in:
parent
1647580a41
commit
42f7219c3f
1 changed files with 7 additions and 1 deletions
|
|
@ -1508,7 +1508,13 @@ class Function(GlobalValue):
|
||||||
# Note: LLVM has a bug in preverifier that will always abort
|
# Note: LLVM has a bug in preverifier that will always abort
|
||||||
# the process upon failure.
|
# the process upon failure.
|
||||||
actions = api.llvm.VerifierFailureAction
|
actions = api.llvm.VerifierFailureAction
|
||||||
return api.llvm.verifyFunction(self._ptr, actions.PrintMessageAction)
|
broken = api.llvm.verifyFunction(self._ptr,
|
||||||
|
actions.ReturnStatusAction)
|
||||||
|
if broken:
|
||||||
|
# If broken, then re-run to print the message
|
||||||
|
api.llvm.verifyFunction(self._ptr, actions.PrintMessageAction)
|
||||||
|
raise llvm.LLVMException("Function %s failed verification" %
|
||||||
|
self.name)
|
||||||
|
|
||||||
#===----------------------------------------------------------------------===
|
#===----------------------------------------------------------------------===
|
||||||
# InlineAsm
|
# InlineAsm
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue