소스 검색

Create fewer temporary `String`s when computing JSON names. (#1807)

Tony Allevato 9 달 전
부모
커밋
b8f52f8728

+ 208 - 205
Protos/SwiftProtobufTests/generated_swift_names_enum_cases.proto

@@ -822,209 +822,212 @@ enum GeneratedSwiftReservedEnum {
   sawBackslash = 815;
   sawSection4Characters = 816;
   sawSection5Characters = 817;
-  scan = 818;
-  scanner = 819;
-  seconds = 820;
-  self = 821;
-  semantic = 822;
-  Sendable = 823;
-  separator = 824;
-  serialize = 825;
-  serializedBytes = 826;
-  serializedData = 827;
-  serializedSize = 828;
-  serverStreaming = 829;
-  service = 830;
-  set = 831;
-  setExtensionValue = 832;
-  shift = 833;
-  SimpleExtensionMap = 834;
-  size = 835;
-  sizer = 836;
-  source = 837;
-  sourceCodeInfo = 838;
-  sourceContext = 839;
-  sourceEncoding = 840;
-  sourceFile = 841;
-  SourceLocation = 842;
-  span = 843;
-  split = 844;
-  start = 845;
-  startArray = 846;
-  startArrayObject = 847;
-  startField = 848;
-  startIndex = 849;
-  startMessageField = 850;
-  startObject = 851;
-  startRegularField = 852;
-  state = 853;
-  static = 854;
-  StaticString = 855;
-  storage = 856;
-  String = 857;
-  stringLiteral = 858;
-  StringLiteralType = 859;
-  stringResult = 860;
-  stringValue = 861;
-  struct = 862;
-  structValue = 863;
-  subDecoder = 864;
-  subscript = 865;
-  subtract = 866;
-  subVisitor = 867;
-  Swift = 868;
-  swiftPrefix = 869;
-  SwiftProtobufContiguousBytes = 870;
-  SwiftProtobufError = 871;
-  syntax = 872;
-  T = 873;
-  tag = 874;
-  targets = 875;
-  terminator = 876;
-  testDecoder = 877;
-  text = 878;
-  textDecoder = 879;
-  TextFormatDecoder = 880;
-  TextFormatDecodingError = 881;
-  TextFormatDecodingOptions = 882;
-  TextFormatEncodingOptions = 883;
-  TextFormatEncodingVisitor = 884;
-  textFormatString = 885;
-  throwOrIgnore = 886;
-  throws = 887;
-  timeInterval = 888;
-  timeIntervalSince1970 = 889;
-  timeIntervalSinceReferenceDate = 890;
-  tmp = 891;
-  tooLarge = 892;
-  total = 893;
-  totalArrayDepth = 894;
-  totalSize = 895;
-  trailingComments = 896;
-  traverse = 897;
-  trim = 898;
-  true = 899;
-  try = 900;
-  type = 901;
-  typealias = 902;
-  TypeEnum = 903;
-  typeName = 904;
-  typePrefix = 905;
-  typeStart = 906;
-  typeUnknown = 907;
-  typeURL = 908;
-  UInt32 = 909;
-  UInt64 = 910;
-  UInt8 = 911;
-  unchecked = 912;
-  unicodeScalarLiteral = 913;
-  UnicodeScalarLiteralType = 914;
-  unicodeScalars = 915;
-  UnicodeScalarView = 916;
-  uninterpretedOption = 917;
-  union = 918;
-  uniqueStorage = 919;
-  unknown = 920;
-  unknownFields = 921;
-  UnknownStorage = 922;
-  unpackTo = 923;
-  UnsafeBufferPointer = 924;
-  UnsafeMutablePointer = 925;
-  UnsafeMutableRawBufferPointer = 926;
-  UnsafeRawBufferPointer = 927;
-  UnsafeRawPointer = 928;
-  unverifiedLazy = 929;
-  updatedOptions = 930;
-  url = 931;
-  useDeterministicOrdering = 932;
-  utf8 = 933;
-  utf8Ptr = 934;
-  utf8ToDouble = 935;
-  utf8Validation = 936;
-  UTF8View = 937;
-  V = 938;
-  value = 939;
-  valueField = 940;
-  values = 941;
-  ValueType = 942;
-  var = 943;
-  verification = 944;
-  VerificationState = 945;
-  version = 946;
-  versionString = 947;
-  visibility = 948;
-  VisibilityFeature = 949;
-  visitExtensionFields = 950;
-  visitExtensionFieldsAsMessageSet = 951;
-  visitMapField = 952;
-  Visitor = 953;
-  visitPacked = 954;
-  visitPackedBoolField = 955;
-  visitPackedDoubleField = 956;
-  visitPackedEnumField = 957;
-  visitPackedFixed32Field = 958;
-  visitPackedFixed64Field = 959;
-  visitPackedFloatField = 960;
-  visitPackedInt32Field = 961;
-  visitPackedInt64Field = 962;
-  visitPackedSFixed32Field = 963;
-  visitPackedSFixed64Field = 964;
-  visitPackedSInt32Field = 965;
-  visitPackedSInt64Field = 966;
-  visitPackedUInt32Field = 967;
-  visitPackedUInt64Field = 968;
-  visitRepeated = 969;
-  visitRepeatedBoolField = 970;
-  visitRepeatedBytesField = 971;
-  visitRepeatedDoubleField = 972;
-  visitRepeatedEnumField = 973;
-  visitRepeatedFixed32Field = 974;
-  visitRepeatedFixed64Field = 975;
-  visitRepeatedFloatField = 976;
-  visitRepeatedGroupField = 977;
-  visitRepeatedInt32Field = 978;
-  visitRepeatedInt64Field = 979;
-  visitRepeatedMessageField = 980;
-  visitRepeatedSFixed32Field = 981;
-  visitRepeatedSFixed64Field = 982;
-  visitRepeatedSInt32Field = 983;
-  visitRepeatedSInt64Field = 984;
-  visitRepeatedStringField = 985;
-  visitRepeatedUInt32Field = 986;
-  visitRepeatedUInt64Field = 987;
-  visitSingular = 988;
-  visitSingularBoolField = 989;
-  visitSingularBytesField = 990;
-  visitSingularDoubleField = 991;
-  visitSingularEnumField = 992;
-  visitSingularFixed32Field = 993;
-  visitSingularFixed64Field = 994;
-  visitSingularFloatField = 995;
-  visitSingularGroupField = 996;
-  visitSingularInt32Field = 997;
-  visitSingularInt64Field = 998;
-  visitSingularMessageField = 999;
-  visitSingularSFixed32Field = 1000;
-  visitSingularSFixed64Field = 1001;
-  visitSingularSInt32Field = 1002;
-  visitSingularSInt64Field = 1003;
-  visitSingularStringField = 1004;
-  visitSingularUInt32Field = 1005;
-  visitSingularUInt64Field = 1006;
-  visitUnknown = 1007;
-  Void = 1008;
-  wasDecoded = 1009;
-  weak = 1010;
-  weakDependency = 1011;
-  where = 1012;
-  wireFormat = 1013;
-  with = 1014;
-  withUnsafeBytes = 1015;
-  withUnsafeMutableBytes = 1016;
-  work = 1017;
-  Wrapped = 1018;
-  WrappedType = 1019;
-  wrappedValue = 1020;
-  written = 1021;
-  yday = 1022;
+  Scalar = 818;
+  scan = 819;
+  scanner = 820;
+  seconds = 821;
+  self = 822;
+  semantic = 823;
+  Sendable = 824;
+  separator = 825;
+  serialize = 826;
+  serializedBytes = 827;
+  serializedData = 828;
+  serializedSize = 829;
+  serverStreaming = 830;
+  service = 831;
+  set = 832;
+  setExtensionValue = 833;
+  shift = 834;
+  SimpleExtensionMap = 835;
+  size = 836;
+  sizer = 837;
+  source = 838;
+  sourceCodeInfo = 839;
+  sourceContext = 840;
+  sourceEncoding = 841;
+  sourceFile = 842;
+  SourceLocation = 843;
+  span = 844;
+  split = 845;
+  start = 846;
+  startArray = 847;
+  startArrayObject = 848;
+  startField = 849;
+  startIndex = 850;
+  startMessageField = 851;
+  startObject = 852;
+  startRegularField = 853;
+  state = 854;
+  static = 855;
+  StaticString = 856;
+  storage = 857;
+  String = 858;
+  stringLiteral = 859;
+  StringLiteralType = 860;
+  stringResult = 861;
+  stringValue = 862;
+  struct = 863;
+  structValue = 864;
+  subDecoder = 865;
+  subscript = 866;
+  subtract = 867;
+  subVisitor = 868;
+  Swift = 869;
+  swiftPrefix = 870;
+  SwiftProtobufContiguousBytes = 871;
+  SwiftProtobufError = 872;
+  syntax = 873;
+  T = 874;
+  tag = 875;
+  targets = 876;
+  terminator = 877;
+  testDecoder = 878;
+  text = 879;
+  textDecoder = 880;
+  TextFormatDecoder = 881;
+  TextFormatDecodingError = 882;
+  TextFormatDecodingOptions = 883;
+  TextFormatEncodingOptions = 884;
+  TextFormatEncodingVisitor = 885;
+  textFormatString = 886;
+  throwOrIgnore = 887;
+  throws = 888;
+  timeInterval = 889;
+  timeIntervalSince1970 = 890;
+  timeIntervalSinceReferenceDate = 891;
+  tmp = 892;
+  tooLarge = 893;
+  total = 894;
+  totalArrayDepth = 895;
+  totalSize = 896;
+  trailingComments = 897;
+  traverse = 898;
+  trim = 899;
+  true = 900;
+  try = 901;
+  type = 902;
+  typealias = 903;
+  TypeEnum = 904;
+  typeName = 905;
+  typePrefix = 906;
+  typeStart = 907;
+  typeUnknown = 908;
+  typeURL = 909;
+  UInt32 = 910;
+  UInt64 = 911;
+  UInt8 = 912;
+  unchecked = 913;
+  Unicode = 914;
+  unicodeScalarLiteral = 915;
+  UnicodeScalarLiteralType = 916;
+  unicodeScalars = 917;
+  UnicodeScalarView = 918;
+  uninterpretedOption = 919;
+  union = 920;
+  uniqueStorage = 921;
+  unknown = 922;
+  unknownFields = 923;
+  UnknownStorage = 924;
+  unpackTo = 925;
+  UnsafeBufferPointer = 926;
+  UnsafeMutablePointer = 927;
+  UnsafeMutableRawBufferPointer = 928;
+  UnsafeRawBufferPointer = 929;
+  UnsafeRawPointer = 930;
+  unverifiedLazy = 931;
+  updatedOptions = 932;
+  uppercasedAssumingASCII = 933;
+  url = 934;
+  useDeterministicOrdering = 935;
+  utf8 = 936;
+  utf8Ptr = 937;
+  utf8ToDouble = 938;
+  utf8Validation = 939;
+  UTF8View = 940;
+  V = 941;
+  value = 942;
+  valueField = 943;
+  values = 944;
+  ValueType = 945;
+  var = 946;
+  verification = 947;
+  VerificationState = 948;
+  version = 949;
+  versionString = 950;
+  visibility = 951;
+  VisibilityFeature = 952;
+  visitExtensionFields = 953;
+  visitExtensionFieldsAsMessageSet = 954;
+  visitMapField = 955;
+  Visitor = 956;
+  visitPacked = 957;
+  visitPackedBoolField = 958;
+  visitPackedDoubleField = 959;
+  visitPackedEnumField = 960;
+  visitPackedFixed32Field = 961;
+  visitPackedFixed64Field = 962;
+  visitPackedFloatField = 963;
+  visitPackedInt32Field = 964;
+  visitPackedInt64Field = 965;
+  visitPackedSFixed32Field = 966;
+  visitPackedSFixed64Field = 967;
+  visitPackedSInt32Field = 968;
+  visitPackedSInt64Field = 969;
+  visitPackedUInt32Field = 970;
+  visitPackedUInt64Field = 971;
+  visitRepeated = 972;
+  visitRepeatedBoolField = 973;
+  visitRepeatedBytesField = 974;
+  visitRepeatedDoubleField = 975;
+  visitRepeatedEnumField = 976;
+  visitRepeatedFixed32Field = 977;
+  visitRepeatedFixed64Field = 978;
+  visitRepeatedFloatField = 979;
+  visitRepeatedGroupField = 980;
+  visitRepeatedInt32Field = 981;
+  visitRepeatedInt64Field = 982;
+  visitRepeatedMessageField = 983;
+  visitRepeatedSFixed32Field = 984;
+  visitRepeatedSFixed64Field = 985;
+  visitRepeatedSInt32Field = 986;
+  visitRepeatedSInt64Field = 987;
+  visitRepeatedStringField = 988;
+  visitRepeatedUInt32Field = 989;
+  visitRepeatedUInt64Field = 990;
+  visitSingular = 991;
+  visitSingularBoolField = 992;
+  visitSingularBytesField = 993;
+  visitSingularDoubleField = 994;
+  visitSingularEnumField = 995;
+  visitSingularFixed32Field = 996;
+  visitSingularFixed64Field = 997;
+  visitSingularFloatField = 998;
+  visitSingularGroupField = 999;
+  visitSingularInt32Field = 1000;
+  visitSingularInt64Field = 1001;
+  visitSingularMessageField = 1002;
+  visitSingularSFixed32Field = 1003;
+  visitSingularSFixed64Field = 1004;
+  visitSingularSInt32Field = 1005;
+  visitSingularSInt64Field = 1006;
+  visitSingularStringField = 1007;
+  visitSingularUInt32Field = 1008;
+  visitSingularUInt64Field = 1009;
+  visitUnknown = 1010;
+  Void = 1011;
+  wasDecoded = 1012;
+  weak = 1013;
+  weakDependency = 1014;
+  where = 1015;
+  wireFormat = 1016;
+  with = 1017;
+  withUnsafeBytes = 1018;
+  withUnsafeMutableBytes = 1019;
+  work = 1020;
+  Wrapped = 1021;
+  WrappedType = 1022;
+  wrappedValue = 1023;
+  written = 1024;
+  yday = 1025;
 }

+ 3 - 0
Protos/SwiftProtobufTests/generated_swift_names_enums.proto

@@ -821,6 +821,7 @@ message GeneratedSwiftReservedEnums {
   enum sawBackslash { NONE_sawBackslash = 0; }
   enum sawSection4Characters { NONE_sawSection4Characters = 0; }
   enum sawSection5Characters { NONE_sawSection5Characters = 0; }
+  enum Scalar { NONE_Scalar = 0; }
   enum scan { NONE_scan = 0; }
   enum scanner { NONE_scanner = 0; }
   enum seconds { NONE_seconds = 0; }
@@ -916,6 +917,7 @@ message GeneratedSwiftReservedEnums {
   enum UInt64 { NONE_UInt64 = 0; }
   enum UInt8 { NONE_UInt8 = 0; }
   enum unchecked { NONE_unchecked = 0; }
+  enum Unicode { NONE_Unicode = 0; }
   enum unicodeScalarLiteral { NONE_unicodeScalarLiteral = 0; }
   enum UnicodeScalarLiteralType { NONE_UnicodeScalarLiteralType = 0; }
   enum unicodeScalars { NONE_unicodeScalars = 0; }
@@ -934,6 +936,7 @@ message GeneratedSwiftReservedEnums {
   enum UnsafeRawPointer { NONE_UnsafeRawPointer = 0; }
   enum unverifiedLazy { NONE_unverifiedLazy = 0; }
   enum updatedOptions { NONE_updatedOptions = 0; }
+  enum uppercasedAssumingASCII { NONE_uppercasedAssumingASCII = 0; }
   enum url { NONE_url = 0; }
   enum useDeterministicOrdering { NONE_useDeterministicOrdering = 0; }
   enum utf8 { NONE_utf8 = 0; }

+ 208 - 205
Protos/SwiftProtobufTests/generated_swift_names_fields.proto

@@ -821,209 +821,212 @@ message GeneratedSwiftReservedFields {
   int32 sawBackslash = 815;
   int32 sawSection4Characters = 816;
   int32 sawSection5Characters = 817;
-  int32 scan = 818;
-  int32 scanner = 819;
-  int32 seconds = 820;
-  int32 self = 821;
-  int32 semantic = 822;
-  int32 Sendable = 823;
-  int32 separator = 824;
-  int32 serialize = 825;
-  int32 serializedBytes = 826;
-  int32 serializedData = 827;
-  int32 serializedSize = 828;
-  int32 serverStreaming = 829;
-  int32 service = 830;
-  int32 set = 831;
-  int32 setExtensionValue = 832;
-  int32 shift = 833;
-  int32 SimpleExtensionMap = 834;
-  int32 size = 835;
-  int32 sizer = 836;
-  int32 source = 837;
-  int32 sourceCodeInfo = 838;
-  int32 sourceContext = 839;
-  int32 sourceEncoding = 840;
-  int32 sourceFile = 841;
-  int32 SourceLocation = 842;
-  int32 span = 843;
-  int32 split = 844;
-  int32 start = 845;
-  int32 startArray = 846;
-  int32 startArrayObject = 847;
-  int32 startField = 848;
-  int32 startIndex = 849;
-  int32 startMessageField = 850;
-  int32 startObject = 851;
-  int32 startRegularField = 852;
-  int32 state = 853;
-  int32 static = 854;
-  int32 StaticString = 855;
-  int32 storage = 856;
-  int32 String = 857;
-  int32 stringLiteral = 858;
-  int32 StringLiteralType = 859;
-  int32 stringResult = 860;
-  int32 stringValue = 861;
-  int32 struct = 862;
-  int32 structValue = 863;
-  int32 subDecoder = 864;
-  int32 subscript = 865;
-  int32 subtract = 866;
-  int32 subVisitor = 867;
-  int32 Swift = 868;
-  int32 swiftPrefix = 869;
-  int32 SwiftProtobufContiguousBytes = 870;
-  int32 SwiftProtobufError = 871;
-  int32 syntax = 872;
-  int32 T = 873;
-  int32 tag = 874;
-  int32 targets = 875;
-  int32 terminator = 876;
-  int32 testDecoder = 877;
-  int32 text = 878;
-  int32 textDecoder = 879;
-  int32 TextFormatDecoder = 880;
-  int32 TextFormatDecodingError = 881;
-  int32 TextFormatDecodingOptions = 882;
-  int32 TextFormatEncodingOptions = 883;
-  int32 TextFormatEncodingVisitor = 884;
-  int32 textFormatString = 885;
-  int32 throwOrIgnore = 886;
-  int32 throws = 887;
-  int32 timeInterval = 888;
-  int32 timeIntervalSince1970 = 889;
-  int32 timeIntervalSinceReferenceDate = 890;
-  int32 tmp = 891;
-  int32 tooLarge = 892;
-  int32 total = 893;
-  int32 totalArrayDepth = 894;
-  int32 totalSize = 895;
-  int32 trailingComments = 896;
-  int32 traverse = 897;
-  int32 trim = 898;
-  int32 true = 899;
-  int32 try = 900;
-  int32 type = 901;
-  int32 typealias = 902;
-  int32 TypeEnum = 903;
-  int32 typeName = 904;
-  int32 typePrefix = 905;
-  int32 typeStart = 906;
-  int32 typeUnknown = 907;
-  int32 typeURL = 908;
-  int32 UInt32 = 909;
-  int32 UInt64 = 910;
-  int32 UInt8 = 911;
-  int32 unchecked = 912;
-  int32 unicodeScalarLiteral = 913;
-  int32 UnicodeScalarLiteralType = 914;
-  int32 unicodeScalars = 915;
-  int32 UnicodeScalarView = 916;
-  int32 uninterpretedOption = 917;
-  int32 union = 918;
-  int32 uniqueStorage = 919;
-  int32 unknown = 920;
-  int32 unknownFields = 921;
-  int32 UnknownStorage = 922;
-  int32 unpackTo = 923;
-  int32 UnsafeBufferPointer = 924;
-  int32 UnsafeMutablePointer = 925;
-  int32 UnsafeMutableRawBufferPointer = 926;
-  int32 UnsafeRawBufferPointer = 927;
-  int32 UnsafeRawPointer = 928;
-  int32 unverifiedLazy = 929;
-  int32 updatedOptions = 930;
-  int32 url = 931;
-  int32 useDeterministicOrdering = 932;
-  int32 utf8 = 933;
-  int32 utf8Ptr = 934;
-  int32 utf8ToDouble = 935;
-  int32 utf8Validation = 936;
-  int32 UTF8View = 937;
-  int32 V = 938;
-  int32 value = 939;
-  int32 valueField = 940;
-  int32 values = 941;
-  int32 ValueType = 942;
-  int32 var = 943;
-  int32 verification = 944;
-  int32 VerificationState = 945;
-  int32 version = 946;
-  int32 versionString = 947;
-  int32 visibility = 948;
-  int32 VisibilityFeature = 949;
-  int32 visitExtensionFields = 950;
-  int32 visitExtensionFieldsAsMessageSet = 951;
-  int32 visitMapField = 952;
-  int32 Visitor = 953;
-  int32 visitPacked = 954;
-  int32 visitPackedBoolField = 955;
-  int32 visitPackedDoubleField = 956;
-  int32 visitPackedEnumField = 957;
-  int32 visitPackedFixed32Field = 958;
-  int32 visitPackedFixed64Field = 959;
-  int32 visitPackedFloatField = 960;
-  int32 visitPackedInt32Field = 961;
-  int32 visitPackedInt64Field = 962;
-  int32 visitPackedSFixed32Field = 963;
-  int32 visitPackedSFixed64Field = 964;
-  int32 visitPackedSInt32Field = 965;
-  int32 visitPackedSInt64Field = 966;
-  int32 visitPackedUInt32Field = 967;
-  int32 visitPackedUInt64Field = 968;
-  int32 visitRepeated = 969;
-  int32 visitRepeatedBoolField = 970;
-  int32 visitRepeatedBytesField = 971;
-  int32 visitRepeatedDoubleField = 972;
-  int32 visitRepeatedEnumField = 973;
-  int32 visitRepeatedFixed32Field = 974;
-  int32 visitRepeatedFixed64Field = 975;
-  int32 visitRepeatedFloatField = 976;
-  int32 visitRepeatedGroupField = 977;
-  int32 visitRepeatedInt32Field = 978;
-  int32 visitRepeatedInt64Field = 979;
-  int32 visitRepeatedMessageField = 980;
-  int32 visitRepeatedSFixed32Field = 981;
-  int32 visitRepeatedSFixed64Field = 982;
-  int32 visitRepeatedSInt32Field = 983;
-  int32 visitRepeatedSInt64Field = 984;
-  int32 visitRepeatedStringField = 985;
-  int32 visitRepeatedUInt32Field = 986;
-  int32 visitRepeatedUInt64Field = 987;
-  int32 visitSingular = 988;
-  int32 visitSingularBoolField = 989;
-  int32 visitSingularBytesField = 990;
-  int32 visitSingularDoubleField = 991;
-  int32 visitSingularEnumField = 992;
-  int32 visitSingularFixed32Field = 993;
-  int32 visitSingularFixed64Field = 994;
-  int32 visitSingularFloatField = 995;
-  int32 visitSingularGroupField = 996;
-  int32 visitSingularInt32Field = 997;
-  int32 visitSingularInt64Field = 998;
-  int32 visitSingularMessageField = 999;
-  int32 visitSingularSFixed32Field = 1000;
-  int32 visitSingularSFixed64Field = 1001;
-  int32 visitSingularSInt32Field = 1002;
-  int32 visitSingularSInt64Field = 1003;
-  int32 visitSingularStringField = 1004;
-  int32 visitSingularUInt32Field = 1005;
-  int32 visitSingularUInt64Field = 1006;
-  int32 visitUnknown = 1007;
-  int32 Void = 1008;
-  int32 wasDecoded = 1009;
-  int32 weak = 1010;
-  int32 weakDependency = 1011;
-  int32 where = 1012;
-  int32 wireFormat = 1013;
-  int32 with = 1014;
-  int32 withUnsafeBytes = 1015;
-  int32 withUnsafeMutableBytes = 1016;
-  int32 work = 1017;
-  int32 Wrapped = 1018;
-  int32 WrappedType = 1019;
-  int32 wrappedValue = 1020;
-  int32 written = 1021;
-  int32 yday = 1022;
+  int32 Scalar = 818;
+  int32 scan = 819;
+  int32 scanner = 820;
+  int32 seconds = 821;
+  int32 self = 822;
+  int32 semantic = 823;
+  int32 Sendable = 824;
+  int32 separator = 825;
+  int32 serialize = 826;
+  int32 serializedBytes = 827;
+  int32 serializedData = 828;
+  int32 serializedSize = 829;
+  int32 serverStreaming = 830;
+  int32 service = 831;
+  int32 set = 832;
+  int32 setExtensionValue = 833;
+  int32 shift = 834;
+  int32 SimpleExtensionMap = 835;
+  int32 size = 836;
+  int32 sizer = 837;
+  int32 source = 838;
+  int32 sourceCodeInfo = 839;
+  int32 sourceContext = 840;
+  int32 sourceEncoding = 841;
+  int32 sourceFile = 842;
+  int32 SourceLocation = 843;
+  int32 span = 844;
+  int32 split = 845;
+  int32 start = 846;
+  int32 startArray = 847;
+  int32 startArrayObject = 848;
+  int32 startField = 849;
+  int32 startIndex = 850;
+  int32 startMessageField = 851;
+  int32 startObject = 852;
+  int32 startRegularField = 853;
+  int32 state = 854;
+  int32 static = 855;
+  int32 StaticString = 856;
+  int32 storage = 857;
+  int32 String = 858;
+  int32 stringLiteral = 859;
+  int32 StringLiteralType = 860;
+  int32 stringResult = 861;
+  int32 stringValue = 862;
+  int32 struct = 863;
+  int32 structValue = 864;
+  int32 subDecoder = 865;
+  int32 subscript = 866;
+  int32 subtract = 867;
+  int32 subVisitor = 868;
+  int32 Swift = 869;
+  int32 swiftPrefix = 870;
+  int32 SwiftProtobufContiguousBytes = 871;
+  int32 SwiftProtobufError = 872;
+  int32 syntax = 873;
+  int32 T = 874;
+  int32 tag = 875;
+  int32 targets = 876;
+  int32 terminator = 877;
+  int32 testDecoder = 878;
+  int32 text = 879;
+  int32 textDecoder = 880;
+  int32 TextFormatDecoder = 881;
+  int32 TextFormatDecodingError = 882;
+  int32 TextFormatDecodingOptions = 883;
+  int32 TextFormatEncodingOptions = 884;
+  int32 TextFormatEncodingVisitor = 885;
+  int32 textFormatString = 886;
+  int32 throwOrIgnore = 887;
+  int32 throws = 888;
+  int32 timeInterval = 889;
+  int32 timeIntervalSince1970 = 890;
+  int32 timeIntervalSinceReferenceDate = 891;
+  int32 tmp = 892;
+  int32 tooLarge = 893;
+  int32 total = 894;
+  int32 totalArrayDepth = 895;
+  int32 totalSize = 896;
+  int32 trailingComments = 897;
+  int32 traverse = 898;
+  int32 trim = 899;
+  int32 true = 900;
+  int32 try = 901;
+  int32 type = 902;
+  int32 typealias = 903;
+  int32 TypeEnum = 904;
+  int32 typeName = 905;
+  int32 typePrefix = 906;
+  int32 typeStart = 907;
+  int32 typeUnknown = 908;
+  int32 typeURL = 909;
+  int32 UInt32 = 910;
+  int32 UInt64 = 911;
+  int32 UInt8 = 912;
+  int32 unchecked = 913;
+  int32 Unicode = 914;
+  int32 unicodeScalarLiteral = 915;
+  int32 UnicodeScalarLiteralType = 916;
+  int32 unicodeScalars = 917;
+  int32 UnicodeScalarView = 918;
+  int32 uninterpretedOption = 919;
+  int32 union = 920;
+  int32 uniqueStorage = 921;
+  int32 unknown = 922;
+  int32 unknownFields = 923;
+  int32 UnknownStorage = 924;
+  int32 unpackTo = 925;
+  int32 UnsafeBufferPointer = 926;
+  int32 UnsafeMutablePointer = 927;
+  int32 UnsafeMutableRawBufferPointer = 928;
+  int32 UnsafeRawBufferPointer = 929;
+  int32 UnsafeRawPointer = 930;
+  int32 unverifiedLazy = 931;
+  int32 updatedOptions = 932;
+  int32 uppercasedAssumingASCII = 933;
+  int32 url = 934;
+  int32 useDeterministicOrdering = 935;
+  int32 utf8 = 936;
+  int32 utf8Ptr = 937;
+  int32 utf8ToDouble = 938;
+  int32 utf8Validation = 939;
+  int32 UTF8View = 940;
+  int32 V = 941;
+  int32 value = 942;
+  int32 valueField = 943;
+  int32 values = 944;
+  int32 ValueType = 945;
+  int32 var = 946;
+  int32 verification = 947;
+  int32 VerificationState = 948;
+  int32 version = 949;
+  int32 versionString = 950;
+  int32 visibility = 951;
+  int32 VisibilityFeature = 952;
+  int32 visitExtensionFields = 953;
+  int32 visitExtensionFieldsAsMessageSet = 954;
+  int32 visitMapField = 955;
+  int32 Visitor = 956;
+  int32 visitPacked = 957;
+  int32 visitPackedBoolField = 958;
+  int32 visitPackedDoubleField = 959;
+  int32 visitPackedEnumField = 960;
+  int32 visitPackedFixed32Field = 961;
+  int32 visitPackedFixed64Field = 962;
+  int32 visitPackedFloatField = 963;
+  int32 visitPackedInt32Field = 964;
+  int32 visitPackedInt64Field = 965;
+  int32 visitPackedSFixed32Field = 966;
+  int32 visitPackedSFixed64Field = 967;
+  int32 visitPackedSInt32Field = 968;
+  int32 visitPackedSInt64Field = 969;
+  int32 visitPackedUInt32Field = 970;
+  int32 visitPackedUInt64Field = 971;
+  int32 visitRepeated = 972;
+  int32 visitRepeatedBoolField = 973;
+  int32 visitRepeatedBytesField = 974;
+  int32 visitRepeatedDoubleField = 975;
+  int32 visitRepeatedEnumField = 976;
+  int32 visitRepeatedFixed32Field = 977;
+  int32 visitRepeatedFixed64Field = 978;
+  int32 visitRepeatedFloatField = 979;
+  int32 visitRepeatedGroupField = 980;
+  int32 visitRepeatedInt32Field = 981;
+  int32 visitRepeatedInt64Field = 982;
+  int32 visitRepeatedMessageField = 983;
+  int32 visitRepeatedSFixed32Field = 984;
+  int32 visitRepeatedSFixed64Field = 985;
+  int32 visitRepeatedSInt32Field = 986;
+  int32 visitRepeatedSInt64Field = 987;
+  int32 visitRepeatedStringField = 988;
+  int32 visitRepeatedUInt32Field = 989;
+  int32 visitRepeatedUInt64Field = 990;
+  int32 visitSingular = 991;
+  int32 visitSingularBoolField = 992;
+  int32 visitSingularBytesField = 993;
+  int32 visitSingularDoubleField = 994;
+  int32 visitSingularEnumField = 995;
+  int32 visitSingularFixed32Field = 996;
+  int32 visitSingularFixed64Field = 997;
+  int32 visitSingularFloatField = 998;
+  int32 visitSingularGroupField = 999;
+  int32 visitSingularInt32Field = 1000;
+  int32 visitSingularInt64Field = 1001;
+  int32 visitSingularMessageField = 1002;
+  int32 visitSingularSFixed32Field = 1003;
+  int32 visitSingularSFixed64Field = 1004;
+  int32 visitSingularSInt32Field = 1005;
+  int32 visitSingularSInt64Field = 1006;
+  int32 visitSingularStringField = 1007;
+  int32 visitSingularUInt32Field = 1008;
+  int32 visitSingularUInt64Field = 1009;
+  int32 visitUnknown = 1010;
+  int32 Void = 1011;
+  int32 wasDecoded = 1012;
+  int32 weak = 1013;
+  int32 weakDependency = 1014;
+  int32 where = 1015;
+  int32 wireFormat = 1016;
+  int32 with = 1017;
+  int32 withUnsafeBytes = 1018;
+  int32 withUnsafeMutableBytes = 1019;
+  int32 work = 1020;
+  int32 Wrapped = 1021;
+  int32 WrappedType = 1022;
+  int32 wrappedValue = 1023;
+  int32 written = 1024;
+  int32 yday = 1025;
 }

+ 3 - 0
Protos/SwiftProtobufTests/generated_swift_names_messages.proto

@@ -821,6 +821,7 @@ message GeneratedSwiftReservedMessages {
   message sawBackslash { int32 sawBackslash = 1; }
   message sawSection4Characters { int32 sawSection4Characters = 1; }
   message sawSection5Characters { int32 sawSection5Characters = 1; }
+  message Scalar { int32 Scalar = 1; }
   message scan { int32 scan = 1; }
   message scanner { int32 scanner = 1; }
   message seconds { int32 seconds = 1; }
@@ -916,6 +917,7 @@ message GeneratedSwiftReservedMessages {
   message UInt64 { int32 UInt64 = 1; }
   message UInt8 { int32 UInt8 = 1; }
   message unchecked { int32 unchecked = 1; }
+  message Unicode { int32 Unicode = 1; }
   message unicodeScalarLiteral { int32 unicodeScalarLiteral = 1; }
   message UnicodeScalarLiteralType { int32 UnicodeScalarLiteralType = 1; }
   message unicodeScalars { int32 unicodeScalars = 1; }
@@ -934,6 +936,7 @@ message GeneratedSwiftReservedMessages {
   message UnsafeRawPointer { int32 UnsafeRawPointer = 1; }
   message unverifiedLazy { int32 unverifiedLazy = 1; }
   message updatedOptions { int32 updatedOptions = 1; }
+  message uppercasedAssumingASCII { int32 uppercasedAssumingASCII = 1; }
   message url { int32 url = 1; }
   message useDeterministicOrdering { int32 useDeterministicOrdering = 1; }
   message utf8 { int32 utf8 = 1; }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 624 - 615
Reference/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift


+ 102 - 0
Reference/SwiftProtobufTests/generated_swift_names_enums.pb.swift

@@ -24541,6 +24541,36 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable {
 
   }
 
+  enum Scalar: SwiftProtobuf.Enum, Swift.CaseIterable {
+    typealias RawValue = Int
+    case noneScalar // = 0
+    case UNRECOGNIZED(Int)
+
+    init() {
+      self = .noneScalar
+    }
+
+    init?(rawValue: Int) {
+      switch rawValue {
+      case 0: self = .noneScalar
+      default: self = .UNRECOGNIZED(rawValue)
+      }
+    }
+
+    var rawValue: Int {
+      switch self {
+      case .noneScalar: return 0
+      case .UNRECOGNIZED(let i): return i
+      }
+    }
+
+    // The compiler won't synthesize support with the UNRECOGNIZED case.
+    static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.Scalar] = [
+      .noneScalar,
+    ]
+
+  }
+
   enum scan: SwiftProtobuf.Enum, Swift.CaseIterable {
     typealias RawValue = Int
     case noneScan // = 0
@@ -27391,6 +27421,36 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable {
 
   }
 
+  enum Unicode: SwiftProtobuf.Enum, Swift.CaseIterable {
+    typealias RawValue = Int
+    case noneUnicode // = 0
+    case UNRECOGNIZED(Int)
+
+    init() {
+      self = .noneUnicode
+    }
+
+    init?(rawValue: Int) {
+      switch rawValue {
+      case 0: self = .noneUnicode
+      default: self = .UNRECOGNIZED(rawValue)
+      }
+    }
+
+    var rawValue: Int {
+      switch self {
+      case .noneUnicode: return 0
+      case .UNRECOGNIZED(let i): return i
+      }
+    }
+
+    // The compiler won't synthesize support with the UNRECOGNIZED case.
+    static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.Unicode] = [
+      .noneUnicode,
+    ]
+
+  }
+
   enum unicodeScalarLiteral: SwiftProtobuf.Enum, Swift.CaseIterable {
     typealias RawValue = Int
     case noneUnicodeScalarLiteral // = 0
@@ -27931,6 +27991,36 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable {
 
   }
 
+  enum uppercasedAssumingASCII: SwiftProtobuf.Enum, Swift.CaseIterable {
+    typealias RawValue = Int
+    case noneUppercasedAssumingAscii // = 0
+    case UNRECOGNIZED(Int)
+
+    init() {
+      self = .noneUppercasedAssumingAscii
+    }
+
+    init?(rawValue: Int) {
+      switch rawValue {
+      case 0: self = .noneUppercasedAssumingAscii
+      default: self = .UNRECOGNIZED(rawValue)
+      }
+    }
+
+    var rawValue: Int {
+      switch self {
+      case .noneUppercasedAssumingAscii: return 0
+      case .UNRECOGNIZED(let i): return i
+      }
+    }
+
+    // The compiler won't synthesize support with the UNRECOGNIZED case.
+    static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.uppercasedAssumingASCII] = [
+      .noneUppercasedAssumingAscii,
+    ]
+
+  }
+
   enum url: SwiftProtobuf.Enum, Swift.CaseIterable {
     typealias RawValue = Int
     case noneURL // = 0
@@ -33985,6 +34075,10 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.sawSection5Cha
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_sawSection5Characters\0")
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.Scalar: SwiftProtobuf._ProtoNameProviding {
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_Scalar\0")
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.scan: SwiftProtobuf._ProtoNameProviding {
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_scan\0")
 }
@@ -34365,6 +34459,10 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.unchecked: Swi
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_unchecked\0")
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.Unicode: SwiftProtobuf._ProtoNameProviding {
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_Unicode\0")
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.unicodeScalarLiteral: SwiftProtobuf._ProtoNameProviding {
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_unicodeScalarLiteral\0")
 }
@@ -34437,6 +34535,10 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.updatedOptions
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_updatedOptions\0")
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.uppercasedAssumingASCII: SwiftProtobuf._ProtoNameProviding {
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_uppercasedAssumingASCII\0")
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.url: SwiftProtobuf._ProtoNameProviding {
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_url\0")
 }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 15 - 0
Reference/SwiftProtobufTests/generated_swift_names_fields.pb.swift


+ 126 - 0
Reference/SwiftProtobufTests/generated_swift_names_messages.pb.swift

@@ -9835,6 +9835,18 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable {
     init() {}
   }
 
+  struct Scalar: Sendable {
+    // SwiftProtobuf.Message conformance is added in an extension below. See the
+    // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+    // methods supported on all messages.
+
+    var scalar: Int32 = 0
+
+    var unknownFields = SwiftProtobuf.UnknownStorage()
+
+    init() {}
+  }
+
   struct scan: Sendable {
     // SwiftProtobuf.Message conformance is added in an extension below. See the
     // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@@ -10975,6 +10987,18 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable {
     init() {}
   }
 
+  struct Unicode: Sendable {
+    // SwiftProtobuf.Message conformance is added in an extension below. See the
+    // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+    // methods supported on all messages.
+
+    var unicode: Int32 = 0
+
+    var unknownFields = SwiftProtobuf.UnknownStorage()
+
+    init() {}
+  }
+
   struct unicodeScalarLiteral: Sendable {
     // SwiftProtobuf.Message conformance is added in an extension below. See the
     // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@@ -11191,6 +11215,18 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable {
     init() {}
   }
 
+  struct uppercasedAssumingASCII: Sendable {
+    // SwiftProtobuf.Message conformance is added in an extension below. See the
+    // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+    // methods supported on all messages.
+
+    var uppercasedAssumingAscii: Int32 = 0
+
+    var unknownFields = SwiftProtobuf.UnknownStorage()
+
+    init() {}
+  }
+
   struct url: Sendable {
     // SwiftProtobuf.Message conformance is added in an extension below. See the
     // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@@ -36831,6 +36867,36 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.sawSection5
   }
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Scalar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+  static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".Scalar"
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}Scalar\0")
+
+  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+    while let fieldNumber = try decoder.nextFieldNumber() {
+      // The use of inline closures is to circumvent an issue where the compiler
+      // allocates stack space for every case branch when no optimizations are
+      // enabled. https://github.com/apple/swift-protobuf/issues/1034
+      switch fieldNumber {
+      case 1: try { try decoder.decodeSingularInt32Field(value: &self.scalar) }()
+      default: break
+      }
+    }
+  }
+
+  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+    if self.scalar != 0 {
+      try visitor.visitSingularInt32Field(value: self.scalar, fieldNumber: 1)
+    }
+    try unknownFields.traverse(visitor: &visitor)
+  }
+
+  static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Scalar, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Scalar) -> Bool {
+    if lhs.scalar != rhs.scalar {return false}
+    if lhs.unknownFields != rhs.unknownFields {return false}
+    return true
+  }
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.scan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
   static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".scan"
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}scan\0")
@@ -39681,6 +39747,36 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.unchecked:
   }
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Unicode: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+  static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".Unicode"
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}Unicode\0")
+
+  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+    while let fieldNumber = try decoder.nextFieldNumber() {
+      // The use of inline closures is to circumvent an issue where the compiler
+      // allocates stack space for every case branch when no optimizations are
+      // enabled. https://github.com/apple/swift-protobuf/issues/1034
+      switch fieldNumber {
+      case 1: try { try decoder.decodeSingularInt32Field(value: &self.unicode) }()
+      default: break
+      }
+    }
+  }
+
+  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+    if self.unicode != 0 {
+      try visitor.visitSingularInt32Field(value: self.unicode, fieldNumber: 1)
+    }
+    try unknownFields.traverse(visitor: &visitor)
+  }
+
+  static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Unicode, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Unicode) -> Bool {
+    if lhs.unicode != rhs.unicode {return false}
+    if lhs.unknownFields != rhs.unknownFields {return false}
+    return true
+  }
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.unicodeScalarLiteral: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
   static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".unicodeScalarLiteral"
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}unicodeScalarLiteral\0")
@@ -40221,6 +40317,36 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.updatedOpti
   }
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.uppercasedAssumingASCII: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+  static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".uppercasedAssumingASCII"
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}uppercasedAssumingASCII\0")
+
+  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+    while let fieldNumber = try decoder.nextFieldNumber() {
+      // The use of inline closures is to circumvent an issue where the compiler
+      // allocates stack space for every case branch when no optimizations are
+      // enabled. https://github.com/apple/swift-protobuf/issues/1034
+      switch fieldNumber {
+      case 1: try { try decoder.decodeSingularInt32Field(value: &self.uppercasedAssumingAscii) }()
+      default: break
+      }
+    }
+  }
+
+  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+    if self.uppercasedAssumingAscii != 0 {
+      try visitor.visitSingularInt32Field(value: self.uppercasedAssumingAscii, fieldNumber: 1)
+    }
+    try unknownFields.traverse(visitor: &visitor)
+  }
+
+  static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.uppercasedAssumingASCII, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.uppercasedAssumingASCII) -> Bool {
+    if lhs.uppercasedAssumingAscii != rhs.uppercasedAssumingAscii {return false}
+    if lhs.unknownFields != rhs.unknownFields {return false}
+    return true
+  }
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.url: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
   static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".url"
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}url\0")

