Some cpp style fixes.

pull/8684/head
Thomas Van Lenten 4 years ago
parent 0b05994474
commit 0dc4ad80d1
  1. 2
      src/google/protobuf/compiler/objectivec/objectivec_field.cc
  2. 16
      src/google/protobuf/compiler/objectivec/objectivec_file.cc
  3. 4
      src/google/protobuf/compiler/objectivec/objectivec_helpers.h
  4. 2
      src/google/protobuf/compiler/objectivec/objectivec_message.cc

@ -246,7 +246,7 @@ void FieldGenerator::SetExtraRuntimeHasBitsBase(int index_base) {
} }
void FieldGenerator::SetOneofIndexBase(int index_base) { void FieldGenerator::SetOneofIndexBase(int index_base) {
const OneofDescriptor *oneof = descriptor_->real_containing_oneof(); const OneofDescriptor* oneof = descriptor_->real_containing_oneof();
if (oneof != NULL) { if (oneof != NULL) {
int index = oneof->index() + index_base; int index = oneof->index() + index_base;
// Flip the sign to mark it as a oneof. // Flip the sign to mark it as a oneof.

@ -185,22 +185,22 @@ bool IsDirectDependency(const FileDescriptor* dep, const FileDescriptor* file) {
} // namespace } // namespace
FileGenerator::FileGenerator(const FileDescriptor *file, const Options& options) FileGenerator::FileGenerator(const FileDescriptor* file, const Options& options)
: file_(file), : file_(file),
root_class_name_(FileClassName(file)), root_class_name_(FileClassName(file)),
is_bundled_proto_(IsProtobufLibraryBundledProtoFile(file)), is_bundled_proto_(IsProtobufLibraryBundledProtoFile(file)),
options_(options) { options_(options) {
for (int i = 0; i < file_->enum_type_count(); i++) { for (int i = 0; i < file_->enum_type_count(); i++) {
EnumGenerator *generator = new EnumGenerator(file_->enum_type(i)); EnumGenerator* generator = new EnumGenerator(file_->enum_type(i));
enum_generators_.emplace_back(generator); enum_generators_.emplace_back(generator);
} }
for (int i = 0; i < file_->message_type_count(); i++) { for (int i = 0; i < file_->message_type_count(); i++) {
MessageGenerator *generator = MessageGenerator* generator =
new MessageGenerator(root_class_name_, file_->message_type(i), options_); new MessageGenerator(root_class_name_, file_->message_type(i), options_);
message_generators_.emplace_back(generator); message_generators_.emplace_back(generator);
} }
for (int i = 0; i < file_->extension_count(); i++) { for (int i = 0; i < file_->extension_count(); i++) {
ExtensionGenerator *generator = ExtensionGenerator* generator =
new ExtensionGenerator(root_class_name_, file_->extension(i)); new ExtensionGenerator(root_class_name_, file_->extension(i));
extension_generators_.emplace_back(generator); extension_generators_.emplace_back(generator);
} }
@ -208,7 +208,7 @@ FileGenerator::FileGenerator(const FileDescriptor *file, const Options& options)
FileGenerator::~FileGenerator() {} FileGenerator::~FileGenerator() {}
void FileGenerator::GenerateHeader(io::Printer *printer) { void FileGenerator::GenerateHeader(io::Printer* printer) {
std::vector<std::string> headers; std::vector<std::string> headers;
// Generated files bundled with the library get minimal imports, everything // Generated files bundled with the library get minimal imports, everything
// else gets the wrapper so everything is usable. // else gets the wrapper so everything is usable.
@ -336,7 +336,7 @@ void FileGenerator::GenerateHeader(io::Printer *printer) {
"// @@protoc_insertion_point(global_scope)\n"); "// @@protoc_insertion_point(global_scope)\n");
} }
void FileGenerator::GenerateSource(io::Printer *printer) { void FileGenerator::GenerateSource(io::Printer* printer) {
// #import the runtime support. // #import the runtime support.
std::vector<std::string> headers; std::vector<std::string> headers;
headers.push_back("GPBProtocolBuffers_RuntimeSupport.h"); headers.push_back("GPBProtocolBuffers_RuntimeSupport.h");
@ -381,7 +381,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) {
// imported so it can get merged into the root's extensions registry. // imported so it can get merged into the root's extensions registry.
// See the Note by CollectMinimalFileDepsContainingExtensions before // See the Note by CollectMinimalFileDepsContainingExtensions before
// changing this. // changing this.
for (std::vector<const FileDescriptor *>::iterator iter = for (std::vector<const FileDescriptor*>::iterator iter =
deps_with_extensions.begin(); deps_with_extensions.begin();
iter != deps_with_extensions.end(); ++iter) { iter != deps_with_extensions.end(); ++iter) {
if (!IsDirectDependency(*iter, file_)) { if (!IsDirectDependency(*iter, file_)) {
@ -498,7 +498,7 @@ void FileGenerator::GenerateSource(io::Printer *printer) {
} else { } else {
printer->Print( printer->Print(
"// Merge in the imports (direct or indirect) that defined extensions.\n"); "// Merge in the imports (direct or indirect) that defined extensions.\n");
for (std::vector<const FileDescriptor *>::iterator iter = for (std::vector<const FileDescriptor*>::iterator iter =
deps_with_extensions.begin(); deps_with_extensions.begin();
iter != deps_with_extensions.end(); ++iter) { iter != deps_with_extensions.end(); ++iter) {
const std::string root_class_name(FileClassName((*iter))); const std::string root_class_name(FileClassName((*iter)));

@ -283,9 +283,9 @@ class PROTOC_EXPORT ImportWriter {
~ImportWriter(); ~ImportWriter();
void AddFile(const FileDescriptor* file, const std::string& header_extension); void AddFile(const FileDescriptor* file, const std::string& header_extension);
void Print(io::Printer *printer) const; void Print(io::Printer* printer) const;
static void PrintRuntimeImports(io::Printer *printer, static void PrintRuntimeImports(io::Printer* printer,
const std::vector<std::string>& header_to_import, const std::vector<std::string>& header_to_import,
const std::string& runtime_import_prefix, const std::string& runtime_import_prefix,
bool default_cpp_symbol = false); bool default_cpp_symbol = false);

@ -343,7 +343,7 @@ void MessageGenerator::GenerateMessageHeader(io::Printer* printer) {
std::vector<char> seen_oneofs(oneof_generators_.size(), 0); std::vector<char> seen_oneofs(oneof_generators_.size(), 0);
for (int i = 0; i < descriptor_->field_count(); i++) { for (int i = 0; i < descriptor_->field_count(); i++) {
const FieldDescriptor* field = descriptor_->field(i); const FieldDescriptor* field = descriptor_->field(i);
const OneofDescriptor *oneof = field->real_containing_oneof(); const OneofDescriptor* oneof = field->real_containing_oneof();
if (oneof) { if (oneof) {
const int oneof_index = oneof->index(); const int oneof_index = oneof->index();
if (!seen_oneofs[oneof_index]) { if (!seen_oneofs[oneof_index]) {

Loading…
Cancel
Save