Don't call AddDesc() at static init time in LITE_RUNTIME mode.
This patch makes the generation of StaticDescriptorInitializer_$filename$ depend on whether LITE_RUNTIME is enabled. Note that this works only when extensions are not used. This lets us significantly decrease the number of static initializers generated by protoc in LITE_RUNTIME mode (used in Chromium). In LITE_RUNTIME mode, $adddescriptorsname$() is called the first time that default_instance() is called (rather than being called during static init). To benefit from this patch in LITE_RUNTIME mode without extensions, compile with -DGOOGLE_PROTOBUF_NO_STATIC_INIT. BUG=351
This commit is contained in:
parent
7cc257673c
commit
6103d4ed13
@ -381,11 +381,12 @@ void FileGenerator::GenerateSource(io::Printer* printer) {
|
|||||||
|
|
||||||
void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) {
|
void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) {
|
||||||
// AddDescriptors() is a file-level procedure which adds the encoded
|
// AddDescriptors() is a file-level procedure which adds the encoded
|
||||||
// FileDescriptorProto for this .proto file to the global DescriptorPool
|
// FileDescriptorProto for this .proto file to the global DescriptorPool for
|
||||||
// for generated files (DescriptorPool::generated_pool()). It always runs
|
// generated files (DescriptorPool::generated_pool()). It either runs at
|
||||||
// at static initialization time, so all files will be registered before
|
// static initialization time (by default) or when default_instance() is
|
||||||
// main() starts. This procedure also constructs default instances and
|
// called for the first time (in LITE_RUNTIME mode with
|
||||||
// registers extensions.
|
// GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER flag enabled). This procedure also
|
||||||
|
// constructs default instances and registers extensions.
|
||||||
//
|
//
|
||||||
// Its sibling, AssignDescriptors(), actually pulls the compiled
|
// Its sibling, AssignDescriptors(), actually pulls the compiled
|
||||||
// FileDescriptor from the DescriptorPool and uses it to populate all of
|
// FileDescriptor from the DescriptorPool and uses it to populate all of
|
||||||
@ -489,22 +490,27 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) {
|
|||||||
|
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
printer->Print(
|
printer->Print(
|
||||||
"}\n");
|
"}\n\n");
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
|
|
||||||
// Now generate the AddDescriptors() function.
|
// Now generate the AddDescriptors() function.
|
||||||
printer->Print(
|
PrintHandlingOptionalStaticInitializers(
|
||||||
"\n"
|
file_, printer,
|
||||||
|
// With static initializers.
|
||||||
|
// Note that we don't need any special synchronization in the following code
|
||||||
|
// because it is called at static init time before any threads exist.
|
||||||
"void $adddescriptorsname$() {\n"
|
"void $adddescriptorsname$() {\n"
|
||||||
// We don't need any special synchronization here because this code is
|
|
||||||
// called at static init time before any threads exist.
|
|
||||||
" static bool already_here = false;\n"
|
" static bool already_here = false;\n"
|
||||||
" if (already_here) return;\n"
|
" if (already_here) return;\n"
|
||||||
" already_here = true;\n"
|
" already_here = true;\n"
|
||||||
" GOOGLE_PROTOBUF_VERIFY_VERSION;\n"
|
" GOOGLE_PROTOBUF_VERIFY_VERSION;\n",
|
||||||
"\n",
|
// Without.
|
||||||
|
"void $adddescriptorsname$_impl() {\n"
|
||||||
|
" GOOGLE_PROTOBUF_VERIFY_VERSION;\n",
|
||||||
|
// Vars.
|
||||||
"adddescriptorsname", GlobalAddDescriptorsName(file_->name()));
|
"adddescriptorsname", GlobalAddDescriptorsName(file_->name()));
|
||||||
|
|
||||||
printer->Indent();
|
printer->Indent();
|
||||||
|
|
||||||
// Call the AddDescriptors() methods for all of our dependencies, to make
|
// Call the AddDescriptors() methods for all of our dependencies, to make
|
||||||
@ -572,17 +578,27 @@ void FileGenerator::GenerateBuildDescriptors(io::Printer* printer) {
|
|||||||
"shutdownfilename", GlobalShutdownFileName(file_->name()));
|
"shutdownfilename", GlobalShutdownFileName(file_->name()));
|
||||||
|
|
||||||
printer->Outdent();
|
printer->Outdent();
|
||||||
|
|
||||||
printer->Print(
|
printer->Print(
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n");
|
||||||
|
|
||||||
|
PrintHandlingOptionalStaticInitializers(
|
||||||
|
file_, printer,
|
||||||
|
// With static initializers.
|
||||||
"// Force AddDescriptors() to be called at static initialization time.\n"
|
"// Force AddDescriptors() to be called at static initialization time.\n"
|
||||||
"struct StaticDescriptorInitializer_$filename$ {\n"
|
"struct StaticDescriptorInitializer_$filename$ {\n"
|
||||||
" StaticDescriptorInitializer_$filename$() {\n"
|
" StaticDescriptorInitializer_$filename$() {\n"
|
||||||
" $adddescriptorsname$();\n"
|
" $adddescriptorsname$();\n"
|
||||||
" }\n"
|
" }\n"
|
||||||
"} static_descriptor_initializer_$filename$_;\n"
|
"} static_descriptor_initializer_$filename$_;\n",
|
||||||
"\n",
|
// Without.
|
||||||
|
"::google::protobuf::GoogleOnceType $adddescriptorsname$_once_ =\n"
|
||||||
|
" GOOGLE_PROTOBUF_ONCE_INIT;\n"
|
||||||
|
"void $adddescriptorsname$() {\n"
|
||||||
|
" ::google::protobuf::GoogleOnceInit(&$adddescriptorsname$_once_,\n"
|
||||||
|
" &$adddescriptorsname$_impl);\n"
|
||||||
|
"}\n",
|
||||||
|
// Vars.
|
||||||
"adddescriptorsname", GlobalAddDescriptorsName(file_->name()),
|
"adddescriptorsname", GlobalAddDescriptorsName(file_->name()),
|
||||||
"filename", FilenameIdentifier(file_->name()));
|
"filename", FilenameIdentifier(file_->name()));
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,12 @@
|
|||||||
// Sanjay Ghemawat, Jeff Dean, and others.
|
// Sanjay Ghemawat, Jeff Dean, and others.
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <google/protobuf/stubs/hash.h>
|
#include <google/protobuf/stubs/hash.h>
|
||||||
|
|
||||||
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
|
#include <google/protobuf/compiler/cpp/cpp_helpers.h>
|
||||||
|
#include <google/protobuf/io/printer.h>
|
||||||
#include <google/protobuf/stubs/common.h>
|
#include <google/protobuf/stubs/common.h>
|
||||||
#include <google/protobuf/stubs/strutil.h>
|
#include <google/protobuf/stubs/strutil.h>
|
||||||
#include <google/protobuf/stubs/substitute.h>
|
#include <google/protobuf/stubs/substitute.h>
|
||||||
@ -105,6 +107,20 @@ string UnderscoresToCamelCase(const string& input, bool cap_next_letter) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns whether the provided descriptor has an extension. This includes its
|
||||||
|
// nested types.
|
||||||
|
bool HasExtension(const Descriptor* descriptor) {
|
||||||
|
if (descriptor->extension_count() > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < descriptor->nested_type_count(); ++i) {
|
||||||
|
if (HasExtension(descriptor->nested_type(i))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
const char kThickSeparator[] =
|
const char kThickSeparator[] =
|
||||||
@ -341,6 +357,50 @@ string EscapeTrigraphs(const string& to_escape) {
|
|||||||
return StringReplace(to_escape, "?", "\\?", true);
|
return StringReplace(to_escape, "?", "\\?", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StaticInitializersForced(const FileDescriptor* file) {
|
||||||
|
if (HasDescriptorMethods(file) || file->extension_count() > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < file->message_type_count(); ++i) {
|
||||||
|
if (HasExtension(file->message_type(i))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintHandlingOptionalStaticInitializers(
|
||||||
|
const FileDescriptor* file, io::Printer* printer,
|
||||||
|
const char* with_static_init, const char* without_static_init,
|
||||||
|
const char* var1, const string& val1,
|
||||||
|
const char* var2, const string& val2) {
|
||||||
|
map<string, string> vars;
|
||||||
|
if (var1) {
|
||||||
|
vars[var1] = val1;
|
||||||
|
}
|
||||||
|
if (var2) {
|
||||||
|
vars[var2] = val2;
|
||||||
|
}
|
||||||
|
PrintHandlingOptionalStaticInitializers(
|
||||||
|
vars, file, printer, with_static_init, without_static_init);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PrintHandlingOptionalStaticInitializers(
|
||||||
|
const map<string, string>& vars, const FileDescriptor* file,
|
||||||
|
io::Printer* printer, const char* with_static_init,
|
||||||
|
const char* without_static_init) {
|
||||||
|
if (StaticInitializersForced(file)) {
|
||||||
|
printer->Print(vars, with_static_init);
|
||||||
|
} else {
|
||||||
|
printer->Print(vars, (string(
|
||||||
|
"#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER\n") +
|
||||||
|
without_static_init +
|
||||||
|
"#else\n" +
|
||||||
|
with_static_init +
|
||||||
|
"#endif\n").c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace cpp
|
} // namespace cpp
|
||||||
} // namespace compiler
|
} // namespace compiler
|
||||||
} // namespace protobuf
|
} // namespace protobuf
|
||||||
|
@ -35,12 +35,18 @@
|
|||||||
#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__
|
#ifndef GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__
|
||||||
#define GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__
|
#define GOOGLE_PROTOBUF_COMPILER_CPP_HELPERS_H__
|
||||||
|
|
||||||
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <google/protobuf/descriptor.h>
|
#include <google/protobuf/descriptor.h>
|
||||||
#include <google/protobuf/descriptor.pb.h>
|
#include <google/protobuf/descriptor.pb.h>
|
||||||
|
|
||||||
namespace google {
|
namespace google {
|
||||||
namespace protobuf {
|
namespace protobuf {
|
||||||
|
|
||||||
|
namespace io {
|
||||||
|
class Printer;
|
||||||
|
}
|
||||||
|
|
||||||
namespace compiler {
|
namespace compiler {
|
||||||
namespace cpp {
|
namespace cpp {
|
||||||
|
|
||||||
@ -150,6 +156,22 @@ inline bool HasFastArraySerialization(const FileDescriptor* file) {
|
|||||||
return file->options().optimize_for() == FileOptions::SPEED;
|
return file->options().optimize_for() == FileOptions::SPEED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns whether we have to generate code with static initializers.
|
||||||
|
bool StaticInitializersForced(const FileDescriptor* file);
|
||||||
|
|
||||||
|
// Prints 'with_static_init' if static initializers have to be used for the
|
||||||
|
// provided file. Otherwise emits both 'with_static_init' and
|
||||||
|
// 'without_static_init' using #ifdef.
|
||||||
|
void PrintHandlingOptionalStaticInitializers(
|
||||||
|
const FileDescriptor* file, io::Printer* printer,
|
||||||
|
const char* with_static_init, const char* without_static_init,
|
||||||
|
const char* var1 = NULL, const string& val1 = "",
|
||||||
|
const char* var2 = NULL, const string& val2 = "");
|
||||||
|
|
||||||
|
void PrintHandlingOptionalStaticInitializers(
|
||||||
|
const map<string, string>& vars, const FileDescriptor* file,
|
||||||
|
io::Printer* printer, const char* with_static_init,
|
||||||
|
const char* without_static_init);
|
||||||
|
|
||||||
} // namespace cpp
|
} // namespace cpp
|
||||||
} // namespace compiler
|
} // namespace compiler
|
||||||
|
@ -493,6 +493,19 @@ GenerateClassDefinition(io::Printer* printer) {
|
|||||||
"static const $classname$& default_instance();\n"
|
"static const $classname$& default_instance();\n"
|
||||||
"\n");
|
"\n");
|
||||||
|
|
||||||
|
if (!StaticInitializersForced(descriptor_->file())) {
|
||||||
|
printer->Print(vars,
|
||||||
|
"#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER\n"
|
||||||
|
"// Returns the internal default instance pointer. This function can\n"
|
||||||
|
"// return NULL thus should not be used by the user. This is intended\n"
|
||||||
|
"// for Protobuf internal code. Please use default_instance() declared\n"
|
||||||
|
"// above instead.\n"
|
||||||
|
"static inline const $classname$* internal_default_instance() {\n"
|
||||||
|
" return default_instance_;\n"
|
||||||
|
"}\n"
|
||||||
|
"#endif\n"
|
||||||
|
"\n");
|
||||||
|
}
|
||||||
|
|
||||||
printer->Print(vars,
|
printer->Print(vars,
|
||||||
"void Swap($classname$* other);\n"
|
"void Swap($classname$* other);\n"
|
||||||
@ -660,11 +673,17 @@ GenerateClassDefinition(io::Printer* printer) {
|
|||||||
// Declare AddDescriptors(), BuildDescriptors(), and ShutdownFile() as
|
// Declare AddDescriptors(), BuildDescriptors(), and ShutdownFile() as
|
||||||
// friends so that they can access private static variables like
|
// friends so that they can access private static variables like
|
||||||
// default_instance_ and reflection_.
|
// default_instance_ and reflection_.
|
||||||
printer->Print(
|
PrintHandlingOptionalStaticInitializers(
|
||||||
|
descriptor_->file(), printer,
|
||||||
|
// With static initializers.
|
||||||
"friend void $dllexport_decl$ $adddescriptorsname$();\n",
|
"friend void $dllexport_decl$ $adddescriptorsname$();\n",
|
||||||
|
// Without.
|
||||||
|
"friend void $dllexport_decl$ $adddescriptorsname$_impl();\n",
|
||||||
|
// Vars.
|
||||||
"dllexport_decl", dllexport_decl_,
|
"dllexport_decl", dllexport_decl_,
|
||||||
"adddescriptorsname",
|
"adddescriptorsname",
|
||||||
GlobalAddDescriptorsName(descriptor_->file()->name()));
|
GlobalAddDescriptorsName(descriptor_->file()->name()));
|
||||||
|
|
||||||
printer->Print(
|
printer->Print(
|
||||||
"friend void $assigndescriptorsname$();\n"
|
"friend void $assigndescriptorsname$();\n"
|
||||||
"friend void $shutdownfilename$();\n"
|
"friend void $shutdownfilename$();\n"
|
||||||
@ -981,8 +1000,12 @@ GenerateSharedDestructorCode(io::Printer* printer) {
|
|||||||
.GenerateDestructorCode(printer);
|
.GenerateDestructorCode(printer);
|
||||||
}
|
}
|
||||||
|
|
||||||
printer->Print(
|
PrintHandlingOptionalStaticInitializers(
|
||||||
"if (this != default_instance_) {\n");
|
descriptor_->file(), printer,
|
||||||
|
// With static initializers.
|
||||||
|
"if (this != default_instance_) {\n",
|
||||||
|
// Without.
|
||||||
|
"if (this != &default_instance()) {\n");
|
||||||
|
|
||||||
// We need to delete all embedded messages.
|
// We need to delete all embedded messages.
|
||||||
// TODO(kenton): If we make unset messages point at default instances
|
// TODO(kenton): If we make unset messages point at default instances
|
||||||
@ -1034,10 +1057,16 @@ GenerateStructors(io::Printer* printer) {
|
|||||||
|
|
||||||
if (!field->is_repeated() &&
|
if (!field->is_repeated() &&
|
||||||
field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
|
field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
|
||||||
printer->Print(
|
PrintHandlingOptionalStaticInitializers(
|
||||||
" $name$_ = const_cast< $type$*>(&$type$::default_instance());\n",
|
descriptor_->file(), printer,
|
||||||
"name", FieldName(field),
|
// With static initializers.
|
||||||
"type", FieldMessageTypeName(field));
|
" $name$_ = const_cast< $type$*>(&$type$::default_instance());\n",
|
||||||
|
// Without.
|
||||||
|
" $name$_ = const_cast< $type$*>(\n"
|
||||||
|
" $type$::internal_default_instance());\n",
|
||||||
|
// Vars.
|
||||||
|
"name", FieldName(field),
|
||||||
|
"type", FieldMessageTypeName(field));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printer->Print(
|
printer->Print(
|
||||||
@ -1093,8 +1122,20 @@ GenerateStructors(io::Printer* printer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
printer->Print(
|
printer->Print(
|
||||||
"const $classname$& $classname$::default_instance() {\n"
|
"const $classname$& $classname$::default_instance() {\n",
|
||||||
" if (default_instance_ == NULL) $adddescriptorsname$();"
|
"classname", classname_);
|
||||||
|
|
||||||
|
PrintHandlingOptionalStaticInitializers(
|
||||||
|
descriptor_->file(), printer,
|
||||||
|
// With static initializers.
|
||||||
|
" if (default_instance_ == NULL) $adddescriptorsname$();\n",
|
||||||
|
// Without.
|
||||||
|
" $adddescriptorsname$();\n",
|
||||||
|
// Vars.
|
||||||
|
"adddescriptorsname",
|
||||||
|
GlobalAddDescriptorsName(descriptor_->file()->name()));
|
||||||
|
|
||||||
|
printer->Print(
|
||||||
" return *default_instance_;\n"
|
" return *default_instance_;\n"
|
||||||
"}\n"
|
"}\n"
|
||||||
"\n"
|
"\n"
|
||||||
@ -1106,7 +1147,6 @@ GenerateStructors(io::Printer* printer) {
|
|||||||
"classname", classname_,
|
"classname", classname_,
|
||||||
"adddescriptorsname",
|
"adddescriptorsname",
|
||||||
GlobalAddDescriptorsName(descriptor_->file()->name()));
|
GlobalAddDescriptorsName(descriptor_->file()->name()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageGenerator::
|
void MessageGenerator::
|
||||||
@ -1377,11 +1417,22 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
|
|||||||
// Special-case MessageSet.
|
// Special-case MessageSet.
|
||||||
printer->Print(
|
printer->Print(
|
||||||
"bool $classname$::MergePartialFromCodedStream(\n"
|
"bool $classname$::MergePartialFromCodedStream(\n"
|
||||||
" ::google::protobuf::io::CodedInputStream* input) {\n"
|
" ::google::protobuf::io::CodedInputStream* input) {\n",
|
||||||
" return _extensions_.ParseMessageSet(input, default_instance_,\n"
|
|
||||||
" mutable_unknown_fields());\n"
|
|
||||||
"}\n",
|
|
||||||
"classname", classname_);
|
"classname", classname_);
|
||||||
|
|
||||||
|
PrintHandlingOptionalStaticInitializers(
|
||||||
|
descriptor_->file(), printer,
|
||||||
|
// With static initializers.
|
||||||
|
" return _extensions_.ParseMessageSet(input, default_instance_,\n"
|
||||||
|
" mutable_unknown_fields());\n",
|
||||||
|
// Without.
|
||||||
|
" return _extensions_.ParseMessageSet(input, &default_instance(),\n"
|
||||||
|
" mutable_unknown_fields());\n",
|
||||||
|
// Vars.
|
||||||
|
"classname", classname_);
|
||||||
|
|
||||||
|
printer->Print(
|
||||||
|
"}\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1541,12 +1592,21 @@ GenerateMergeFromCodedStream(io::Printer* printer) {
|
|||||||
}
|
}
|
||||||
printer->Print(") {\n");
|
printer->Print(") {\n");
|
||||||
if (HasUnknownFields(descriptor_->file())) {
|
if (HasUnknownFields(descriptor_->file())) {
|
||||||
printer->Print(
|
PrintHandlingOptionalStaticInitializers(
|
||||||
|
descriptor_->file(), printer,
|
||||||
|
// With static initializers.
|
||||||
" DO_(_extensions_.ParseField(tag, input, default_instance_,\n"
|
" DO_(_extensions_.ParseField(tag, input, default_instance_,\n"
|
||||||
|
" mutable_unknown_fields()));\n",
|
||||||
|
// Without.
|
||||||
|
" DO_(_extensions_.ParseField(tag, input, &default_instance(),\n"
|
||||||
" mutable_unknown_fields()));\n");
|
" mutable_unknown_fields()));\n");
|
||||||
} else {
|
} else {
|
||||||
printer->Print(
|
PrintHandlingOptionalStaticInitializers(
|
||||||
" DO_(_extensions_.ParseField(tag, input, default_instance_));\n");
|
descriptor_->file(), printer,
|
||||||
|
// With static initializers.
|
||||||
|
" DO_(_extensions_.ParseField(tag, input, default_instance_));\n",
|
||||||
|
// Without.
|
||||||
|
" DO_(_extensions_.ParseField(tag, input, &default_instance()));\n");
|
||||||
}
|
}
|
||||||
printer->Print(
|
printer->Print(
|
||||||
" continue;\n"
|
" continue;\n"
|
||||||
|
@ -82,8 +82,16 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
|
|||||||
void MessageFieldGenerator::
|
void MessageFieldGenerator::
|
||||||
GenerateInlineAccessorDefinitions(io::Printer* printer) const {
|
GenerateInlineAccessorDefinitions(io::Printer* printer) const {
|
||||||
printer->Print(variables_,
|
printer->Print(variables_,
|
||||||
"inline const $type$& $classname$::$name$() const {\n"
|
"inline const $type$& $classname$::$name$() const {\n");
|
||||||
" return $name$_ != NULL ? *$name$_ : *default_instance_->$name$_;\n"
|
|
||||||
|
PrintHandlingOptionalStaticInitializers(
|
||||||
|
variables_, descriptor_->file(), printer,
|
||||||
|
// With static initializers.
|
||||||
|
" return $name$_ != NULL ? *$name$_ : *default_instance_->$name$_;\n",
|
||||||
|
// Without.
|
||||||
|
" return $name$_ != NULL ? *$name$_ : *default_instance().$name$_;\n");
|
||||||
|
|
||||||
|
printer->Print(variables_,
|
||||||
"}\n"
|
"}\n"
|
||||||
"inline $type$* $classname$::mutable_$name$() {\n"
|
"inline $type$* $classname$::mutable_$name$() {\n"
|
||||||
" set_has_$name$();\n"
|
" set_has_$name$();\n"
|
||||||
|
@ -124,7 +124,6 @@ void protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto() {
|
|||||||
if (already_here) return;
|
if (already_here) return;
|
||||||
already_here = true;
|
already_here = true;
|
||||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||||
|
|
||||||
::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
::google::protobuf::protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
|
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
|
||||||
"\n%google/protobuf/compiler/plugin.proto\022"
|
"\n%google/protobuf/compiler/plugin.proto\022"
|
||||||
@ -155,7 +154,6 @@ struct StaticDescriptorInitializer_google_2fprotobuf_2fcompiler_2fplugin_2eproto
|
|||||||
}
|
}
|
||||||
} static_descriptor_initializer_google_2fprotobuf_2fcompiler_2fplugin_2eproto_;
|
} static_descriptor_initializer_google_2fprotobuf_2fcompiler_2fplugin_2eproto_;
|
||||||
|
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
@ -207,7 +205,8 @@ const ::google::protobuf::Descriptor* CodeGeneratorRequest::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CodeGeneratorRequest& CodeGeneratorRequest::default_instance() {
|
const CodeGeneratorRequest& CodeGeneratorRequest::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeGeneratorRequest* CodeGeneratorRequest::default_instance_ = NULL;
|
CodeGeneratorRequest* CodeGeneratorRequest::default_instance_ = NULL;
|
||||||
@ -530,7 +529,8 @@ const ::google::protobuf::Descriptor* CodeGeneratorResponse_File::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CodeGeneratorResponse_File& CodeGeneratorResponse_File::default_instance() {
|
const CodeGeneratorResponse_File& CodeGeneratorResponse_File::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeGeneratorResponse_File* CodeGeneratorResponse_File::default_instance_ = NULL;
|
CodeGeneratorResponse_File* CodeGeneratorResponse_File::default_instance_ = NULL;
|
||||||
@ -859,7 +859,8 @@ const ::google::protobuf::Descriptor* CodeGeneratorResponse::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CodeGeneratorResponse& CodeGeneratorResponse::default_instance() {
|
const CodeGeneratorResponse& CodeGeneratorResponse::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fcompiler_2fplugin_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
CodeGeneratorResponse* CodeGeneratorResponse::default_instance_ = NULL;
|
CodeGeneratorResponse* CodeGeneratorResponse::default_instance_ = NULL;
|
||||||
|
@ -553,7 +553,6 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() {
|
|||||||
if (already_here) return;
|
if (already_here) return;
|
||||||
already_here = true;
|
already_here = true;
|
||||||
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
GOOGLE_PROTOBUF_VERIFY_VERSION;
|
||||||
|
|
||||||
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
|
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
|
||||||
"\n google/protobuf/descriptor.proto\022\017goog"
|
"\n google/protobuf/descriptor.proto\022\017goog"
|
||||||
"le.protobuf\"G\n\021FileDescriptorSet\0222\n\004file"
|
"le.protobuf\"G\n\021FileDescriptorSet\0222\n\004file"
|
||||||
@ -706,7 +705,6 @@ struct StaticDescriptorInitializer_google_2fprotobuf_2fdescriptor_2eproto {
|
|||||||
}
|
}
|
||||||
} static_descriptor_initializer_google_2fprotobuf_2fdescriptor_2eproto_;
|
} static_descriptor_initializer_google_2fprotobuf_2fdescriptor_2eproto_;
|
||||||
|
|
||||||
|
|
||||||
// ===================================================================
|
// ===================================================================
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
@ -752,7 +750,8 @@ const ::google::protobuf::Descriptor* FileDescriptorSet::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FileDescriptorSet& FileDescriptorSet::default_instance() {
|
const FileDescriptorSet& FileDescriptorSet::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDescriptorSet* FileDescriptorSet::default_instance_ = NULL;
|
FileDescriptorSet* FileDescriptorSet::default_instance_ = NULL;
|
||||||
@ -979,7 +978,8 @@ const ::google::protobuf::Descriptor* FileDescriptorProto::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FileDescriptorProto& FileDescriptorProto::default_instance() {
|
const FileDescriptorProto& FileDescriptorProto::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDescriptorProto* FileDescriptorProto::default_instance_ = NULL;
|
FileDescriptorProto* FileDescriptorProto::default_instance_ = NULL;
|
||||||
@ -1559,7 +1559,8 @@ const ::google::protobuf::Descriptor* DescriptorProto_ExtensionRange::descriptor
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DescriptorProto_ExtensionRange& DescriptorProto_ExtensionRange::default_instance() {
|
const DescriptorProto_ExtensionRange& DescriptorProto_ExtensionRange::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::default_instance_ = NULL;
|
DescriptorProto_ExtensionRange* DescriptorProto_ExtensionRange::default_instance_ = NULL;
|
||||||
@ -1816,7 +1817,8 @@ const ::google::protobuf::Descriptor* DescriptorProto::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const DescriptorProto& DescriptorProto::default_instance() {
|
const DescriptorProto& DescriptorProto::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
DescriptorProto* DescriptorProto::default_instance_ = NULL;
|
DescriptorProto* DescriptorProto::default_instance_ = NULL;
|
||||||
@ -2392,7 +2394,8 @@ const ::google::protobuf::Descriptor* FieldDescriptorProto::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FieldDescriptorProto& FieldDescriptorProto::default_instance() {
|
const FieldDescriptorProto& FieldDescriptorProto::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
FieldDescriptorProto* FieldDescriptorProto::default_instance_ = NULL;
|
FieldDescriptorProto* FieldDescriptorProto::default_instance_ = NULL;
|
||||||
@ -2947,7 +2950,8 @@ const ::google::protobuf::Descriptor* EnumDescriptorProto::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EnumDescriptorProto& EnumDescriptorProto::default_instance() {
|
const EnumDescriptorProto& EnumDescriptorProto::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumDescriptorProto* EnumDescriptorProto::default_instance_ = NULL;
|
EnumDescriptorProto* EnumDescriptorProto::default_instance_ = NULL;
|
||||||
@ -3263,7 +3267,8 @@ const ::google::protobuf::Descriptor* EnumValueDescriptorProto::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EnumValueDescriptorProto& EnumValueDescriptorProto::default_instance() {
|
const EnumValueDescriptorProto& EnumValueDescriptorProto::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumValueDescriptorProto* EnumValueDescriptorProto::default_instance_ = NULL;
|
EnumValueDescriptorProto* EnumValueDescriptorProto::default_instance_ = NULL;
|
||||||
@ -3574,7 +3579,8 @@ const ::google::protobuf::Descriptor* ServiceDescriptorProto::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ServiceDescriptorProto& ServiceDescriptorProto::default_instance() {
|
const ServiceDescriptorProto& ServiceDescriptorProto::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceDescriptorProto* ServiceDescriptorProto::default_instance_ = NULL;
|
ServiceDescriptorProto* ServiceDescriptorProto::default_instance_ = NULL;
|
||||||
@ -3898,7 +3904,8 @@ const ::google::protobuf::Descriptor* MethodDescriptorProto::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MethodDescriptorProto& MethodDescriptorProto::default_instance() {
|
const MethodDescriptorProto& MethodDescriptorProto::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
MethodDescriptorProto* MethodDescriptorProto::default_instance_ = NULL;
|
MethodDescriptorProto* MethodDescriptorProto::default_instance_ = NULL;
|
||||||
@ -4311,7 +4318,8 @@ const ::google::protobuf::Descriptor* FileOptions::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FileOptions& FileOptions::default_instance() {
|
const FileOptions& FileOptions::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileOptions* FileOptions::default_instance_ = NULL;
|
FileOptions* FileOptions::default_instance_ = NULL;
|
||||||
@ -4872,7 +4880,8 @@ const ::google::protobuf::Descriptor* MessageOptions::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MessageOptions& MessageOptions::default_instance() {
|
const MessageOptions& MessageOptions::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageOptions* MessageOptions::default_instance_ = NULL;
|
MessageOptions* MessageOptions::default_instance_ = NULL;
|
||||||
@ -5207,7 +5216,8 @@ const ::google::protobuf::Descriptor* FieldOptions::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FieldOptions& FieldOptions::default_instance() {
|
const FieldOptions& FieldOptions::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
FieldOptions* FieldOptions::default_instance_ = NULL;
|
FieldOptions* FieldOptions::default_instance_ = NULL;
|
||||||
@ -5604,7 +5614,8 @@ const ::google::protobuf::Descriptor* EnumOptions::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EnumOptions& EnumOptions::default_instance() {
|
const EnumOptions& EnumOptions::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumOptions* EnumOptions::default_instance_ = NULL;
|
EnumOptions* EnumOptions::default_instance_ = NULL;
|
||||||
@ -5828,7 +5839,8 @@ const ::google::protobuf::Descriptor* EnumValueOptions::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const EnumValueOptions& EnumValueOptions::default_instance() {
|
const EnumValueOptions& EnumValueOptions::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumValueOptions* EnumValueOptions::default_instance_ = NULL;
|
EnumValueOptions* EnumValueOptions::default_instance_ = NULL;
|
||||||
@ -6052,7 +6064,8 @@ const ::google::protobuf::Descriptor* ServiceOptions::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ServiceOptions& ServiceOptions::default_instance() {
|
const ServiceOptions& ServiceOptions::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
ServiceOptions* ServiceOptions::default_instance_ = NULL;
|
ServiceOptions* ServiceOptions::default_instance_ = NULL;
|
||||||
@ -6276,7 +6289,8 @@ const ::google::protobuf::Descriptor* MethodOptions::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const MethodOptions& MethodOptions::default_instance() {
|
const MethodOptions& MethodOptions::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
MethodOptions* MethodOptions::default_instance_ = NULL;
|
MethodOptions* MethodOptions::default_instance_ = NULL;
|
||||||
@ -6506,7 +6520,8 @@ const ::google::protobuf::Descriptor* UninterpretedOption_NamePart::descriptor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
const UninterpretedOption_NamePart& UninterpretedOption_NamePart::default_instance() {
|
const UninterpretedOption_NamePart& UninterpretedOption_NamePart::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
UninterpretedOption_NamePart* UninterpretedOption_NamePart::default_instance_ = NULL;
|
UninterpretedOption_NamePart* UninterpretedOption_NamePart::default_instance_ = NULL;
|
||||||
@ -6784,7 +6799,8 @@ const ::google::protobuf::Descriptor* UninterpretedOption::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const UninterpretedOption& UninterpretedOption::default_instance() {
|
const UninterpretedOption& UninterpretedOption::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
UninterpretedOption* UninterpretedOption::default_instance_ = NULL;
|
UninterpretedOption* UninterpretedOption::default_instance_ = NULL;
|
||||||
@ -7255,7 +7271,8 @@ const ::google::protobuf::Descriptor* SourceCodeInfo_Location::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SourceCodeInfo_Location& SourceCodeInfo_Location::default_instance() {
|
const SourceCodeInfo_Location& SourceCodeInfo_Location::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceCodeInfo_Location* SourceCodeInfo_Location::default_instance_ = NULL;
|
SourceCodeInfo_Location* SourceCodeInfo_Location::default_instance_ = NULL;
|
||||||
@ -7543,7 +7560,8 @@ const ::google::protobuf::Descriptor* SourceCodeInfo::descriptor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SourceCodeInfo& SourceCodeInfo::default_instance() {
|
const SourceCodeInfo& SourceCodeInfo::default_instance() {
|
||||||
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); return *default_instance_;
|
if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto();
|
||||||
|
return *default_instance_;
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceCodeInfo* SourceCodeInfo::default_instance_ = NULL;
|
SourceCodeInfo* SourceCodeInfo::default_instance_ = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user