[llvm] [ADT][NFC] Fix documentation for arrayRefFromStringRef (PR #203430)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 12 08:40:09 PDT 2026
https://github.com/qcoelh0 updated https://github.com/llvm/llvm-project/pull/203430
>From 3680bc45c9c949a67b3057bed39a0642d4adefab Mon Sep 17 00:00:00 2001
From: Quentin Coelho <qcoelho at nvidia.com>
Date: Thu, 11 Jun 2026 17:00:58 -0700
Subject: [PATCH 1/2] [ADT][NFC] Fix documentation for arrayRefFromStringRef
The documentation was describing the opposite behavior of what it does.
---
llvm/include/llvm/ADT/StringExtras.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h
index 017859d3d8c3c..9ce22df32c54d 100644
--- a/llvm/include/llvm/ADT/StringExtras.h
+++ b/llvm/include/llvm/ADT/StringExtras.h
@@ -63,7 +63,7 @@ inline StringRef toStringRef(ArrayRef<char> Input) {
return StringRef(Input.begin(), Input.size());
}
-/// Construct a string ref from an array ref of unsigned chars.
+/// Construct an array ref of unsigned bytes from a string ref.
template <class CharT = uint8_t>
inline ArrayRef<CharT> arrayRefFromStringRef(StringRef Input) {
static_assert(std::is_same<CharT, char>::value ||
>From aa7114f831f00238b72dbc06a0727b8c9c073e58 Mon Sep 17 00:00:00 2001
From: Quentin <qcoelho at nvidia.com>
Date: Fri, 12 Jun 2026 08:40:00 -0700
Subject: [PATCH 2/2] Apply suggestion from @svenvh
Co-authored-by: Sven van Haastregt <sven.vanhaastregt at arm.com>
---
llvm/include/llvm/ADT/StringExtras.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/llvm/include/llvm/ADT/StringExtras.h b/llvm/include/llvm/ADT/StringExtras.h
index 9ce22df32c54d..e3cc6dcb25755 100644
--- a/llvm/include/llvm/ADT/StringExtras.h
+++ b/llvm/include/llvm/ADT/StringExtras.h
@@ -63,7 +63,7 @@ inline StringRef toStringRef(ArrayRef<char> Input) {
return StringRef(Input.begin(), Input.size());
}
-/// Construct an array ref of unsigned bytes from a string ref.
+/// Construct an array ref of bytes from a string ref.
template <class CharT = uint8_t>
inline ArrayRef<CharT> arrayRefFromStringRef(StringRef Input) {
static_assert(std::is_same<CharT, char>::value ||
More information about the llvm-commits
mailing list