Update hpb generator plugin namespace protos -> hpb

PiperOrigin-RevId: 650780819
pull/17373/head
Hong Shin 8 months ago committed by Copybara-Service
parent 94f172de82
commit 7a2b37f77d
  1. 5
      hpb_generator/gen_accessors.cc
  2. 5
      hpb_generator/gen_accessors.h
  3. 5
      hpb_generator/gen_enums.cc
  4. 5
      hpb_generator/gen_enums.h
  5. 5
      hpb_generator/gen_extensions.cc
  6. 5
      hpb_generator/gen_extensions.h
  7. 5
      hpb_generator/gen_messages.cc
  8. 5
      hpb_generator/gen_messages.h
  9. 6
      hpb_generator/gen_repeated_fields.cc
  10. 6
      hpb_generator/gen_repeated_fields.h
  11. 5
      hpb_generator/gen_utils.cc
  12. 5
      hpb_generator/gen_utils.h
  13. 6
      hpb_generator/names.cc
  14. 7
      hpb_generator/names.h
  15. 5
      hpb_generator/output.cc
  16. 5
      hpb_generator/output.h
  17. 7
      hpb_generator/protoc-gen-upb-protos.cc
  18. 2
      hpb_generator/tests/test_generated.cc

@ -22,7 +22,7 @@
#include "upb_generator/keywords.h"
#include "upb_generator/names.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
@ -566,4 +566,5 @@ std::string ResolveFieldName(const protobuf::FieldDescriptor* field,
return upb::generator::ResolveKeywordConflict(std::string(field_name));
}
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator

@ -12,7 +12,7 @@
#include "google/protobuf/compiler/hpb/gen_utils.h"
#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
@ -23,6 +23,7 @@ void WriteUsingAccessorsInHeader(const protobuf::Descriptor* desc,
MessageClassType handle_type, Output& output);
void WriteOneofAccessorsInHeader(const protobuf::Descriptor* desc,
Output& output);
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator
#endif // PROTOBUF_COMPILER_HBP_GEN_ACCESSORS_H_

@ -17,7 +17,7 @@
#include "google/protobuf/compiler/hpb/gen_utils.h"
#include "google/protobuf/compiler/hpb/names.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
@ -118,4 +118,5 @@ void WriteHeaderEnumForwardDecls(
}
}
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator

@ -11,7 +11,7 @@
#include "google/protobuf/descriptor.h"
#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
@ -24,6 +24,7 @@ void WriteHeaderEnumForwardDecls(
void WriteEnumDeclarations(
const std::vector<const protobuf::EnumDescriptor*>& enums, Output& output);
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator
#endif // PROTOBUF_COMPILER_HBP_GEN_ENUMS_H_

@ -11,7 +11,7 @@
#include "google/protobuf/compiler/hpb/gen_utils.h"
#include "google/protobuf/compiler/hpb/names.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
@ -91,4 +91,5 @@ void WriteExtensionIdentifiers(
}
}
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator

@ -11,7 +11,7 @@
#include "google/protobuf/descriptor.h"
#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
@ -26,6 +26,7 @@ void WriteExtensionIdentifiers(
void WriteExtensionIdentifier(const protobuf::FieldDescriptor* ext,
Output& output);
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator
#endif // PROTOBUF_COMPILER_HBP_GEN_EXTENSIONS_H_

@ -25,7 +25,7 @@
#include "upb_generator/common.h"
#include "upb_generator/file_layout.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
@ -537,4 +537,5 @@ void WriteUsingEnumsInHeader(
}
}
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator

@ -11,7 +11,7 @@
#include "google/protobuf/descriptor.h"
#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
void WriteMessageClassDeclarations(
@ -23,6 +23,7 @@ void WriteMessageImplementation(
const protobuf::Descriptor* descriptor,
const std::vector<const protobuf::FieldDescriptor*>& file_exts,
Output& output);
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator
#endif // PROTOBUF_COMPILER_HBP_GEN_MESSAGES_H_

@ -23,7 +23,8 @@
#include "upb_generator/file_layout.h"
#include "upb_generator/names.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
// Adds using accessors to reuse base Access class members from a Proxy/CProxy.
@ -322,4 +323,5 @@ void WriteRepeatedScalarAccessor(const protobuf::Descriptor* message,
);
}
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator

