Skip to content

Commit

Permalink
Merge pull request #163 from frasercrmck/fix-use-after-move
Browse files Browse the repository at this point in the history
[host] Fix move-after-move errors
  • Loading branch information
frasercrmck authored Oct 17, 2023
2 parents 6b333da + 0551bc3 commit ec5bcfb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 8 additions & 4 deletions modules/compiler/targets/host/source/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,9 @@ HostKernel::lookupOrCreateOptimizedKernel(std::array<size_t, 3> local_size) {
if (auto callback = target.getNotifyCallbackFn()) {
callback(llvm::toString(std::move(err)).c_str(), /*data*/ nullptr,
/*data_size*/ 0);
} else {
llvm::consumeError(std::move(err));
}
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 All @@ -362,8 +363,9 @@ HostKernel::lookupOrCreateOptimizedKernel(std::array<size_t, 3> local_size) {
if (auto callback = target.getNotifyCallbackFn()) {
callback(llvm::toString(std::move(err)).c_str(), /*data*/ nullptr,
/*data_size*/ 0);
} else {
llvm::consumeError(std::move(err));
}
llvm::consumeError(std::move(err));
return cargo::make_unexpected(compiler::Result::FINALIZE_PROGRAM_FAILURE);
}

Expand All @@ -374,8 +376,9 @@ HostKernel::lookupOrCreateOptimizedKernel(std::array<size_t, 3> local_size) {
if (auto callback = target.getNotifyCallbackFn()) {
callback(llvm::toString(std::move(err)).c_str(), /*data*/ nullptr,
/*data_size*/ 0);
} else {
llvm::consumeError(std::move(err));
}
llvm::consumeError(std::move(err));
return cargo::make_unexpected(compiler::Result::FINALIZE_PROGRAM_FAILURE);
}

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

0 comments on commit ec5bcfb

Please sign in to comment.