protoc-c: remove dead code

parent f486c8ed
...@@ -110,8 +110,6 @@ FileGenerator::FileGenerator(const FileDescriptor* file, ...@@ -110,8 +110,6 @@ FileGenerator::FileGenerator(const FileDescriptor* file,
extension_generators_[i].reset( extension_generators_[i].reset(
new ExtensionGenerator(file->extension(i), dllexport_decl)); new ExtensionGenerator(file->extension(i), dllexport_decl));
} }
SplitStringUsing(file_->package(), ".", &package_parts_);
} }
FileGenerator::~FileGenerator() {} FileGenerator::~FileGenerator() {}
...@@ -248,29 +246,6 @@ void FileGenerator::GenerateSource(io::Printer* printer) { ...@@ -248,29 +246,6 @@ void FileGenerator::GenerateSource(io::Printer* printer) {
"filename", file_->name(), "filename", file_->name(),
"basename", StripProto(file_->name())); "basename", StripProto(file_->name()));
#if 0
// For each dependency, write a prototype for that dependency's
// BuildDescriptors() function. We don't expose these in the header because
// they are internal implementation details, and since this is generated code
// we don't have the usual risks involved with declaring external functions
// within a .cc file.
for (int i = 0; i < file_->dependency_count(); i++) {
const FileDescriptor* dependency = file_->dependency(i);
// Open the dependency's namespace.
vector<string> dependency_package_parts;
SplitStringUsing(dependency->package(), ".", &dependency_package_parts);
// Declare its BuildDescriptors() function.
printer->Print(
"void $function$();",
"function", GlobalBuildDescriptorsName(dependency->name()));
// Close the namespace.
for (int i = 0; i < dependency_package_parts.size(); i++) {
printer->Print(" }");
}
printer->Print("\n");
}
#endif
const ProtobufCFileOptions opt = file_->options().GetExtension(pb_c_file); const ProtobufCFileOptions opt = file_->options().GetExtension(pb_c_file);
for (int i = 0; i < file_->message_type_count(); i++) { for (int i = 0; i < file_->message_type_count(); i++) {
......
...@@ -104,9 +104,6 @@ class FileGenerator { ...@@ -104,9 +104,6 @@ class FileGenerator {
std::unique_ptr<std::unique_ptr<ServiceGenerator>[]> service_generators_; std::unique_ptr<std::unique_ptr<ServiceGenerator>[]> service_generators_;
std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_; std::unique_ptr<std::unique_ptr<ExtensionGenerator>[]> extension_generators_;
// E.g. if the package is foo.bar, package_parts_ is {"foo", "bar"}.
std::vector<std::string> package_parts_;
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator); GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(FileGenerator);
}; };
......
...@@ -278,37 +278,6 @@ std::set<std::string> MakeKeywordsMap() { ...@@ -278,37 +278,6 @@ std::set<std::string> MakeKeywordsMap() {
std::set<std::string> kKeywords = MakeKeywordsMap(); std::set<std::string> kKeywords = MakeKeywordsMap();
std::string ClassName(const Descriptor* descriptor, bool qualified) {
// Find "outer", the descriptor of the top-level message in which
// "descriptor" is embedded.
const Descriptor* outer = descriptor;
while (outer->containing_type() != NULL) outer = outer->containing_type();
const std::string& outer_name = outer->full_name();
std::string inner_name = descriptor->full_name().substr(outer_name.size());
if (qualified) {
return "::" + DotsToColons(outer_name) + DotsToUnderscores(inner_name);
} else {
return outer->name() + DotsToUnderscores(inner_name);
}
}
std::string ClassName(const EnumDescriptor* enum_descriptor, bool qualified) {
if (enum_descriptor->containing_type() == NULL) {
if (qualified) {
return DotsToColons(enum_descriptor->full_name());
} else {
return enum_descriptor->name();
}
} else {
std::string result = ClassName(enum_descriptor->containing_type(), qualified);
result += '_';
result += enum_descriptor->name();
return result;
}
}
std::string FieldName(const FieldDescriptor* field) { std::string FieldName(const FieldDescriptor* field) {
std::string result = ToLower(field->name()); std::string result = ToLower(field->name());
if (kKeywords.count(result) > 0) { if (kKeywords.count(result) > 0) {
......
...@@ -75,17 +75,6 @@ namespace protobuf { ...@@ -75,17 +75,6 @@ namespace protobuf {
namespace compiler { namespace compiler {
namespace c { namespace c {
// Returns the non-nested type name for the given type. If "qualified" is
// true, prefix the type with the full namespace. For example, if you had:
// package foo.bar;
// message Baz { message Qux {} }
// Then the qualified ClassName for Qux would be:
// Foo__Bar__Baz_Qux
// While the non-qualified version would be:
// Baz_Qux
std::string ClassName(const Descriptor* descriptor, bool qualified);
std::string ClassName(const EnumDescriptor* enum_descriptor, bool qualified);
// --- Borrowed from stubs. --- // --- Borrowed from stubs. ---
template <typename T> std::string SimpleItoa(T n) { template <typename T> std::string SimpleItoa(T n) {
std::stringstream stream; std::stringstream stream;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment