From cf304cba61b53d914de28ee07ff6f5b7bdb847f6 Mon Sep 17 00:00:00 2001
From: Chris Kennelly <ckennelly@google.com>
Date: Fri, 14 Jul 2023 15:41:49 -0700
Subject: [PATCH] Include string_view in overload set.

PiperOrigin-RevId: 548240332
---
 src/google/protobuf/wire_format_lite.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h
index 3097a14f51..7e42c67ddf 100644
--- a/src/google/protobuf/wire_format_lite.h
+++ b/src/google/protobuf/wire_format_lite.h
@@ -47,6 +47,7 @@
 #include "google/protobuf/port.h"
 #include "absl/base/casts.h"
 #include "absl/log/absl_check.h"
+#include "absl/strings/string_view.h"
 #include "google/protobuf/arenastring.h"
 #include "google/protobuf/io/coded_stream.h"
 #include "google/protobuf/message_lite.h"
@@ -738,6 +739,8 @@ class PROTOBUF_EXPORT WireFormatLite {
   static inline size_t StringSize(const absl::Cord& value);
   static inline size_t BytesSize(const std::string& value);
   static inline size_t BytesSize(const absl::Cord& value);
+  static inline size_t StringSize(absl::string_view value);
+  static inline size_t BytesSize(absl::string_view value);
 
   template <typename MessageType>
   static inline size_t GroupSize(const MessageType& value);
@@ -1835,6 +1838,15 @@ inline size_t WireFormatLite::StringSize(const absl::Cord& value) {
   return LengthDelimitedSize(value.size());
 }
 
+inline size_t WireFormatLite::StringSize(const absl::string_view value) {
+  // WARNING:  In wire_format.cc, both strings and bytes are handled by
+  //   StringSize() to avoid code duplication.  If the implementations become
+  //   different, you will need to update that usage.
+  return LengthDelimitedSize(value.size());
+}
+inline size_t WireFormatLite::BytesSize(const absl::string_view value) {
+  return LengthDelimitedSize(value.size());
+}
 
 template <typename MessageType>
 inline size_t WireFormatLite::GroupSize(const MessageType& value) {