aboutsummaryrefslogtreecommitdiff
path: root/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/google/protobuf/compiler/objectivec/objectivec_extension.cc')
-rw-r--r--src/google/protobuf/compiler/objectivec/objectivec_extension.cc39
1 files changed, 5 insertions, 34 deletions
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_extension.cc b/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
index 76137c80..4e348393 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_extension.cc
@@ -46,24 +46,6 @@ ExtensionGenerator::ExtensionGenerator(const string& root_class_name,
: method_name_(ExtensionMethodName(descriptor)),
root_class_and_method_name_(root_class_name + "_" + method_name_),
descriptor_(descriptor) {
- // Extensions can be filtered via the method they are accessed off the
- // file's Root with.
- if (FilterClass(root_class_and_method_name_)) {
- filter_reason_ =
- string("Extension |") + root_class_and_method_name_ + "| was not whitelisted.";
- } else {
- // Extensions that add a Message field also require that field be allowed
- // by the filter, or they aren't usable.
- ObjectiveCType objc_type = GetObjectiveCType(descriptor_);
- if (objc_type == OBJECTIVECTYPE_MESSAGE) {
- const string message_class_name(ClassName(descriptor_->message_type()));
- if (FilterClass(message_class_name)) {
- filter_reason_ = string("Extension |") + root_class_and_method_name_ +
- "| needs message |" + message_class_name +
- "|, which was not whitelisted.";
- }
- }
- }
if (descriptor->is_map()) {
// NOTE: src/google/protobuf/compiler/plugin.cc makes use of cerr for some
// error cases, so it seems to be ok to use as a back door for errors.
@@ -77,10 +59,6 @@ ExtensionGenerator::ExtensionGenerator(const string& root_class_name,
ExtensionGenerator::~ExtensionGenerator() {}
void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) {
- if (IsFiltered()) {
- printer->Print("// $filter_reason$\n\n", "filter_reason", filter_reason_);
- return;
- }
map<string, string> vars;
vars["method_name"] = method_name_;
SourceLocation location;
@@ -91,15 +69,11 @@ void ExtensionGenerator::GenerateMembersHeader(io::Printer* printer) {
}
printer->Print(vars,
"$comments$"
- "+ (GPBExtensionField*)$method_name$;\n");
+ "+ (GPBExtensionDescriptor *)$method_name$;\n");
}
void ExtensionGenerator::GenerateStaticVariablesInitialization(
- io::Printer* printer, bool* out_generated, bool root) {
- if (IsFiltered()) {
- return;
- }
- *out_generated = true;
+ io::Printer* printer) {
map<string, string> vars;
vars["root_class_and_method_name"] = root_class_and_method_name_;
vars["extended_type"] = ClassName(descriptor_->containing_type());
@@ -122,14 +96,14 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization(
vars["type"] = "NULL";
}
- vars["default_name"] = GPBValueFieldName(descriptor_);
+ vars["default_name"] = GPBGenericValueFieldName(descriptor_);
if (descriptor_->is_repeated()) {
vars["default"] = "nil";
} else {
vars["default"] = DefaultValue(descriptor_);
}
string type = GetCapitalizedType(descriptor_);
- vars["extension_type"] = string("GPBType") + type;
+ vars["extension_type"] = string("GPBDataType") + type;
if (objc_type == OBJECTIVECTYPE_ENUM) {
vars["enum_desc_func_name"] =
@@ -141,7 +115,7 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization(
printer->Print(vars,
"{\n"
" .singletonName = GPBStringifySymbol($root_class_and_method_name$),\n"
- " .type = $extension_type$,\n"
+ " .dataType = $extension_type$,\n"
" .extendedClass = GPBStringifySymbol($extended_type$),\n"
" .fieldNumber = $number$,\n"
" .defaultValue.$default_name$ = $default$,\n"
@@ -152,9 +126,6 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization(
}
void ExtensionGenerator::GenerateRegistrationSource(io::Printer* printer) {
- if (IsFiltered()) {
- return;
- }
printer->Print(
"[registry addExtension:$root_class_and_method_name$];\n",
"root_class_and_method_name", root_class_and_method_name_);