|
|
@@ -28,6 +28,19 @@
|
|
|
|
|
|
#pragma clang diagnostic push
|
|
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
|
|
+#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
|
|
|
+
|
|
|
+#pragma mark - Objective C Class references
|
|
|
+// This somewhat arcane code forces linkage of classes from static archives by
|
|
|
+// adding a concrete reference to the classes.
|
|
|
+// We don't use `[Foo class]` because we need a static value for our initializer.
|
|
|
+// This also has the added benefit of reducing size in that we don't have to
|
|
|
+// encode the class names and look them up at runtime.
|
|
|
+extern const GPBObjcClassReference OBJC_CLASS_$_GPBAny;
|
|
|
+extern const GPBObjcClassReference OBJC_CLASS_$_GPBEnumValue;
|
|
|
+extern const GPBObjcClassReference OBJC_CLASS_$_GPBField;
|
|
|
+extern const GPBObjcClassReference OBJC_CLASS_$_GPBOption;
|
|
|
+extern const GPBObjcClassReference OBJC_CLASS_$_GPBSourceContext;
|
|
|
|
|
|
#pragma mark - GPBTypeRoot
|
|
|
|
|
|
@@ -117,7 +130,7 @@ typedef struct GPBType__storage_ {
|
|
|
static GPBMessageFieldDescription fields[] = {
|
|
|
{
|
|
|
.name = "name",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBType_FieldNumber_Name,
|
|
|
.hasIndex = 0,
|
|
|
.offset = (uint32_t)offsetof(GPBType__storage_, name),
|
|
|
@@ -126,7 +139,7 @@ typedef struct GPBType__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "fieldsArray",
|
|
|
- .dataTypeSpecific.className = GPBStringifySymbol(GPBField),
|
|
|
+ .dataTypeSpecific.clazz = ((__bridge Class)&OBJC_CLASS_$_GPBField),
|
|
|
.number = GPBType_FieldNumber_FieldsArray,
|
|
|
.hasIndex = GPBNoHasBit,
|
|
|
.offset = (uint32_t)offsetof(GPBType__storage_, fieldsArray),
|
|
|
@@ -135,7 +148,7 @@ typedef struct GPBType__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "oneofsArray",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBType_FieldNumber_OneofsArray,
|
|
|
.hasIndex = GPBNoHasBit,
|
|
|
.offset = (uint32_t)offsetof(GPBType__storage_, oneofsArray),
|
|
|
@@ -144,7 +157,7 @@ typedef struct GPBType__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "optionsArray",
|
|
|
- .dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
|
+ .dataTypeSpecific.clazz = ((__bridge Class)&OBJC_CLASS_$_GPBOption),
|
|
|
.number = GPBType_FieldNumber_OptionsArray,
|
|
|
.hasIndex = GPBNoHasBit,
|
|
|
.offset = (uint32_t)offsetof(GPBType__storage_, optionsArray),
|
|
|
@@ -153,7 +166,7 @@ typedef struct GPBType__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "sourceContext",
|
|
|
- .dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext),
|
|
|
+ .dataTypeSpecific.clazz = ((__bridge Class)&OBJC_CLASS_$_GPBSourceContext),
|
|
|
.number = GPBType_FieldNumber_SourceContext,
|
|
|
.hasIndex = 1,
|
|
|
.offset = (uint32_t)offsetof(GPBType__storage_, sourceContext),
|
|
|
@@ -177,7 +190,7 @@ typedef struct GPBType__storage_ {
|
|
|
fields:fields
|
|
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
|
|
storageSize:sizeof(GPBType__storage_)
|
|
|
- flags:GPBDescriptorInitializationFlag_None];
|
|
|
+ flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
|
|
#if defined(DEBUG) && DEBUG
|
|
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
|
|
#endif // DEBUG
|
|
|
@@ -254,7 +267,7 @@ typedef struct GPBField__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "number",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBField_FieldNumber_Number,
|
|
|
.hasIndex = 2,
|
|
|
.offset = (uint32_t)offsetof(GPBField__storage_, number),
|
|
|
@@ -263,7 +276,7 @@ typedef struct GPBField__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "name",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBField_FieldNumber_Name,
|
|
|
.hasIndex = 3,
|
|
|
.offset = (uint32_t)offsetof(GPBField__storage_, name),
|
|
|
@@ -272,7 +285,7 @@ typedef struct GPBField__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "typeURL",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBField_FieldNumber_TypeURL,
|
|
|
.hasIndex = 4,
|
|
|
.offset = (uint32_t)offsetof(GPBField__storage_, typeURL),
|
|
|
@@ -281,7 +294,7 @@ typedef struct GPBField__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "oneofIndex",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBField_FieldNumber_OneofIndex,
|
|
|
.hasIndex = 5,
|
|
|
.offset = (uint32_t)offsetof(GPBField__storage_, oneofIndex),
|
|
|
@@ -290,7 +303,7 @@ typedef struct GPBField__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "packed",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBField_FieldNumber_Packed,
|
|
|
.hasIndex = 6,
|
|
|
.offset = 7, // Stored in _has_storage_ to save space.
|
|
|
@@ -299,7 +312,7 @@ typedef struct GPBField__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "optionsArray",
|
|
|
- .dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
|
+ .dataTypeSpecific.clazz = ((__bridge Class)&OBJC_CLASS_$_GPBOption),
|
|
|
.number = GPBField_FieldNumber_OptionsArray,
|
|
|
.hasIndex = GPBNoHasBit,
|
|
|
.offset = (uint32_t)offsetof(GPBField__storage_, optionsArray),
|
|
|
@@ -308,7 +321,7 @@ typedef struct GPBField__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "jsonName",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBField_FieldNumber_JsonName,
|
|
|
.hasIndex = 8,
|
|
|
.offset = (uint32_t)offsetof(GPBField__storage_, jsonName),
|
|
|
@@ -317,7 +330,7 @@ typedef struct GPBField__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "defaultValue",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBField_FieldNumber_DefaultValue,
|
|
|
.hasIndex = 9,
|
|
|
.offset = (uint32_t)offsetof(GPBField__storage_, defaultValue),
|
|
|
@@ -332,7 +345,7 @@ typedef struct GPBField__storage_ {
|
|
|
fields:fields
|
|
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
|
|
storageSize:sizeof(GPBField__storage_)
|
|
|
- flags:GPBDescriptorInitializationFlag_None];
|
|
|
+ flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
|
|
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
|
|
|
static const char *extraTextFormatInfo =
|
|
|
"\001\006\004\241!!\000";
|
|
|
@@ -513,7 +526,7 @@ typedef struct GPBEnum__storage_ {
|
|
|
static GPBMessageFieldDescription fields[] = {
|
|
|
{
|
|
|
.name = "name",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBEnum_FieldNumber_Name,
|
|
|
.hasIndex = 0,
|
|
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, name),
|
|
|
@@ -522,7 +535,7 @@ typedef struct GPBEnum__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "enumvalueArray",
|
|
|
- .dataTypeSpecific.className = GPBStringifySymbol(GPBEnumValue),
|
|
|
+ .dataTypeSpecific.clazz = ((__bridge Class)&OBJC_CLASS_$_GPBEnumValue),
|
|
|
.number = GPBEnum_FieldNumber_EnumvalueArray,
|
|
|
.hasIndex = GPBNoHasBit,
|
|
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, enumvalueArray),
|
|
|
@@ -531,7 +544,7 @@ typedef struct GPBEnum__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "optionsArray",
|
|
|
- .dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
|
+ .dataTypeSpecific.clazz = ((__bridge Class)&OBJC_CLASS_$_GPBOption),
|
|
|
.number = GPBEnum_FieldNumber_OptionsArray,
|
|
|
.hasIndex = GPBNoHasBit,
|
|
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, optionsArray),
|
|
|
@@ -540,7 +553,7 @@ typedef struct GPBEnum__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "sourceContext",
|
|
|
- .dataTypeSpecific.className = GPBStringifySymbol(GPBSourceContext),
|
|
|
+ .dataTypeSpecific.clazz = ((__bridge Class)&OBJC_CLASS_$_GPBSourceContext),
|
|
|
.number = GPBEnum_FieldNumber_SourceContext,
|
|
|
.hasIndex = 1,
|
|
|
.offset = (uint32_t)offsetof(GPBEnum__storage_, sourceContext),
|
|
|
@@ -564,7 +577,7 @@ typedef struct GPBEnum__storage_ {
|
|
|
fields:fields
|
|
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
|
|
storageSize:sizeof(GPBEnum__storage_)
|
|
|
- flags:GPBDescriptorInitializationFlag_None];
|
|
|
+ flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
|
|
#if defined(DEBUG) && DEBUG
|
|
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
|
|
#endif // DEBUG
|
|
|
@@ -610,7 +623,7 @@ typedef struct GPBEnumValue__storage_ {
|
|
|
static GPBMessageFieldDescription fields[] = {
|
|
|
{
|
|
|
.name = "name",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBEnumValue_FieldNumber_Name,
|
|
|
.hasIndex = 0,
|
|
|
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, name),
|
|
|
@@ -619,7 +632,7 @@ typedef struct GPBEnumValue__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "number",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBEnumValue_FieldNumber_Number,
|
|
|
.hasIndex = 1,
|
|
|
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, number),
|
|
|
@@ -628,7 +641,7 @@ typedef struct GPBEnumValue__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "optionsArray",
|
|
|
- .dataTypeSpecific.className = GPBStringifySymbol(GPBOption),
|
|
|
+ .dataTypeSpecific.clazz = ((__bridge Class)&OBJC_CLASS_$_GPBOption),
|
|
|
.number = GPBEnumValue_FieldNumber_OptionsArray,
|
|
|
.hasIndex = GPBNoHasBit,
|
|
|
.offset = (uint32_t)offsetof(GPBEnumValue__storage_, optionsArray),
|
|
|
@@ -643,7 +656,7 @@ typedef struct GPBEnumValue__storage_ {
|
|
|
fields:fields
|
|
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
|
|
storageSize:sizeof(GPBEnumValue__storage_)
|
|
|
- flags:GPBDescriptorInitializationFlag_None];
|
|
|
+ flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
|
|
#if defined(DEBUG) && DEBUG
|
|
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
|
|
#endif // DEBUG
|
|
|
@@ -675,7 +688,7 @@ typedef struct GPBOption__storage_ {
|
|
|
static GPBMessageFieldDescription fields[] = {
|
|
|
{
|
|
|
.name = "name",
|
|
|
- .dataTypeSpecific.className = NULL,
|
|
|
+ .dataTypeSpecific.clazz = Nil,
|
|
|
.number = GPBOption_FieldNumber_Name,
|
|
|
.hasIndex = 0,
|
|
|
.offset = (uint32_t)offsetof(GPBOption__storage_, name),
|
|
|
@@ -684,7 +697,7 @@ typedef struct GPBOption__storage_ {
|
|
|
},
|
|
|
{
|
|
|
.name = "value",
|
|
|
- .dataTypeSpecific.className = GPBStringifySymbol(GPBAny),
|
|
|
+ .dataTypeSpecific.clazz = ((__bridge Class)&OBJC_CLASS_$_GPBAny),
|
|
|
.number = GPBOption_FieldNumber_Value,
|
|
|
.hasIndex = 1,
|
|
|
.offset = (uint32_t)offsetof(GPBOption__storage_, value),
|
|
|
@@ -699,7 +712,7 @@ typedef struct GPBOption__storage_ {
|
|
|
fields:fields
|
|
|
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
|
|
storageSize:sizeof(GPBOption__storage_)
|
|
|
- flags:GPBDescriptorInitializationFlag_None];
|
|
|
+ flags:GPBDescriptorInitializationFlag_UsesClassRefs];
|
|
|
#if defined(DEBUG) && DEBUG
|
|
|
NSAssert(descriptor == nil, @"Startup recursed!");
|
|
|
#endif // DEBUG
|