[llvm] [Offload][NFC] use unique ptrs for platforms (PR #160888)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 26 07:00:19 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- offload/liboffload/src/OffloadImpl.cpp
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/offload/liboffload/src/OffloadImpl.cpp b/offload/liboffload/src/OffloadImpl.cpp
index 70fc97c15..051882da7 100644
--- a/offload/liboffload/src/OffloadImpl.cpp
+++ b/offload/liboffload/src/OffloadImpl.cpp
@@ -118,17 +118,16 @@ struct ol_device_impl_t {
}
};
-
llvm::Error ol_platform_impl_t::destroy() {
- llvm::Error Result = Plugin::success();
- for (auto &D : Devices)
- if (auto Err = D->destroy())
- Result = llvm::joinErrors(std::move(Result), std::move(Err));
+ llvm::Error Result = Plugin::success();
+ for (auto &D : Devices)
+ if (auto Err = D->destroy())
+ Result = llvm::joinErrors(std::move(Result), std::move(Err));
- if (auto Res = Plugin->deinit())
- Result = llvm::joinErrors(std::move(Result), std::move(Res));
+ if (auto Res = Plugin->deinit())
+ Result = llvm::joinErrors(std::move(Result), std::move(Res));
- return Result;
+ return Result;
}
struct ol_queue_impl_t {
@@ -280,8 +279,8 @@ Error initPlugins(OffloadContext &Context) {
// Add the special host device
auto &HostPlatform = Context.Platforms.emplace_back(
std::make_unique<ol_platform_impl_t>(nullptr, OL_PLATFORM_BACKEND_HOST));
- HostPlatform->Devices.emplace_back(
- std::make_unique<ol_device_impl_t>(-1, nullptr, *HostPlatform, InfoTreeNode{}));
+ HostPlatform->Devices.emplace_back(std::make_unique<ol_device_impl_t>(
+ -1, nullptr, *HostPlatform, InfoTreeNode{}));
Context.TracingEnabled = std::getenv("OFFLOAD_TRACE");
Context.ValidationEnabled = !std::getenv("OFFLOAD_DISABLE_VALIDATION");
``````````
</details>
https://github.com/llvm/llvm-project/pull/160888
More information about the llvm-commits
mailing list