Browse Source

[ObjC] Update some library internals to not pass syntax versions.

- With the new flags, the syntax isn't needed, so don't pass it.
- To keep library binary compatibility, rename the helpers since one
  "Internal" method was called from generated code. Keep a shim with
  the old signature to support those generated sources.
Thomas Van Lenten 5 years ago
parent
commit
e1e5b8af79
3 changed files with 151 additions and 206 deletions
  1. 49 67
      objectivec/GPBMessage.m
  2. 61 86
      objectivec/GPBUtilities.m
  3. 41 53
      objectivec/GPBUtilities_PackagePrivate.h

+ 49 - 67
objectivec/GPBMessage.m

@@ -99,15 +99,13 @@ static id CreateArrayForField(GPBFieldDescriptor *field,
                               GPBMessage *autocreator)
                               GPBMessage *autocreator)
     __attribute__((ns_returns_retained));
     __attribute__((ns_returns_retained));
 static id GetOrCreateArrayIvarWithField(GPBMessage *self,
 static id GetOrCreateArrayIvarWithField(GPBMessage *self,
-                                        GPBFieldDescriptor *field,
-                                        GPBFileSyntax syntax);
+                                        GPBFieldDescriptor *field);
 static id GetArrayIvarWithField(GPBMessage *self, GPBFieldDescriptor *field);
 static id GetArrayIvarWithField(GPBMessage *self, GPBFieldDescriptor *field);
 static id CreateMapForField(GPBFieldDescriptor *field,
 static id CreateMapForField(GPBFieldDescriptor *field,
                             GPBMessage *autocreator)
                             GPBMessage *autocreator)
     __attribute__((ns_returns_retained));
     __attribute__((ns_returns_retained));
 static id GetOrCreateMapIvarWithField(GPBMessage *self,
 static id GetOrCreateMapIvarWithField(GPBMessage *self,
-                                      GPBFieldDescriptor *field,
-                                      GPBFileSyntax syntax);
+                                      GPBFieldDescriptor *field);
 static id GetMapIvarWithField(GPBMessage *self, GPBFieldDescriptor *field);
 static id GetMapIvarWithField(GPBMessage *self, GPBFieldDescriptor *field);
 static NSMutableDictionary *CloneExtensionMap(NSDictionary *extensionMap,
 static NSMutableDictionary *CloneExtensionMap(NSDictionary *extensionMap,
                                               NSZone *zone)
                                               NSZone *zone)
@@ -560,10 +558,10 @@ static id CreateMapForField(GPBFieldDescriptor *field,
 
 
 #if !defined(__clang_analyzer__)
 #if !defined(__clang_analyzer__)
 // These functions are blocked from the analyzer because the analyzer sees the
 // These functions are blocked from the analyzer because the analyzer sees the
-// GPBSetRetainedObjectIvarWithFieldInternal() call as consuming the array/map,
+// GPBSetRetainedObjectIvarWithFieldPrivate() call as consuming the array/map,
 // so use of the array/map after the call returns is flagged as a use after
 // so use of the array/map after the call returns is flagged as a use after
 // free.
 // free.
-// But GPBSetRetainedObjectIvarWithFieldInternal() is "consuming" the retain
+// But GPBSetRetainedObjectIvarWithFieldPrivate() is "consuming" the retain
 // count be holding onto the object (it is transferring it), the object is
 // count be holding onto the object (it is transferring it), the object is
 // still valid after returning from the call.  The other way to avoid this
 // still valid after returning from the call.  The other way to avoid this
 // would be to add a -retain/-autorelease, but that would force every
 // would be to add a -retain/-autorelease, but that would force every
@@ -571,14 +569,13 @@ static id CreateMapForField(GPBFieldDescriptor *field,
 // and performance hit.
 // and performance hit.
 
 
 static id GetOrCreateArrayIvarWithField(GPBMessage *self,
 static id GetOrCreateArrayIvarWithField(GPBMessage *self,
-                                        GPBFieldDescriptor *field,
-                                        GPBFileSyntax syntax) {
+                                        GPBFieldDescriptor *field) {
   id array = GPBGetObjectIvarWithFieldNoAutocreate(self, field);
   id array = GPBGetObjectIvarWithFieldNoAutocreate(self, field);
   if (!array) {
   if (!array) {
     // No lock needed, this is called from places expecting to mutate
     // No lock needed, this is called from places expecting to mutate
     // so no threading protection is needed.
     // so no threading protection is needed.
     array = CreateArrayForField(field, nil);
     array = CreateArrayForField(field, nil);
-    GPBSetRetainedObjectIvarWithFieldInternal(self, field, array, syntax);
+    GPBSetRetainedObjectIvarWithFieldPrivate(self, field, array);
   }
   }
   return array;
   return array;
 }
 }
@@ -602,14 +599,13 @@ static id GetArrayIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) {
 }
 }
 
 
 static id GetOrCreateMapIvarWithField(GPBMessage *self,
 static id GetOrCreateMapIvarWithField(GPBMessage *self,
-                                      GPBFieldDescriptor *field,
-                                      GPBFileSyntax syntax) {
+                                      GPBFieldDescriptor *field) {
   id dict = GPBGetObjectIvarWithFieldNoAutocreate(self, field);
   id dict = GPBGetObjectIvarWithFieldNoAutocreate(self, field);
   if (!dict) {
   if (!dict) {
     // No lock needed, this is called from places expecting to mutate
     // No lock needed, this is called from places expecting to mutate
     // so no threading protection is needed.
     // so no threading protection is needed.
     dict = CreateMapForField(field, nil);
     dict = CreateMapForField(field, nil);
-    GPBSetRetainedObjectIvarWithFieldInternal(self, field, dict, syntax);
+    GPBSetRetainedObjectIvarWithFieldPrivate(self, field, dict);
   }
   }
   return dict;
   return dict;
 }
 }
@@ -668,9 +664,8 @@ void GPBBecomeVisibleToAutocreator(GPBMessage *self) {
     // This will recursively make all parent messages visible until it reaches a
     // This will recursively make all parent messages visible until it reaches a
     // super-creator that's visible.
     // super-creator that's visible.
     if (self->autocreatorField_) {
     if (self->autocreatorField_) {
-      GPBFileSyntax syntax = [self->autocreator_ descriptor].file.syntax;
-      GPBSetObjectIvarWithFieldInternal(self->autocreator_,
-                                        self->autocreatorField_, self, syntax);
+      GPBSetObjectIvarWithFieldPrivate(self->autocreator_,
+                                        self->autocreatorField_, self);
     } else {
     } else {
       [self->autocreator_ setExtension:self->autocreatorExtension_ value:self];
       [self->autocreator_ setExtension:self->autocreatorExtension_ value:self];
     }
     }
@@ -936,8 +931,6 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
   // Copy all the storage...
   // Copy all the storage...
   memcpy(message->messageStorage_, messageStorage_, descriptor->storageSize_);
   memcpy(message->messageStorage_, messageStorage_, descriptor->storageSize_);
 
 
-  GPBFileSyntax syntax = descriptor.file.syntax;
-
   // Loop over the fields doing fixup...
   // Loop over the fields doing fixup...
   for (GPBFieldDescriptor *field in descriptor->fields_) {
   for (GPBFieldDescriptor *field in descriptor->fields_) {
     if (GPBFieldIsMapOrArray(field)) {
     if (GPBFieldIsMapOrArray(field)) {
@@ -1005,8 +998,7 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
         // We retain here because the memcpy picked up the pointer value and
         // We retain here because the memcpy picked up the pointer value and
         // the next call to SetRetainedObject... will release the current value.
         // the next call to SetRetainedObject... will release the current value.
         [value retain];
         [value retain];
-        GPBSetRetainedObjectIvarWithFieldInternal(message, field, newValue,
-                                                  syntax);
+        GPBSetRetainedObjectIvarWithFieldPrivate(message, field, newValue);
       }
       }
     } else if (GPBFieldDataTypeIsMessage(field)) {
     } else if (GPBFieldDataTypeIsMessage(field)) {
       // For object types, if we have a value, copy it.  If we don't,
       // For object types, if we have a value, copy it.  If we don't,
@@ -1018,8 +1010,7 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
         // We retain here because the memcpy picked up the pointer value and
         // We retain here because the memcpy picked up the pointer value and
         // the next call to SetRetainedObject... will release the current value.
         // the next call to SetRetainedObject... will release the current value.
         [value retain];
         [value retain];
-        GPBSetRetainedObjectIvarWithFieldInternal(message, field, newValue,
-                                                  syntax);
+        GPBSetRetainedObjectIvarWithFieldPrivate(message, field, newValue);
       } else {
       } else {
         uint8_t *storage = (uint8_t *)message->messageStorage_;
         uint8_t *storage = (uint8_t *)message->messageStorage_;
         id *typePtr = (id *)&storage[field->description_->offset];
         id *typePtr = (id *)&storage[field->description_->offset];
@@ -1033,8 +1024,7 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
       // We retain here because the memcpy picked up the pointer value and
       // We retain here because the memcpy picked up the pointer value and
       // the next call to SetRetainedObject... will release the current value.
       // the next call to SetRetainedObject... will release the current value.
       [value retain];
       [value retain];
-      GPBSetRetainedObjectIvarWithFieldInternal(message, field, newValue,
-                                                syntax);
+      GPBSetRetainedObjectIvarWithFieldPrivate(message, field, newValue);
     } else {
     } else {
       // memcpy took care of the rest of the primitive fields if they were set.
       // memcpy took care of the rest of the primitive fields if they were set.
     }
     }
@@ -2161,13 +2151,13 @@ static void MergeSingleFieldFromCodedInputStream(
 #define CASE_SINGLE_POD(NAME, TYPE, FUNC_TYPE)                             \
 #define CASE_SINGLE_POD(NAME, TYPE, FUNC_TYPE)                             \
     case GPBDataType##NAME: {                                              \
     case GPBDataType##NAME: {                                              \
       TYPE val = GPBCodedInputStreamRead##NAME(&input->state_);            \
       TYPE val = GPBCodedInputStreamRead##NAME(&input->state_);            \
-      GPBSet##FUNC_TYPE##IvarWithFieldInternal(self, field, val, syntax);  \
+      GPBSet##FUNC_TYPE##IvarWithFieldPrivate(self, field, val);           \
       break;                                                               \
       break;                                                               \
             }
             }
 #define CASE_SINGLE_OBJECT(NAME)                                           \
 #define CASE_SINGLE_OBJECT(NAME)                                           \
     case GPBDataType##NAME: {                                              \
     case GPBDataType##NAME: {                                              \
       id val = GPBCodedInputStreamReadRetained##NAME(&input->state_);      \
       id val = GPBCodedInputStreamReadRetained##NAME(&input->state_);      \
-      GPBSetRetainedObjectIvarWithFieldInternal(self, field, val, syntax); \
+      GPBSetRetainedObjectIvarWithFieldPrivate(self, field, val);          \
       break;                                                               \
       break;                                                               \
     }
     }
       CASE_SINGLE_POD(Bool, BOOL, Bool)
       CASE_SINGLE_POD(Bool, BOOL, Bool)
@@ -2198,7 +2188,7 @@ static void MergeSingleFieldFromCodedInputStream(
       } else {
       } else {
         GPBMessage *message = [[field.msgClass alloc] init];
         GPBMessage *message = [[field.msgClass alloc] init];
         [input readMessage:message extensionRegistry:extensionRegistry];
         [input readMessage:message extensionRegistry:extensionRegistry];
-        GPBSetRetainedObjectIvarWithFieldInternal(self, field, message, syntax);
+        GPBSetRetainedObjectIvarWithFieldPrivate(self, field, message);
       }
       }
       break;
       break;
     }
     }
@@ -2217,7 +2207,7 @@ static void MergeSingleFieldFromCodedInputStream(
         [input readGroup:GPBFieldNumber(field)
         [input readGroup:GPBFieldNumber(field)
                       message:message
                       message:message
             extensionRegistry:extensionRegistry];
             extensionRegistry:extensionRegistry];
-        GPBSetRetainedObjectIvarWithFieldInternal(self, field, message, syntax);
+        GPBSetRetainedObjectIvarWithFieldPrivate(self, field, message);
       }
       }
       break;
       break;
     }
     }
