[llvm] [Support] Remove an unnecessary cast (NFC) (PR #151083)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 28 22:32:51 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/151083

NumRead is already of ssize_t.


>From ec852171e606f9879b3ed50cc14777a240ad0791 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sun, 27 Jul 2025 12:12:39 -0700
Subject: [PATCH] [Support] Remove an unnecessary cast (NFC)

NumRead is already of ssize_t.
---
 llvm/lib/Support/Unix/Path.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index 277247e3cc236..cc02cae40ec76 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -1190,7 +1190,7 @@ Expected<size_t> readNativeFile(file_t FD, MutableArrayRef<char> Buf) {
   size_t Size = Buf.size();
 #endif
   ssize_t NumRead = sys::RetryAfterSignal(-1, ::read, FD, Buf.data(), Size);
-  if (ssize_t(NumRead) == -1)
+  if (NumRead == -1)
     return errorCodeToError(errnoAsErrorCode());
 // The underlying operation on these platforms allow opening directories
 // for reading in more cases than other platforms.



More information about the llvm-commits mailing list