Clean up remnants of `const char*` -> `string_view` migration for return types.

No behavior change, just removing the transitional code.

PiperOrigin-RevId: 722766820
pull/20207/head
Protobuf Team Bot 3 weeks ago committed by Copybara-Service
parent 9e1fdb0c01
commit 7e93fe636a
  1. 26
      src/google/protobuf/descriptor.h
  2. 2
      src/google/protobuf/port_def.inc

@ -204,12 +204,6 @@ typedef absl::string_view DescriptorStringView;
typedef const std::string& DescriptorStringView;
#endif
#if defined(PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE_TYPENAME)
typedef absl::string_view DescriptorTypenameStringView;
#else
typedef const char* DescriptorTypenameStringView;
#endif
class FlatAllocator;
class PROTOBUF_EXPORT LazyDescriptor {
@ -882,10 +876,10 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase,
Type type() const; // Declared type of this field.
// Name of the declared type.
internal::DescriptorTypenameStringView type_name() const;
absl::string_view type_name() const;
CppType cpp_type() const; // C++ type of this field.
// Name of the C++ type.
internal::DescriptorTypenameStringView cpp_type_name() const;
absl::string_view cpp_type_name() const;
Label label() const; // optional/required/repeated
#ifndef SWIG
@ -1037,10 +1031,10 @@ class PROTOBUF_EXPORT FieldDescriptor : private internal::SymbolBase,
static CppType TypeToCppType(Type type);
// Helper method to get the name of a Type.
static internal::DescriptorTypenameStringView TypeName(Type type);
static absl::string_view TypeName(Type type);
// Helper method to get the name of a CppType.
static internal::DescriptorTypenameStringView CppTypeName(CppType cpp_type);
static absl::string_view CppTypeName(CppType cpp_type);
// Return true iff [packed = true] is valid for fields of this type.
static inline bool IsTypePackable(Type field_type);
@ -2918,8 +2912,7 @@ inline int MethodDescriptor::index() const {
return static_cast<int>(this - service_->methods_);
}
inline internal::DescriptorTypenameStringView FieldDescriptor::type_name()
const {
inline absl::string_view FieldDescriptor::type_name() const {
return kTypeToName[type()];
}
@ -2927,8 +2920,7 @@ inline FieldDescriptor::CppType FieldDescriptor::cpp_type() const {
return kTypeToCppTypeMap[type()];
}
inline internal::DescriptorTypenameStringView FieldDescriptor::cpp_type_name()
const {
inline absl::string_view FieldDescriptor::cpp_type_name() const {
return kCppTypeToName[kTypeToCppTypeMap[type()]];
}
@ -2936,13 +2928,11 @@ inline FieldDescriptor::CppType FieldDescriptor::TypeToCppType(Type type) {
return kTypeToCppTypeMap[type];
}
inline internal::DescriptorTypenameStringView FieldDescriptor::TypeName(
Type type) {
inline absl::string_view FieldDescriptor::TypeName(Type type) {
return kTypeToName[type];
}
inline internal::DescriptorTypenameStringView FieldDescriptor::CppTypeName(
CppType cpp_type) {
inline absl::string_view FieldDescriptor::CppTypeName(CppType cpp_type) {
return kCppTypeToName[cpp_type];
}

@ -155,8 +155,6 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#endif
#define PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE 1
#define PROTOBUF_FUTURE_STRING_VIEW_RETURN_TYPE_TYPENAME 1
#ifdef PROTOBUF_ALWAYS_INLINE
#error PROTOBUF_ALWAYS_INLINE was previously defined
#endif

Loading…
Cancel
Save