@@ -2226,7 +2216,7 @@ static void MergeSingleFieldFromCodedInputStream(
       int32_t val = GPBCodedInputStreamReadEnum(&input->state_);
       int32_t val = GPBCodedInputStreamReadEnum(&input->state_);
       if (GPBHasPreservingUnknownEnumSemantics(syntax) ||
       if (GPBHasPreservingUnknownEnumSemantics(syntax) ||
           [field isValidEnumValue:val]) {
           [field isValidEnumValue:val]) {
-        GPBSetInt32IvarWithFieldInternal(self, field, val, syntax);
+        GPBSetInt32IvarWithFieldPrivate(self, field, val);
       } else {
       } else {
         GPBUnknownFieldSet *unknownFields = GetOrMakeUnknownFields(self);
         GPBUnknownFieldSet *unknownFields = GetOrMakeUnknownFields(self);
         [unknownFields mergeVarintField:GPBFieldNumber(field) value:val];
         [unknownFields mergeVarintField:GPBFieldNumber(field) value:val];
@@ -2240,7 +2230,7 @@ static void MergeRepeatedPackedFieldFromCodedInputStream(
     GPBCodedInputStream *input) {
     GPBCodedInputStream *input) {
   GPBDataType fieldDataType = GPBGetFieldDataType(field);
   GPBDataType fieldDataType = GPBGetFieldDataType(field);
   GPBCodedInputStreamState *state = &input->state_;
   GPBCodedInputStreamState *state = &input->state_;
-  id genericArray = GetOrCreateArrayIvarWithField(self, field, syntax);
+  id genericArray = GetOrCreateArrayIvarWithField(self, field);
   int32_t length = GPBCodedInputStreamReadInt32(state);
   int32_t length = GPBCodedInputStreamReadInt32(state);
   size_t limit = GPBCodedInputStreamPushLimit(state, length);
   size_t limit = GPBCodedInputStreamPushLimit(state, length);
   while (GPBCodedInputStreamBytesUntilLimit(state) > 0) {
   while (GPBCodedInputStreamBytesUntilLimit(state) > 0) {
@@ -2293,7 +2283,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
     GPBMessage *self, GPBFieldDescriptor *field, GPBFileSyntax syntax,
     GPBMessage *self, GPBFieldDescriptor *field, GPBFileSyntax syntax,
     GPBCodedInputStream *input, GPBExtensionRegistry *extensionRegistry) {
     GPBCodedInputStream *input, GPBExtensionRegistry *extensionRegistry) {
   GPBCodedInputStreamState *state = &input->state_;
   GPBCodedInputStreamState *state = &input->state_;
-  id genericArray = GetOrCreateArrayIvarWithField(self, field, syntax);
+  id genericArray = GetOrCreateArrayIvarWithField(self, field);
   switch (GPBGetFieldDataType(field)) {
   switch (GPBGetFieldDataType(field)) {
 #define CASE_REPEATED_NOT_PACKED_POD(NAME, TYPE, ARRAY_TYPE) \
 #define CASE_REPEATED_NOT_PACKED_POD(NAME, TYPE, ARRAY_TYPE) \
    case GPBDataType##NAME: {                                 \
    case GPBDataType##NAME: {                                 \
@@ -2395,7 +2385,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
         } else {  // fieldType == GPBFieldTypeMap
         } else {  // fieldType == GPBFieldTypeMap
           // GPB*Dictionary or NSDictionary, exact type doesn't matter at this
           // GPB*Dictionary or NSDictionary, exact type doesn't matter at this
           // point.
           // point.
-          id map = GetOrCreateMapIvarWithField(self, fieldDescriptor, syntax);
+          id map = GetOrCreateMapIvarWithField(self, fieldDescriptor);
           [input readMapEntry:map
           [input readMapEntry:map
             extensionRegistry:extensionRegistry
             extensionRegistry:extensionRegistry
                         field:fieldDescriptor
                         field:fieldDescriptor
@@ -2469,7 +2459,6 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
   GPBBecomeVisibleToAutocreator(self);
   GPBBecomeVisibleToAutocreator(self);
 
 
   GPBDescriptor *descriptor = [[self class] descriptor];
   GPBDescriptor *descriptor = [[self class] descriptor];
-  GPBFileSyntax syntax = descriptor.file.syntax;
 
 
   for (GPBFieldDescriptor *field in descriptor->fields_) {
   for (GPBFieldDescriptor *field in descriptor->fields_) {
     GPBFieldType fieldType = field.fieldType;
     GPBFieldType fieldType = field.fieldType;
@@ -2483,44 +2472,44 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
       GPBDataType fieldDataType = GPBGetFieldDataType(field);
       GPBDataType fieldDataType = GPBGetFieldDataType(field);
       switch (fieldDataType) {
       switch (fieldDataType) {
         case GPBDataTypeBool:
         case GPBDataTypeBool:
-          GPBSetBoolIvarWithFieldInternal(
-              self, field, GPBGetMessageBoolField(other, field), syntax);
+          GPBSetBoolIvarWithFieldPrivate(
+              self, field, GPBGetMessageBoolField(other, field));
           break;
           break;
         case GPBDataTypeSFixed32:
         case GPBDataTypeSFixed32:
         case GPBDataTypeEnum:
         case GPBDataTypeEnum:
         case GPBDataTypeInt32:
         case GPBDataTypeInt32:
         case GPBDataTypeSInt32:
         case GPBDataTypeSInt32:
-          GPBSetInt32IvarWithFieldInternal(
-              self, field, GPBGetMessageInt32Field(other, field), syntax);
+          GPBSetInt32IvarWithFieldPrivate(
+              self, field, GPBGetMessageInt32Field(other, field));
           break;
           break;
         case GPBDataTypeFixed32:
         case GPBDataTypeFixed32:
         case GPBDataTypeUInt32:
         case GPBDataTypeUInt32:
-          GPBSetUInt32IvarWithFieldInternal(
-              self, field, GPBGetMessageUInt32Field(other, field), syntax);
+          GPBSetUInt32IvarWithFieldPrivate(
+              self, field, GPBGetMessageUInt32Field(other, field));
           break;
           break;
         case GPBDataTypeSFixed64:
         case GPBDataTypeSFixed64:
         case GPBDataTypeInt64:
         case GPBDataTypeInt64:
         case GPBDataTypeSInt64:
         case GPBDataTypeSInt64:
-          GPBSetInt64IvarWithFieldInternal(
-              self, field, GPBGetMessageInt64Field(other, field), syntax);
+          GPBSetInt64IvarWithFieldPrivate(
+              self, field, GPBGetMessageInt64Field(other, field));
           break;
           break;
         case GPBDataTypeFixed64:
         case GPBDataTypeFixed64:
         case GPBDataTypeUInt64:
         case GPBDataTypeUInt64:
-          GPBSetUInt64IvarWithFieldInternal(
-              self, field, GPBGetMessageUInt64Field(other, field), syntax);
+          GPBSetUInt64IvarWithFieldPrivate(
+              self, field, GPBGetMessageUInt64Field(other, field));
           break;
           break;
         case GPBDataTypeFloat:
         case GPBDataTypeFloat:
-          GPBSetFloatIvarWithFieldInternal(
-              self, field, GPBGetMessageFloatField(other, field), syntax);
+          GPBSetFloatIvarWithFieldPrivate(
+              self, field, GPBGetMessageFloatField(other, field));
           break;
           break;
         case GPBDataTypeDouble:
         case GPBDataTypeDouble:
-          GPBSetDoubleIvarWithFieldInternal(
-              self, field, GPBGetMessageDoubleField(other, field), syntax);
+          GPBSetDoubleIvarWithFieldPrivate(
+              self, field, GPBGetMessageDoubleField(other, field));
           break;
           break;
         case GPBDataTypeBytes:
         case GPBDataTypeBytes:
         case GPBDataTypeString: {
         case GPBDataTypeString: {
           id otherVal = GPBGetObjectIvarWithFieldNoAutocreate(other, field);
           id otherVal = GPBGetObjectIvarWithFieldNoAutocreate(other, field);
-          GPBSetObjectIvarWithFieldInternal(self, field, otherVal, syntax);
+          GPBSetObjectIvarWithFieldPrivate(self, field, otherVal);
           break;
           break;
         }
         }
         case GPBDataTypeMessage:
         case GPBDataTypeMessage:
@@ -2532,8 +2521,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
             [message mergeFrom:otherVal];
             [message mergeFrom:otherVal];
           } else {
           } else {
             GPBMessage *message = [otherVal copy];
             GPBMessage *message = [otherVal copy];
-            GPBSetRetainedObjectIvarWithFieldInternal(self, field, message,
-                                                      syntax);
+            GPBSetRetainedObjectIvarWithFieldPrivate(self, field, message);
           }
           }
           break;
           break;
         }
         }
@@ -2547,17 +2535,17 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
         GPBDataType fieldDataType = field->description_->dataType;
         GPBDataType fieldDataType = field->description_->dataType;
         if (GPBDataTypeIsObject(fieldDataType)) {
         if (GPBDataTypeIsObject(fieldDataType)) {
           NSMutableArray *resultArray =
           NSMutableArray *resultArray =
-              GetOrCreateArrayIvarWithField(self, field, syntax);
+              GetOrCreateArrayIvarWithField(self, field);
           [resultArray addObjectsFromArray:otherArray];
           [resultArray addObjectsFromArray:otherArray];
         } else if (fieldDataType == GPBDataTypeEnum) {
         } else if (fieldDataType == GPBDataTypeEnum) {
           GPBEnumArray *resultArray =
           GPBEnumArray *resultArray =
-              GetOrCreateArrayIvarWithField(self, field, syntax);
+              GetOrCreateArrayIvarWithField(self, field);
           [resultArray addRawValuesFromArray:otherArray];
           [resultArray addRawValuesFromArray:otherArray];
         } else {
         } else {
           // The array type doesn't matter, that all implement
           // The array type doesn't matter, that all implement
           // -addValuesFromArray:.
           // -addValuesFromArray:.
           GPBInt32Array *resultArray =
           GPBInt32Array *resultArray =
-              GetOrCreateArrayIvarWithField(self, field, syntax);
+              GetOrCreateArrayIvarWithField(self, field);
           [resultArray addValuesFromArray:otherArray];
           [resultArray addValuesFromArray:otherArray];
         }
         }
       }
       }
@@ -2571,19 +2559,19 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
         if (GPBDataTypeIsObject(keyDataType) &&
         if (GPBDataTypeIsObject(keyDataType) &&
             GPBDataTypeIsObject(valueDataType)) {
             GPBDataTypeIsObject(valueDataType)) {
           NSMutableDictionary *resultDict =
           NSMutableDictionary *resultDict =
-              GetOrCreateMapIvarWithField(self, field, syntax);
+              GetOrCreateMapIvarWithField(self, field);
           [resultDict addEntriesFromDictionary:otherDict];
           [resultDict addEntriesFromDictionary:otherDict];
         } else if (valueDataType == GPBDataTypeEnum) {
         } else if (valueDataType == GPBDataTypeEnum) {
           // The exact type doesn't matter, just need to know it is a
           // The exact type doesn't matter, just need to know it is a
           // GPB*EnumDictionary.
           // GPB*EnumDictionary.
           GPBInt32EnumDictionary *resultDict =
           GPBInt32EnumDictionary *resultDict =
-              GetOrCreateMapIvarWithField(self, field, syntax);
+              GetOrCreateMapIvarWithField(self, field);
           [resultDict addRawEntriesFromDictionary:otherDict];
           [resultDict addRawEntriesFromDictionary:otherDict];
         } else {
         } else {
           // The exact type doesn't matter, they all implement
           // The exact type doesn't matter, they all implement
           // -addEntriesFromDictionary:.
           // -addEntriesFromDictionary:.
           GPBInt32Int32Dictionary *resultDict =
           GPBInt32Int32Dictionary *resultDict =
-              GetOrCreateMapIvarWithField(self, field, syntax);
+              GetOrCreateMapIvarWithField(self, field);
           [resultDict addEntriesFromDictionary:otherDict];
           [resultDict addEntriesFromDictionary:otherDict];
         }
         }
       }
       }
@@ -3115,14 +3103,13 @@ static void ResolveIvarGet(__unsafe_unretained GPBFieldDescriptor *field,
 
 
 // See comment about __unsafe_unretained on ResolveIvarGet.
 // See comment about __unsafe_unretained on ResolveIvarGet.
 static void ResolveIvarSet(__unsafe_unretained GPBFieldDescriptor *field,
 static void ResolveIvarSet(__unsafe_unretained GPBFieldDescriptor *field,
-                           GPBFileSyntax syntax,
                            ResolveIvarAccessorMethodResult *result) {
                            ResolveIvarAccessorMethodResult *result) {
   GPBDataType fieldDataType = GPBGetFieldDataType(field);
   GPBDataType fieldDataType = GPBGetFieldDataType(field);
   switch (fieldDataType) {
   switch (fieldDataType) {
 #define CASE_SET(NAME, TYPE, TRUE_NAME)                                       \
 #define CASE_SET(NAME, TYPE, TRUE_NAME)                                       \
     case GPBDataType##NAME: {                                                 \
     case GPBDataType##NAME: {                                                 \
       result->impToAdd = imp_implementationWithBlock(^(id obj, TYPE value) {  \
       result->impToAdd = imp_implementationWithBlock(^(id obj, TYPE value) {  \
-        return GPBSet##TRUE_NAME##IvarWithFieldInternal(obj, field, value, syntax); \
+        return GPBSet##TRUE_NAME##IvarWithFieldPrivate(obj, field, value);    \
       });                                                                     \
       });                                                                     \
       result->encodingSelector = @selector(set##NAME:);                       \
       result->encodingSelector = @selector(set##NAME:);                       \
       break;                                                                  \
       break;                                                                  \
@@ -3130,7 +3117,7 @@ static void ResolveIvarSet(__unsafe_unretained GPBFieldDescriptor *field,
 #define CASE_SET_COPY(NAME)                                                   \
 #define CASE_SET_COPY(NAME)                                                   \
     case GPBDataType##NAME: {                                                 \
     case GPBDataType##NAME: {                                                 \
       result->impToAdd = imp_implementationWithBlock(^(id obj, id value) {    \
       result->impToAdd = imp_implementationWithBlock(^(id obj, id value) {    \
-        return GPBSetRetainedObjectIvarWithFieldInternal(obj, field, [value copy], syntax); \
+        return GPBSetRetainedObjectIvarWithFieldPrivate(obj, field, [value copy]); \
       });                                                                     \
       });                                                                     \
       result->encodingSelector = @selector(set##NAME:);                       \
       result->encodingSelector = @selector(set##NAME:);                       \
       break;                                                                  \
       break;                                                                  \
@@ -3177,7 +3164,7 @@ static void ResolveIvarSet(__unsafe_unretained GPBFieldDescriptor *field,
         ResolveIvarGet(field, &result);
         ResolveIvarGet(field, &result);
         break;
         break;
       } else if (sel == field->setSel_) {
       } else if (sel == field->setSel_) {
-        ResolveIvarSet(field, descriptor.file.syntax, &result);
+        ResolveIvarSet(field, &result);
         break;
         break;
       } else if (sel == field->hasOrCountSel_) {
       } else if (sel == field->hasOrCountSel_) {
         int32_t index = GPBFieldHasIndex(field);
         int32_t index = GPBFieldHasIndex(field);
@@ -3227,9 +3214,8 @@ static void ResolveIvarSet(__unsafe_unretained GPBFieldDescriptor *field,
       } else if (sel == field->setSel_) {
       } else if (sel == field->setSel_) {
         // Local for syntax so the block can directly capture it and not the
         // Local for syntax so the block can directly capture it and not the
         // full lookup.
         // full lookup.
-        const GPBFileSyntax syntax = descriptor.file.syntax;
         result.impToAdd = imp_implementationWithBlock(^(id obj, id value) {
         result.impToAdd = imp_implementationWithBlock(^(id obj, id value) {
-          GPBSetObjectIvarWithFieldInternal(obj, field, value, syntax);
+          GPBSetObjectIvarWithFieldPrivate(obj, field, value);
         });
         });
         result.encodingSelector = @selector(setArray:);
         result.encodingSelector = @selector(setArray:);
         break;
         break;
@@ -3334,9 +3320,7 @@ id GPBGetMessageRepeatedField(GPBMessage *self, GPBFieldDescriptor *field) {
      [self class], field.name];
      [self class], field.name];
   }
   }
 #endif
 #endif
-  GPBDescriptor *descriptor = [[self class] descriptor];
-  GPBFileSyntax syntax = descriptor.file.syntax;
-  return GetOrCreateArrayIvarWithField(self, field, syntax);
+  return GetOrCreateArrayIvarWithField(self, field);
 }
 }
 
 
 // Only exists for public api, no core code should use this.
 // Only exists for public api, no core code should use this.
@@ -3348,9 +3332,7 @@ id GPBGetMessageMapField(GPBMessage *self, GPBFieldDescriptor *field) {
      [self class], field.name];
      [self class], field.name];
   }
   }
 #endif
 #endif
-  GPBDescriptor *descriptor = [[self class] descriptor];
-  GPBFileSyntax syntax = descriptor.file.syntax;
-  return GetOrCreateMapIvarWithField(self, field, syntax);
+  return GetOrCreateMapIvarWithField(self, field);
 }
 }
 
 
 id GPBGetObjectIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) {
 id GPBGetObjectIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) {

+ 61 - 86
objectivec/GPBUtilities.m

@@ -392,15 +392,12 @@ void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
 //%            [self class], field.name,
 //%            [self class], field.name,
 //%            TypeToString(GPBGetFieldDataType(field)));
 //%            TypeToString(GPBGetFieldDataType(field)));
 //%#endif
 //%#endif
-//%  GPBFileSyntax syntax = [self descriptor].file.syntax;
-//%  GPBSet##NAME##IvarWithFieldInternal(self, field, value, syntax);
+//%  GPBSet##NAME##IvarWithFieldPrivate(self, field, value);
 //%}
 //%}
 //%
 //%
-//%void GPBSet##NAME##IvarWithFieldInternal(GPBMessage *self,
-//%            NAME$S                     GPBFieldDescriptor *field,
-//%            NAME$S                     TYPE value,
-//%            NAME$S                     GPBFileSyntax syntax) {
-//%#pragma unused(syntax)
+//%void GPBSet##NAME##IvarWithFieldPrivate(GPBMessage *self,
+//%            NAME$S                    GPBFieldDescriptor *field,
+//%            NAME$S                    TYPE value) {
 //%  GPBOneofDescriptor *oneof = field->containingOneof_;
 //%  GPBOneofDescriptor *oneof = field->containingOneof_;
 //%  GPBMessageFieldDescription *fieldDesc = field->description_;
 //%  GPBMessageFieldDescription *fieldDesc = field->description_;
 //%  if (oneof) {
 //%  if (oneof) {
@@ -515,16 +512,14 @@ void GPBClearAutocreatedMessageIvarWithField(GPBMessage *self,
 static void GPBSetObjectIvarWithField(GPBMessage *self,
 static void GPBSetObjectIvarWithField(GPBMessage *self,
                                       GPBFieldDescriptor *field, id value) {
                                       GPBFieldDescriptor *field, id value) {
   if (self == nil || field == nil) return;
   if (self == nil || field == nil) return;
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetRetainedObjectIvarWithFieldInternal(self, field, [value retain],
-                                            syntax);
+  GPBSetRetainedObjectIvarWithFieldPrivate(self, field, [value retain]);
 }
 }
 
 
 static void GPBSetCopyObjectIvarWithField(GPBMessage *self,
 static void GPBSetCopyObjectIvarWithField(GPBMessage *self,
                                           GPBFieldDescriptor *field, id value);
                                           GPBFieldDescriptor *field, id value);
 
 
 // GPBSetCopyObjectIvarWithField is blocked from the analyzer because it flags
 // GPBSetCopyObjectIvarWithField is blocked from the analyzer because it flags
-// a leak for the -copy even though GPBSetRetainedObjectIvarWithFieldInternal
+// a leak for the -copy even though GPBSetRetainedObjectIvarWithFieldPrivate
 // is marked as consuming the value. Note: For some reason this doesn't happen
 // is marked as consuming the value. Note: For some reason this doesn't happen
 // with the -retain in GPBSetObjectIvarWithField.
 // with the -retain in GPBSetObjectIvarWithField.
 #if !defined(__clang_analyzer__)
 #if !defined(__clang_analyzer__)
@@ -532,23 +527,18 @@ static void GPBSetCopyObjectIvarWithField(GPBMessage *self,
 static void GPBSetCopyObjectIvarWithField(GPBMessage *self,
 static void GPBSetCopyObjectIvarWithField(GPBMessage *self,
                                           GPBFieldDescriptor *field, id value) {
                                           GPBFieldDescriptor *field, id value) {
   if (self == nil || field == nil) return;
   if (self == nil || field == nil) return;
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetRetainedObjectIvarWithFieldInternal(self, field, [value copy],
-                                            syntax);
+  GPBSetRetainedObjectIvarWithFieldPrivate(self, field, [value copy]);
 }
 }
 #endif  // !defined(__clang_analyzer__)
 #endif  // !defined(__clang_analyzer__)
 
 
-void GPBSetObjectIvarWithFieldInternal(GPBMessage *self,
-                                       GPBFieldDescriptor *field, id value,
-                                       GPBFileSyntax syntax) {
-  GPBSetRetainedObjectIvarWithFieldInternal(self, field, [value retain],
-                                            syntax);
+void GPBSetObjectIvarWithFieldPrivate(GPBMessage *self,
+                                      GPBFieldDescriptor *field, id value) {
+  GPBSetRetainedObjectIvarWithFieldPrivate(self, field, [value retain]);
 }
 }
 
 
-void GPBSetRetainedObjectIvarWithFieldInternal(GPBMessage *self,
-                                               GPBFieldDescriptor *field,
-                                               id value, GPBFileSyntax syntax) {
-#pragma unused(syntax)
+void GPBSetRetainedObjectIvarWithFieldPrivate(GPBMessage *self,
+                                              GPBFieldDescriptor *field,
+                                              id value) {
   NSCAssert(self->messageStorage_ != NULL,
   NSCAssert(self->messageStorage_ != NULL,
             @"%@: All messages should have storage (from init)",
             @"%@: All messages should have storage (from init)",
             [self class]);
             [self class]);
@@ -687,16 +677,12 @@ int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field) {
               [self class], field.name,
               [self class], field.name,
               TypeToString(GPBGetFieldDataType(field)));
               TypeToString(GPBGetFieldDataType(field)));
   #endif
   #endif
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  return GPBGetEnumIvarWithFieldInternal(self, field, syntax);
-}
 
 
-int32_t GPBGetEnumIvarWithFieldInternal(GPBMessage *self,
-                                        GPBFieldDescriptor *field,
-                                        GPBFileSyntax syntax) {
   int32_t result = GPBGetMessageInt32Field(self, field);
   int32_t result = GPBGetMessageInt32Field(self, field);
   // If this is presevering unknown enums, make sure the value is valid before
   // If this is presevering unknown enums, make sure the value is valid before
   // returning it.
   // returning it.
+
+  GPBFileSyntax syntax = [self descriptor].file.syntax;
   if (GPBHasPreservingUnknownEnumSemantics(syntax) &&
   if (GPBHasPreservingUnknownEnumSemantics(syntax) &&
       ![field isValidEnumValue:result]) {
       ![field isValidEnumValue:result]) {
     result = kGPBUnrecognizedEnumeratorValue;
     result = kGPBUnrecognizedEnumeratorValue;
@@ -717,20 +703,18 @@ void GPBSetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field,
               [self class], field.name,
               [self class], field.name,
               TypeToString(GPBGetFieldDataType(field)));
               TypeToString(GPBGetFieldDataType(field)));
   #endif
   #endif
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetInt32IvarWithFieldInternal(self, field, value, syntax);
+  GPBSetEnumIvarWithFieldPrivate(self, field, value);
 }
 }
 
 
-void GPBSetEnumIvarWithFieldInternal(GPBMessage *self,
-                                     GPBFieldDescriptor *field, int32_t value,
-                                     GPBFileSyntax syntax) {
+void GPBSetEnumIvarWithFieldPrivate(GPBMessage *self,
+                                    GPBFieldDescriptor *field, int32_t value) {
   // Don't allow in unknown values.  Proto3 can use the Raw method.
   // Don't allow in unknown values.  Proto3 can use the Raw method.
   if (![field isValidEnumValue:value]) {
   if (![field isValidEnumValue:value]) {
     [NSException raise:NSInvalidArgumentException
     [NSException raise:NSInvalidArgumentException
                 format:@"%@.%@: Attempt to set an unknown enum value (%d)",
                 format:@"%@.%@: Attempt to set an unknown enum value (%d)",
                        [self class], field.name, value];
                        [self class], field.name, value];
   }
   }
-  GPBSetInt32IvarWithFieldInternal(self, field, value, syntax);
+  GPBSetInt32IvarWithFieldPrivate(self, field, value);
 }
 }
 
 
 // Only exists for public api, no core code should use this.
 // Only exists for public api, no core code should use this.
@@ -743,8 +727,7 @@ int32_t GPBGetMessageRawEnumField(GPBMessage *self,
 // Only exists for public api, no core code should use this.
 // Only exists for public api, no core code should use this.
 void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field,
 void GPBSetMessageRawEnumField(GPBMessage *self, GPBFieldDescriptor *field,
                                int32_t value) {
                                int32_t value) {
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetInt32IvarWithFieldInternal(self, field, value, syntax);
+  GPBSetInt32IvarWithFieldPrivate(self, field, value);
 }
 }
 
 
 BOOL GPBGetMessageBoolField(GPBMessage *self,
 BOOL GPBGetMessageBoolField(GPBMessage *self,
@@ -786,15 +769,12 @@ void GPBSetMessageBoolField(GPBMessage *self,
               [self class], field.name,
               [self class], field.name,
               TypeToString(GPBGetFieldDataType(field)));
               TypeToString(GPBGetFieldDataType(field)));
   #endif
   #endif
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetBoolIvarWithFieldInternal(self, field, value, syntax);
+  GPBSetBoolIvarWithFieldPrivate(self, field, value);
 }
 }
 
 
-void GPBSetBoolIvarWithFieldInternal(GPBMessage *self,
-                                     GPBFieldDescriptor *field,
-                                     BOOL value,
-                                     GPBFileSyntax syntax) {
-#pragma unused(syntax)
+void GPBSetBoolIvarWithFieldPrivate(GPBMessage *self,
+                                    GPBFieldDescriptor *field,
+                                    BOOL value) {
   GPBMessageFieldDescription *fieldDesc = field->description_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBOneofDescriptor *oneof = field->containingOneof_;
   if (oneof) {
   if (oneof) {
@@ -857,15 +837,12 @@ void GPBSetMessageInt32Field(GPBMessage *self,
             [self class], field.name,
             [self class], field.name,
             TypeToString(GPBGetFieldDataType(field)));
             TypeToString(GPBGetFieldDataType(field)));
 #endif
 #endif
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetInt32IvarWithFieldInternal(self, field, value, syntax);
+  GPBSetInt32IvarWithFieldPrivate(self, field, value);
 }
 }
 
 
-void GPBSetInt32IvarWithFieldInternal(GPBMessage *self,
-                                      GPBFieldDescriptor *field,
-                                      int32_t value,
-                                      GPBFileSyntax syntax) {
-#pragma unused(syntax)
+void GPBSetInt32IvarWithFieldPrivate(GPBMessage *self,
+                                     GPBFieldDescriptor *field,
+                                     int32_t value) {
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   if (oneof) {
   if (oneof) {
@@ -933,15 +910,12 @@ void GPBSetMessageUInt32Field(GPBMessage *self,
             [self class], field.name,
             [self class], field.name,
             TypeToString(GPBGetFieldDataType(field)));
             TypeToString(GPBGetFieldDataType(field)));
 #endif
 #endif
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetUInt32IvarWithFieldInternal(self, field, value, syntax);
+  GPBSetUInt32IvarWithFieldPrivate(self, field, value);
 }
 }
 
 
-void GPBSetUInt32IvarWithFieldInternal(GPBMessage *self,
-                                       GPBFieldDescriptor *field,
-                                       uint32_t value,
-                                       GPBFileSyntax syntax) {
-#pragma unused(syntax)
+void GPBSetUInt32IvarWithFieldPrivate(GPBMessage *self,
+                                      GPBFieldDescriptor *field,
+                                      uint32_t value) {
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   if (oneof) {
   if (oneof) {
@@ -1009,15 +983,12 @@ void GPBSetMessageInt64Field(GPBMessage *self,
             [self class], field.name,
             [self class], field.name,
             TypeToString(GPBGetFieldDataType(field)));
             TypeToString(GPBGetFieldDataType(field)));
 #endif
 #endif
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetInt64IvarWithFieldInternal(self, field, value, syntax);
+  GPBSetInt64IvarWithFieldPrivate(self, field, value);
 }
 }
 
 
-void GPBSetInt64IvarWithFieldInternal(GPBMessage *self,
-                                      GPBFieldDescriptor *field,
-                                      int64_t value,
-                                      GPBFileSyntax syntax) {
-#pragma unused(syntax)
+void GPBSetInt64IvarWithFieldPrivate(GPBMessage *self,
+                                     GPBFieldDescriptor *field,
+                                     int64_t value) {
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   if (oneof) {
   if (oneof) {
@@ -1085,15 +1056,12 @@ void GPBSetMessageUInt64Field(GPBMessage *self,
             [self class], field.name,
             [self class], field.name,
             TypeToString(GPBGetFieldDataType(field)));
             TypeToString(GPBGetFieldDataType(field)));
 #endif
 #endif
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetUInt64IvarWithFieldInternal(self, field, value, syntax);
+  GPBSetUInt64IvarWithFieldPrivate(self, field, value);
 }
 }
 
 
-void GPBSetUInt64IvarWithFieldInternal(GPBMessage *self,
-                                       GPBFieldDescriptor *field,
-                                       uint64_t value,
-                                       GPBFileSyntax syntax) {
-#pragma unused(syntax)
+void GPBSetUInt64IvarWithFieldPrivate(GPBMessage *self,
+                                      GPBFieldDescriptor *field,
+                                      uint64_t value) {
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   if (oneof) {
   if (oneof) {
@@ -1161,15 +1129,12 @@ void GPBSetMessageFloatField(GPBMessage *self,
             [self class], field.name,
             [self class], field.name,
             TypeToString(GPBGetFieldDataType(field)));
             TypeToString(GPBGetFieldDataType(field)));
 #endif
 #endif
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetFloatIvarWithFieldInternal(self, field, value, syntax);
+  GPBSetFloatIvarWithFieldPrivate(self, field, value);
 }
 }
 
 
-void GPBSetFloatIvarWithFieldInternal(GPBMessage *self,
-                                      GPBFieldDescriptor *field,
-                                      float value,
-                                      GPBFileSyntax syntax) {
-#pragma unused(syntax)
+void GPBSetFloatIvarWithFieldPrivate(GPBMessage *self,
+                                     GPBFieldDescriptor *field,
+                                     float value) {
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   if (oneof) {
   if (oneof) {
@@ -1237,15 +1202,12 @@ void GPBSetMessageDoubleField(GPBMessage *self,
             [self class], field.name,
             [self class], field.name,
             TypeToString(GPBGetFieldDataType(field)));
             TypeToString(GPBGetFieldDataType(field)));
 #endif
 #endif
-  GPBFileSyntax syntax = [self descriptor].file.syntax;
-  GPBSetDoubleIvarWithFieldInternal(self, field, value, syntax);
+  GPBSetDoubleIvarWithFieldPrivate(self, field, value);
 }
 }
 
 
-void GPBSetDoubleIvarWithFieldInternal(GPBMessage *self,
-                                       GPBFieldDescriptor *field,
-                                       double value,
-                                       GPBFileSyntax syntax) {
-#pragma unused(syntax)
+void GPBSetDoubleIvarWithFieldPrivate(GPBMessage *self,
+                                      GPBFieldDescriptor *field,
+                                      double value) {
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBOneofDescriptor *oneof = field->containingOneof_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   GPBMessageFieldDescription *fieldDesc = field->description_;
   if (oneof) {
   if (oneof) {
@@ -2261,6 +2223,19 @@ NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key,
 
 
 #pragma clang diagnostic pop
 #pragma clang diagnostic pop
 
 
+#pragma mark Legacy methods old generated code calls
+
+// Shim from the older generated code into the runtime.
+void GPBSetInt32IvarWithFieldInternal(GPBMessage *self,
+                                      GPBFieldDescriptor *field,
+                                      int32_t value,
+                                      GPBFileSyntax syntax) {
+#pragma unused(syntax)
+  GPBSetMessageInt32Field(self, field, value);
+}
+
+#pragma mark Misc Helpers
+
 BOOL GPBClassHasSel(Class aClass, SEL sel) {
 BOOL GPBClassHasSel(Class aClass, SEL sel) {
   // NOTE: We have to use class_copyMethodList, all other runtime method
   // NOTE: We have to use class_copyMethodList, all other runtime method
   // lookups actually also resolve the method implementation and this
   // lookups actually also resolve the method implementation and this

+ 41 - 53
objectivec/GPBUtilities_PackagePrivate.h

@@ -213,98 +213,79 @@ void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
 #pragma clang diagnostic pop
 #pragma clang diagnostic pop
 
 
 //%PDDM-DEFINE GPB_IVAR_SET_DECL(NAME, TYPE)
 //%PDDM-DEFINE GPB_IVAR_SET_DECL(NAME, TYPE)
-//%void GPBSet##NAME##IvarWithFieldInternal(GPBMessage *self,
-//%            NAME$S                     GPBFieldDescriptor *field,
-//%            NAME$S                     TYPE value,
-//%            NAME$S                     GPBFileSyntax syntax);
+//%void GPBSet##NAME##IvarWithFieldPrivate(GPBMessage *self,
+//%            NAME$S                    GPBFieldDescriptor *field,
+//%            NAME$S                    TYPE value);
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Bool, BOOL)
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Bool, BOOL)
 // This block of code is generated, do not edit it directly.
 // This block of code is generated, do not edit it directly.
 // clang-format off
 // clang-format off
 
 
-void GPBSetBoolIvarWithFieldInternal(GPBMessage *self,
-                                     GPBFieldDescriptor *field,
-                                     BOOL value,
-                                     GPBFileSyntax syntax);
+void GPBSetBoolIvarWithFieldPrivate(GPBMessage *self,
+                                    GPBFieldDescriptor *field,
+                                    BOOL value);
 // clang-format on
 // clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Int32, int32_t)
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Int32, int32_t)
 // This block of code is generated, do not edit it directly.
 // This block of code is generated, do not edit it directly.
 // clang-format off
 // clang-format off
 
 
-void GPBSetInt32IvarWithFieldInternal(GPBMessage *self,
-                                      GPBFieldDescriptor *field,
-                                      int32_t value,
-                                      GPBFileSyntax syntax);
+void GPBSetInt32IvarWithFieldPrivate(GPBMessage *self,
+                                     GPBFieldDescriptor *field,
+                                     int32_t value);
 // clang-format on
 // clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(UInt32, uint32_t)
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(UInt32, uint32_t)
 // This block of code is generated, do not edit it directly.
 // This block of code is generated, do not edit it directly.
 // clang-format off
 // clang-format off
 
 
-void GPBSetUInt32IvarWithFieldInternal(GPBMessage *self,
-                                       GPBFieldDescriptor *field,
-                                       uint32_t value,
-                                       GPBFileSyntax syntax);
+void GPBSetUInt32IvarWithFieldPrivate(GPBMessage *self,
+                                      GPBFieldDescriptor *field,
+                                      uint32_t value);
 // clang-format on
 // clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Int64, int64_t)
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Int64, int64_t)
 // This block of code is generated, do not edit it directly.
 // This block of code is generated, do not edit it directly.
 // clang-format off
 // clang-format off
 
 
-void GPBSetInt64IvarWithFieldInternal(GPBMessage *self,
-                                      GPBFieldDescriptor *field,
-                                      int64_t value,
-                                      GPBFileSyntax syntax);
+void GPBSetInt64IvarWithFieldPrivate(GPBMessage *self,
+                                     GPBFieldDescriptor *field,
+                                     int64_t value);
 // clang-format on
 // clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(UInt64, uint64_t)
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(UInt64, uint64_t)
 // This block of code is generated, do not edit it directly.
 // This block of code is generated, do not edit it directly.
 // clang-format off
 // clang-format off
 
 
-void GPBSetUInt64IvarWithFieldInternal(GPBMessage *self,
-                                       GPBFieldDescriptor *field,
-                                       uint64_t value,
-                                       GPBFileSyntax syntax);
+void GPBSetUInt64IvarWithFieldPrivate(GPBMessage *self,
+                                      GPBFieldDescriptor *field,
+                                      uint64_t value);
 // clang-format on
 // clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Float, float)
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Float, float)
 // This block of code is generated, do not edit it directly.
 // This block of code is generated, do not edit it directly.
 // clang-format off
 // clang-format off
 
 
-void GPBSetFloatIvarWithFieldInternal(GPBMessage *self,
-                                      GPBFieldDescriptor *field,
-                                      float value,
-                                      GPBFileSyntax syntax);
+void GPBSetFloatIvarWithFieldPrivate(GPBMessage *self,
+                                     GPBFieldDescriptor *field,
+                                     float value);
 // clang-format on
 // clang-format on
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Double, double)
 //%PDDM-EXPAND GPB_IVAR_SET_DECL(Double, double)
 // This block of code is generated, do not edit it directly.
 // This block of code is generated, do not edit it directly.
 // clang-format off
 // clang-format off
 
 
-void GPBSetDoubleIvarWithFieldInternal(GPBMessage *self,
-                                       GPBFieldDescriptor *field,
-                                       double value,
-                                       GPBFileSyntax syntax);
-// clang-format on
-//%PDDM-EXPAND GPB_IVAR_SET_DECL(Enum, int32_t)
-// This block of code is generated, do not edit it directly.
-// clang-format off
-
-void GPBSetEnumIvarWithFieldInternal(GPBMessage *self,
-                                     GPBFieldDescriptor *field,
-                                     int32_t value,
-                                     GPBFileSyntax syntax);
+void GPBSetDoubleIvarWithFieldPrivate(GPBMessage *self,
+                                      GPBFieldDescriptor *field,
+                                      double value);
 // clang-format on
 // clang-format on
-//%PDDM-EXPAND-END (8 expansions)
+//%PDDM-EXPAND-END (7 expansions)
 
 
-int32_t GPBGetEnumIvarWithFieldInternal(GPBMessage *self,
-                                        GPBFieldDescriptor *field,
-                                        GPBFileSyntax syntax);
+void GPBSetEnumIvarWithFieldPrivate(GPBMessage *self,
+                                    GPBFieldDescriptor *field,
+                                    int32_t value);
 
 
 id GPBGetObjectIvarWithField(GPBMessage *self, GPBFieldDescriptor *field);
 id GPBGetObjectIvarWithField(GPBMessage *self, GPBFieldDescriptor *field);
 
 
-void GPBSetObjectIvarWithFieldInternal(GPBMessage *self,
-                                       GPBFieldDescriptor *field, id value,
-                                       GPBFileSyntax syntax);
-void GPBSetRetainedObjectIvarWithFieldInternal(GPBMessage *self,
-                                               GPBFieldDescriptor *field,
-                                               id __attribute__((ns_consumed))
-                                               value,
-                                               GPBFileSyntax syntax);
+void GPBSetObjectIvarWithFieldPrivate(GPBMessage *self,
+                                      GPBFieldDescriptor *field, id value);
+void GPBSetRetainedObjectIvarWithFieldPrivate(GPBMessage *self,
+                                              GPBFieldDescriptor *field,
+                                              id __attribute__((ns_consumed))
+                                              value);
 
 
 // GPBGetObjectIvarWithField will automatically create the field (message) if
 // GPBGetObjectIvarWithField will automatically create the field (message) if
 // it doesn't exist. GPBGetObjectIvarWithFieldNoAutocreate will return nil.
 // it doesn't exist. GPBGetObjectIvarWithFieldNoAutocreate will return nil.
@@ -331,6 +312,13 @@ const char *GPBMessageEncodingForSelector(SEL selector, BOOL instanceSel);
 NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key,
 NSString *GPBDecodeTextFormatName(const uint8_t *decodeData, int32_t key,
                                   NSString *inputString);
                                   NSString *inputString);
 
 
+
+// Shim from the older generated code into the runtime.
+void GPBSetInt32IvarWithFieldInternal(GPBMessage *self,
+                                      GPBFieldDescriptor *field,
+                                      int32_t value,
+                                      GPBFileSyntax syntax);
+
 // A series of selectors that are used solely to get @encoding values
 // A series of selectors that are used solely to get @encoding values
 // for them by the dynamic protobuf runtime code. See
 // for them by the dynamic protobuf runtime code. See
 // GPBMessageEncodingForSelector for details. GPBRootObject conforms to
 // GPBMessageEncodingForSelector for details. GPBRootObject conforms to