[libc-commits] [libc] 2e870e6 - [libc] Fix incorrect element type in RPC handler
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Wed Feb 11 18:56:19 PST 2026
Author: Joseph Huber
Date: 2026-02-11T20:56:00-06:00
New Revision: 2e870e615d42b487e039873bdacbcd2bc94f7fb4
URL: https://github.com/llvm/llvm-project/commit/2e870e615d42b487e039873bdacbcd2bc94f7fb4
DIFF: https://github.com/llvm/llvm-project/commit/2e870e615d42b487e039873bdacbcd2bc94f7fb4.diff
LOG: [libc] Fix incorrect element type in RPC handler
Added:
Modified:
libc/shared/rpc_dispatch.h
libc/shared/rpc_util.h
Removed:
################################################################################
diff --git a/libc/shared/rpc_dispatch.h b/libc/shared/rpc_dispatch.h
index b977faf56fdc6..98a7cace4ee6d 100644
--- a/libc/shared/rpc_dispatch.h
+++ b/libc/shared/rpc_dispatch.h
@@ -102,9 +102,10 @@ RPC_ATTRS constexpr void prepare_arg(rpc::Server::Port &port) {
template <uint64_t Idx, typename Tuple>
RPC_ATTRS constexpr void finish_arg(rpc::Client::Port &port, Tuple &t) {
using ArgTy = rpc::tuple_element_t<Idx, Tuple>;
+ using ElemTy = rpc::remove_pointer_t<ArgTy>;
using MemoryTy = rpc::remove_const_t<rpc::remove_pointer_t<ArgTy>> *;
if constexpr (rpc::is_pointer_v<ArgTy> && !rpc::is_const_v<ArgTy> &&
- rpc::is_complete_v<MemoryTy> && !rpc::is_void_v<MemoryTy>) {
+ rpc::is_complete_v<ElemTy> && !rpc::is_void_v<ElemTy>) {
uint64_t size{};
void *buf{};
port.recv_n(&buf, &size, [&](uint64_t) {
diff --git a/libc/shared/rpc_util.h b/libc/shared/rpc_util.h
index b75dbad3d94f6..a7d9d72a4b113 100644
--- a/libc/shared/rpc_util.h
+++ b/libc/shared/rpc_util.h
@@ -82,6 +82,7 @@ template <typename T> struct is_void : type_constant<bool, false> {};
template <> struct is_void<void> : type_constant<bool, true> {};
template <typename T> RPC_ATTRS constexpr bool is_void_v = is_void<T>::value;
+// Scary trait that can change within a TU, use with caution.
template <typename...> using void_t = void;
template <typename T, typename = void>
struct is_complete : type_constant<bool, false> {};
@@ -89,7 +90,7 @@ template <typename T>
struct is_complete<T, void_t<decltype(sizeof(T))>> : type_constant<bool, true> {
};
template <typename T>
-inline constexpr bool is_complete_v = is_complete<T>::value;
+RPC_ATTRS constexpr bool is_complete_v = is_complete<T>::value;
template <typename T>
struct is_trivially_copyable
More information about the libc-commits
mailing list