@ -12,7 +12,8 @@
#include "google/protobuf/descriptor.h"
#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
void WriteRepeatedFieldUsingAccessors(const protobuf::FieldDescriptor* field,
@ -41,6 +42,7 @@ void WriteRepeatedScalarAccessor(const protobuf::Descriptor* message,
absl::string_view resolved_field_name,
absl::string_view class_name, Output& output);
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator
#endif // PROTOBUF_COMPILER_HBP_GEN_REPEATED_FIELDS_H_

@ -13,7 +13,7 @@
#include "absl/strings/ascii.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
@ -126,4 +126,5 @@ std::string ToCamelCase(const std::string& input, bool lower_first) {
return result;
}
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator

@ -15,7 +15,7 @@
#include "google/protobuf/compiler/code_generator.h"
#include "google/protobuf/descriptor.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
@ -40,6 +40,7 @@ std::vector<const protobuf::FieldDescriptor*> FieldNumberOrder(
std::string ToCamelCase(const std::string& input, bool lower_first);
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator
#endif // PROTOBUF_COMPILER_HBP_GEN_UTILS_H_

@ -11,8 +11,7 @@
#include "upb_generator/keywords.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
namespace {
@ -175,4 +174,5 @@ std::string MessageProxyType(const protobuf::FieldDescriptor* field,
"Proxy";
}
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator

@ -13,11 +13,11 @@
#include "google/protobuf/descriptor.pb.h"
#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace protobuf = ::proto2;
inline constexpr absl::string_view kNoPackageNamePrefix = "protos_";
inline constexpr absl::string_view kNoPackageNamePrefix = "hpb_";
std::string ClassName(const protobuf::Descriptor* descriptor);
std::string QualifiedClassName(const protobuf::Descriptor* descriptor);
@ -45,6 +45,7 @@ std::string MessageCProxyType(const protobuf::FieldDescriptor* field,
std::string MessageProxyType(const protobuf::FieldDescriptor* field,
bool is_const);
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator
#endif // PROTOBUF_COMPILER_HBP_GEN_NAMES_H_

@ -11,7 +11,7 @@
#include "absl/strings/str_replace.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace {
namespace protobuf = ::proto2;
@ -66,4 +66,5 @@ std::string CSourceFilename(const google::protobuf::FileDescriptor* file) {
return StripExtension(file->name()) + ".upb.c";
}
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator

@ -16,7 +16,7 @@
#include "google/protobuf/descriptor.h"
#include "google/protobuf/io/zero_copy_stream.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
class Output {
public:
@ -146,6 +146,7 @@ std::string FileLayoutName(const google::protobuf::FileDescriptor* file);
std::string CHeaderFilename(const google::protobuf::FileDescriptor* file);
std::string CSourceFilename(const google::protobuf::FileDescriptor* file);
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator
#endif // PROTOBUF_COMPILER_HBP_OUTPUT_H_

@ -22,7 +22,7 @@
#include "google/protobuf/compiler/hpb/names.h"
#include "google/protobuf/compiler/hpb/output.h"
namespace protos_generator {
namespace google::protobuf::hpb_generator {
namespace {
namespace protoc = ::google::protobuf::compiler;
@ -265,9 +265,10 @@ void WriteHeaderMessageForwardDecls(const protobuf::FileDescriptor* file,
}
} // namespace
} // namespace protos_generator
} // namespace protobuf
} // namespace google::hpb_generator
int main(int argc, char** argv) {
protos_generator::Generator generator_cc;
google::protobuf::hpb_generator::Generator generator_cc;
return google::protobuf::compiler::PluginMain(argc, argv, &generator_cc);
}

@ -54,7 +54,7 @@ TEST(CppGeneratedCode, ImportedEnum) { EXPECT_EQ(3, TestEnum::DEVICE_MONITOR); }
TEST(CppGeneratedCode, Enum) { EXPECT_EQ(1, RED); }
TEST(CppGeneratedCode, EnumNoPackage) { EXPECT_EQ(1, ::protos_CELSIUS); }
TEST(CppGeneratedCode, EnumNoPackage) { EXPECT_EQ(1, ::hpb_CELSIUS); }
TEST(CppGeneratedCode, MessageEnumType) {
TestModel_Category category1 = TestModel_Category_IMAGES;

Loading…
Cancel
Save