[llvm] [Orc] Fix error handling (PR #95253)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 12 06:56:11 PDT 2024
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/95253
I believe we should return after the SDR for the error case, instead of invoking it a second time with Error::success().
I have no idea how to test this (or if that's even possible), I just found this through a static analyser warning.
>From c336326ea94b3fb03b090759a30198c391ab2d94 Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Wed, 12 Jun 2024 15:54:24 +0200
Subject: [PATCH] [Orc] Fix error handling
I believe we should return after the SDR for the error case, instead
of invoking it a second time with Error::success().
I have no idea how to test this (or if that's even possible), I
just found this through a static analyser warning.
---
.../llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
index bdb5ac143c34a..2521bda0b42cf 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/WrapperFunctionUtils.h
@@ -503,8 +503,10 @@ class WrapperFunction<SPSRetTagT(SPSTagTs...)> {
SPSInputBuffer IB(R.data(), R.size());
if (auto Err = detail::ResultDeserializer<SPSRetTagT, RetT>::deserialize(
- RetVal, R.data(), R.size()))
+ RetVal, R.data(), R.size())) {
SDR(std::move(Err), std::move(RetVal));
+ return;
+ }
SDR(Error::success(), std::move(RetVal));
};
More information about the llvm-commits
mailing list