fix exception handling for TargetMachine

This commit is contained in:
Siu Kwan Lam 2013-08-12 14:42:49 -05:00
commit c20c4d776f

View file

@ -282,7 +282,7 @@ class TargetMachine(llvm.Wrapper):
with contextlib.closing(BytesIO()) as error:
target = api.llvm.TargetRegistry.lookupTarget(triple, error)
if not target:
raise llvm.LLVMException(error)
raise llvm.LLVMException(error.getvalue())
if not target.hasTargetMachine():
raise llvm.LLVMException(target, "No target machine.")
target_options = api.llvm.TargetOptions.new()