+ 21 - 12
Sources/SwiftProtobuf/NameMap.swift

@@ -14,26 +14,34 @@
 /// use this data.  We should develop and publicize a suitable API
 /// for that purpose.  (Which might be the same as the internal API.)
 
-/// This must be exactly the same as the corresponding code in the
-/// protoc-gen-swift code generator.  Changing it will break
-/// compatibility of the library with older generated code.
+/// This must produce exactly the same outputs as the corresponding
+/// code in the protoc-gen-swift code generator. Changing it will
+/// break compatibility of the library with older generated code.
 ///
 /// It does not necessarily need to match protoc's JSON field naming
 /// logic, however.
-private func toJsonFieldName(_ s: String) -> String {
-    var result = String()
+private func toJSONFieldName(_ s: UnsafeBufferPointer<UInt8>) -> String {
+    var result = String.UnicodeScalarView()
     var capitalizeNext = false
     for c in s {
-        if c == "_" {
+        if c == UInt8(ascii: "_") {
             capitalizeNext = true
         } else if capitalizeNext {
-            result.append(String(c).uppercased())
+            result.append(Unicode.Scalar(c).uppercasedAssumingASCII)
             capitalizeNext = false
         } else {
-            result.append(String(c))
+            result.append(Unicode.Scalar(c))
         }
     }
-    return result
+    return String(result)
+}
+private func toJSONFieldName(_ s: StaticString) -> String {
+    guard s.hasPointerRepresentation else {
+        // If it's a single code point, it wouldn't be changed by the above algorithm.
+        // Return it as-is.
+        return s.description
+    }
+    return toJSONFieldName(UnsafeBufferPointer(start: s.utf8Start, count: s.utf8CodeUnitCount))
 }
 
 /// Allocate static memory buffers to intern UTF-8
@@ -326,7 +334,7 @@ public struct _NameMap: ExpressibleByDictionaryLiteral {
 
             case .standard(proto: let p):
                 let protoName = Name(staticString: p, pool: internPool)
-                let jsonString = toJsonFieldName(protoName.description)
+                let jsonString = toJSONFieldName(p)
                 let jsonName = Name(string: jsonString, pool: internPool)
                 let names = Names(json: jsonName, proto: protoName)
                 numberToNameMap[number] = names
@@ -382,8 +390,9 @@ public struct _NameMap: ExpressibleByDictionaryLiteral {
 
             case .standardNext, .standardDelta:
                 let number = nextNumber()
-                let protoName = Name(bytecodeUTF8Buffer: reader.nextNullTerminatedString())
-                let jsonString = toJsonFieldName(protoName.description)
+                let protoNameBuffer = reader.nextNullTerminatedString()
+                let protoName = Name(bytecodeUTF8Buffer: protoNameBuffer)
+                let jsonString = toJSONFieldName(protoNameBuffer)
                 let jsonName = Name(string: jsonString, pool: internPool)
                 numberToNameMap[number] = Names(json: jsonName, proto: protoName)
                 protoToNumberMap[protoName] = number

+ 11 - 0
Sources/SwiftProtobuf/StringUtils.swift

@@ -102,3 +102,14 @@ internal func utf8ToString(bytes: UnsafeRawPointer, count: Int) -> String? {
     // UTF-8 (which is why we validate the UTF-8 above).
     return String(decoding: codeUnits, as: sourceEncoding)
 }
+
+extension Unicode.Scalar {
+    /// Assuming the given scalar is ASCII, this is the uppercased equivalent (unchanged if it is
+    /// not a lowercase alphabetic character).
+    var uppercasedAssumingASCII: Unicode.Scalar {
+        guard "a" <= self && self <= "z" else {
+            return self
+        }
+        return Self(value & 0x5f)!
+    }
+}

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 624 - 615
Tests/SwiftProtobufTests/generated_swift_names_enum_cases.pb.swift


+ 102 - 0
Tests/SwiftProtobufTests/generated_swift_names_enums.pb.swift

@@ -24541,6 +24541,36 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable {
 
   }
 
+  enum Scalar: SwiftProtobuf.Enum, Swift.CaseIterable {
+    typealias RawValue = Int
+    case noneScalar // = 0
+    case UNRECOGNIZED(Int)
+
+    init() {
+      self = .noneScalar
+    }
+
+    init?(rawValue: Int) {
+      switch rawValue {
+      case 0: self = .noneScalar
+      default: self = .UNRECOGNIZED(rawValue)
+      }
+    }
+
+    var rawValue: Int {
+      switch self {
+      case .noneScalar: return 0
+      case .UNRECOGNIZED(let i): return i
+      }
+    }
+
+    // The compiler won't synthesize support with the UNRECOGNIZED case.
+    static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.Scalar] = [
+      .noneScalar,
+    ]
+
+  }
+
   enum scan: SwiftProtobuf.Enum, Swift.CaseIterable {
     typealias RawValue = Int
     case noneScan // = 0
@@ -27391,6 +27421,36 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable {
 
   }
 
+  enum Unicode: SwiftProtobuf.Enum, Swift.CaseIterable {
+    typealias RawValue = Int
+    case noneUnicode // = 0
+    case UNRECOGNIZED(Int)
+
+    init() {
+      self = .noneUnicode
+    }
+
+    init?(rawValue: Int) {
+      switch rawValue {
+      case 0: self = .noneUnicode
+      default: self = .UNRECOGNIZED(rawValue)
+      }
+    }
+
+    var rawValue: Int {
+      switch self {
+      case .noneUnicode: return 0
+      case .UNRECOGNIZED(let i): return i
+      }
+    }
+
+    // The compiler won't synthesize support with the UNRECOGNIZED case.
+    static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.Unicode] = [
+      .noneUnicode,
+    ]
+
+  }
+
   enum unicodeScalarLiteral: SwiftProtobuf.Enum, Swift.CaseIterable {
     typealias RawValue = Int
     case noneUnicodeScalarLiteral // = 0
@@ -27931,6 +27991,36 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums: Sendable {
 
   }
 
+  enum uppercasedAssumingASCII: SwiftProtobuf.Enum, Swift.CaseIterable {
+    typealias RawValue = Int
+    case noneUppercasedAssumingAscii // = 0
+    case UNRECOGNIZED(Int)
+
+    init() {
+      self = .noneUppercasedAssumingAscii
+    }
+
+    init?(rawValue: Int) {
+      switch rawValue {
+      case 0: self = .noneUppercasedAssumingAscii
+      default: self = .UNRECOGNIZED(rawValue)
+      }
+    }
+
+    var rawValue: Int {
+      switch self {
+      case .noneUppercasedAssumingAscii: return 0
+      case .UNRECOGNIZED(let i): return i
+      }
+    }
+
+    // The compiler won't synthesize support with the UNRECOGNIZED case.
+    static let allCases: [SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.uppercasedAssumingASCII] = [
+      .noneUppercasedAssumingAscii,
+    ]
+
+  }
+
   enum url: SwiftProtobuf.Enum, Swift.CaseIterable {
     typealias RawValue = Int
     case noneURL // = 0
@@ -33985,6 +34075,10 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.sawSection5Cha
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_sawSection5Characters\0")
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.Scalar: SwiftProtobuf._ProtoNameProviding {
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_Scalar\0")
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.scan: SwiftProtobuf._ProtoNameProviding {
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_scan\0")
 }
@@ -34365,6 +34459,10 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.unchecked: Swi
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_unchecked\0")
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.Unicode: SwiftProtobuf._ProtoNameProviding {
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_Unicode\0")
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.unicodeScalarLiteral: SwiftProtobuf._ProtoNameProviding {
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_unicodeScalarLiteral\0")
 }
@@ -34437,6 +34535,10 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.updatedOptions
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_updatedOptions\0")
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.uppercasedAssumingASCII: SwiftProtobuf._ProtoNameProviding {
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_uppercasedAssumingASCII\0")
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedEnums.url: SwiftProtobuf._ProtoNameProviding {
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{2}\0NONE_url\0")
 }

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 15 - 0
Tests/SwiftProtobufTests/generated_swift_names_fields.pb.swift


+ 126 - 0
Tests/SwiftProtobufTests/generated_swift_names_messages.pb.swift

@@ -9835,6 +9835,18 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable {
     init() {}
   }
 
+  struct Scalar: Sendable {
+    // SwiftProtobuf.Message conformance is added in an extension below. See the
+    // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+    // methods supported on all messages.
+
+    var scalar: Int32 = 0
+
+    var unknownFields = SwiftProtobuf.UnknownStorage()
+
+    init() {}
+  }
+
   struct scan: Sendable {
     // SwiftProtobuf.Message conformance is added in an extension below. See the
     // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@@ -10975,6 +10987,18 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable {
     init() {}
   }
 
+  struct Unicode: Sendable {
+    // SwiftProtobuf.Message conformance is added in an extension below. See the
+    // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+    // methods supported on all messages.
+
+    var unicode: Int32 = 0
+
+    var unknownFields = SwiftProtobuf.UnknownStorage()
+
+    init() {}
+  }
+
   struct unicodeScalarLiteral: Sendable {
     // SwiftProtobuf.Message conformance is added in an extension below. See the
     // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@@ -11191,6 +11215,18 @@ struct SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages: Sendable {
     init() {}
   }
 
+  struct uppercasedAssumingASCII: Sendable {
+    // SwiftProtobuf.Message conformance is added in an extension below. See the
+    // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
+    // methods supported on all messages.
+
+    var uppercasedAssumingAscii: Int32 = 0
+
+    var unknownFields = SwiftProtobuf.UnknownStorage()
+
+    init() {}
+  }
+
   struct url: Sendable {
     // SwiftProtobuf.Message conformance is added in an extension below. See the
     // `Message` and `Message+*Additions` files in the SwiftProtobuf library for
@@ -36831,6 +36867,36 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.sawSection5
   }
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Scalar: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+  static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".Scalar"
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}Scalar\0")
+
+  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+    while let fieldNumber = try decoder.nextFieldNumber() {
+      // The use of inline closures is to circumvent an issue where the compiler
+      // allocates stack space for every case branch when no optimizations are
+      // enabled. https://github.com/apple/swift-protobuf/issues/1034
+      switch fieldNumber {
+      case 1: try { try decoder.decodeSingularInt32Field(value: &self.scalar) }()
+      default: break
+      }
+    }
+  }
+
+  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+    if self.scalar != 0 {
+      try visitor.visitSingularInt32Field(value: self.scalar, fieldNumber: 1)
+    }
+    try unknownFields.traverse(visitor: &visitor)
+  }
+
+  static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Scalar, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Scalar) -> Bool {
+    if lhs.scalar != rhs.scalar {return false}
+    if lhs.unknownFields != rhs.unknownFields {return false}
+    return true
+  }
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.scan: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
   static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".scan"
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}scan\0")
@@ -39681,6 +39747,36 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.unchecked:
   }
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Unicode: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+  static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".Unicode"
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}Unicode\0")
+
+  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+    while let fieldNumber = try decoder.nextFieldNumber() {
+      // The use of inline closures is to circumvent an issue where the compiler
+      // allocates stack space for every case branch when no optimizations are
+      // enabled. https://github.com/apple/swift-protobuf/issues/1034
+      switch fieldNumber {
+      case 1: try { try decoder.decodeSingularInt32Field(value: &self.unicode) }()
+      default: break
+      }
+    }
+  }
+
+  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+    if self.unicode != 0 {
+      try visitor.visitSingularInt32Field(value: self.unicode, fieldNumber: 1)
+    }
+    try unknownFields.traverse(visitor: &visitor)
+  }
+
+  static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Unicode, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.Unicode) -> Bool {
+    if lhs.unicode != rhs.unicode {return false}
+    if lhs.unknownFields != rhs.unknownFields {return false}
+    return true
+  }
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.unicodeScalarLiteral: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
   static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".unicodeScalarLiteral"
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}unicodeScalarLiteral\0")
@@ -40221,6 +40317,36 @@ extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.updatedOpti
   }
 }
 
+extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.uppercasedAssumingASCII: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
+  static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".uppercasedAssumingASCII"
+  static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}uppercasedAssumingASCII\0")
+
+  mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
+    while let fieldNumber = try decoder.nextFieldNumber() {
+      // The use of inline closures is to circumvent an issue where the compiler
+      // allocates stack space for every case branch when no optimizations are
+      // enabled. https://github.com/apple/swift-protobuf/issues/1034
+      switch fieldNumber {
+      case 1: try { try decoder.decodeSingularInt32Field(value: &self.uppercasedAssumingAscii) }()
+      default: break
+      }
+    }
+  }
+
+  func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
+    if self.uppercasedAssumingAscii != 0 {
+      try visitor.visitSingularInt32Field(value: self.uppercasedAssumingAscii, fieldNumber: 1)
+    }
+    try unknownFields.traverse(visitor: &visitor)
+  }
+
+  static func ==(lhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.uppercasedAssumingASCII, rhs: SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.uppercasedAssumingASCII) -> Bool {
+    if lhs.uppercasedAssumingAscii != rhs.uppercasedAssumingAscii {return false}
+    if lhs.unknownFields != rhs.unknownFields {return false}
+    return true
+  }
+}
+
 extension SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.url: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
   static let protoMessageName: String = SwiftProtoTesting_Generated_GeneratedSwiftReservedMessages.protoMessageName + ".url"
   static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{1}url\0")

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.