Skip to content

Commit

Permalink
Merge pull request #121 from frasercrmck/check-errors
Browse files Browse the repository at this point in the history
[host] Ensure we always check llvm::Error objects
  • Loading branch information
frasercrmck authored Sep 5, 2023
2 parents 360442b + 686664a commit cfb4689
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/compiler/targets/host/source/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ HostKernel::lookupOrCreateOptimizedKernel(std::array<size_t, 3> local_size) {
callback(llvm::toString(std::move(err)).c_str(), /*data*/ nullptr,
/*data_size*/ 0);
}
llvm::consumeError(std::move(err));
return cargo::make_unexpected(compiler::Result::FINALIZE_PROGRAM_FAILURE);
}
// Register this JITDylib so we can clear up its resources later.
Expand Down Expand Up @@ -362,6 +363,7 @@ HostKernel::lookupOrCreateOptimizedKernel(std::array<size_t, 3> local_size) {
callback(llvm::toString(std::move(err)).c_str(), /*data*/ nullptr,
/*data_size*/ 0);
}
llvm::consumeError(std::move(err));
return cargo::make_unexpected(compiler::Result::FINALIZE_PROGRAM_FAILURE);
}

Expand All @@ -373,6 +375,7 @@ HostKernel::lookupOrCreateOptimizedKernel(std::array<size_t, 3> local_size) {
callback(llvm::toString(std::move(err)).c_str(), /*data*/ nullptr,
/*data_size*/ 0);
}
llvm::consumeError(std::move(err));
return cargo::make_unexpected(compiler::Result::FINALIZE_PROGRAM_FAILURE);
}

Expand All @@ -388,6 +391,7 @@ HostKernel::lookupOrCreateOptimizedKernel(std::array<size_t, 3> local_size) {
callback(llvm::toString(std::move(err)).c_str(), /*data*/ nullptr,
/*data_size*/ 0);
}
llvm::consumeError(std::move(err));
return cargo::make_unexpected(
compiler::Result::FINALIZE_PROGRAM_FAILURE);
}
Expand Down
2 changes: 2 additions & 0 deletions modules/compiler/targets/host/source/target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ compiler::Result HostTarget::initWithBuiltins(
callback(llvm::toString(std::move(err)).c_str(), /*data*/ nullptr,
/*data_size*/ 0);
}
llvm::consumeError(std::move(err));
return compiler::Result::OUT_OF_MEMORY;
}
orc_engine = std::move(*JIT);
Expand All @@ -239,6 +240,7 @@ compiler::Result HostTarget::initWithBuiltins(
callback(llvm::toString(std::move(err)).c_str(), /*data*/ nullptr,
/*data_size*/ 0);
}
llvm::consumeError(std::move(err));
return compiler::Result::FAILURE;
}
target_machine = std::move(*TM);
Expand Down

0 comments on commit cfb4689

Please sign in to comment.