Skip to content

Commit 1ae6762

Browse files
committed
Update for the new ORCJIT error model
1 parent 2eea502 commit 1ae6762

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Sources/LLVM/JIT.swift

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,22 @@ public final class JIT {
257257
try checkForJITError(LLVMOrcRemoveModule(self.llvm, handle.llvm))
258258
}
259259

260-
private func checkForJITError(_ orcError: LLVMOrcErrorCode) throws {
261-
switch orcError {
262-
case LLVMOrcErrSuccess:
260+
private func checkForJITError(_ orcError: LLVMErrorRef!) throws {
261+
guard let err = orcError else {
263262
return
264-
case LLVMOrcErrGeneric:
265-
guard let msg = LLVMOrcGetErrorMsg(self.llvm) else {
263+
}
264+
265+
switch LLVMGetErrorTypeId(err)! {
266+
case LLVMGetStringErrorTypeId():
267+
guard let msg = LLVMGetErrorMessage(self.llvm) else {
266268
fatalError("Couldn't get the error message?")
267269
}
268270
throw JITError.generic(String(cString: msg))
269271
default:
270-
fatalError("Uncategorized ORC error code!")
272+
guard let msg = LLVMOrcGetErrorMsg(self.llvm) else {
273+
fatalError("Couldn't get the error message?")
274+
}
275+
throw JITError.generic(String(cString: msg))
271276
}
272277
}
273278
}

0 commit comments

Comments
 (0)