aboutsummaryrefslogtreecommitdiff
path: root/objectivec/GPBRootObject.m
diff options
context:
space:
mode:
authorThomas Van Lenten <thomasvl@google.com>2015-06-16 16:45:14 -0400
committerThomas Van Lenten <thomasvl@google.com>2015-06-16 17:04:50 -0400
commit8c88957ef375f3b739b6e72ea5c2fb71b12e1fc2 (patch)
tree31b4561aae2a11b1a9b4b7010dc9df10c52a4d72 /objectivec/GPBRootObject.m
parent4cbb612299eaf8259db25f5dcda46022fbd1db54 (diff)
downloadprotobuf-8c88957ef375f3b739b6e72ea5c2fb71b12e1fc2.tar.gz
protobuf-8c88957ef375f3b739b6e72ea5c2fb71b12e1fc2.tar.bz2
protobuf-8c88957ef375f3b739b6e72ea5c2fb71b12e1fc2.zip
Add nonnil markup to ObjC library.
Add the clang annotations to the objc library and generated code to help with Swift bridging and compiler checks.
Diffstat (limited to 'objectivec/GPBRootObject.m')
-rw-r--r--objectivec/GPBRootObject.m5
1 files changed, 4 insertions, 1 deletions
diff --git a/objectivec/GPBRootObject.m b/objectivec/GPBRootObject.m
index 3f648257..7036723f 100644
--- a/objectivec/GPBRootObject.m
+++ b/objectivec/GPBRootObject.m
@@ -36,6 +36,7 @@
#import <CoreFoundation/CoreFoundation.h>
#import "GPBDescriptor.h"
+#import "GPBExtensionRegistry.h"
#import "GPBUtilities_PackagePrivate.h"
@interface GPBExtensionDescriptor (GPBRootObject)
@@ -97,6 +98,7 @@ static CFHashCode GPBRootExtensionKeyHash(const void *value) {
static OSSpinLock gExtensionSingletonDictionaryLock_ = OS_SPINLOCK_INIT;
static CFMutableDictionaryRef gExtensionSingletonDictionary = NULL;
+static GPBExtensionRegistry *gDefaultExtensionRegistry = NULL;
+ (void)initialize {
// Ensure the global is started up.
@@ -113,6 +115,7 @@ static CFMutableDictionaryRef gExtensionSingletonDictionary = NULL;
gExtensionSingletonDictionary =
CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &keyCallBacks,
&kCFTypeDictionaryValueCallBacks);
+ gDefaultExtensionRegistry = [[GPBExtensionRegistry alloc] init];
}
if ([self superclass] == [GPBRootObject class]) {
@@ -126,7 +129,7 @@ static CFMutableDictionaryRef gExtensionSingletonDictionary = NULL;
+ (GPBExtensionRegistry *)extensionRegistry {
// Is overridden in all the subclasses that provide extensions to provide the
// per class one.
- return nil;
+ return gDefaultExtensionRegistry;
}
+ (void)globallyRegisterExtension:(GPBExtensionDescriptor *)field {