Internal code clean up.

PiperOrigin-RevId: 493746870
test_490775181
Protobuf Team Bot 2 years ago committed by Copybara-Service
parent b9eb6bf759
commit c0a26ed486
  1. 18
      src/google/protobuf/compiler/cpp/helpers.cc
  2. 2
      src/google/protobuf/compiler/cpp/helpers.h
  3. 8
      src/google/protobuf/compiler/cpp/message.cc
  4. 7
      src/google/protobuf/port_def.inc

@ -198,11 +198,6 @@ std::string IntTypeName(const Options& options, const std::string& type) {
return absl::StrCat("::", type, "_t");
}
// Returns true if the message can potentially allocate memory for its field.
// This is used to determine if message-owned arena will be useful.
bool AllocExpected(const Descriptor* descriptor) {
return false;
}
} // namespace
@ -1652,19 +1647,6 @@ FileOptions_OptimizeMode GetOptimizeFor(const FileDescriptor* file,
return FileOptions::SPEED;
}
inline bool IsMessageOwnedArenaEligible(const Descriptor* desc,
const Options& options) {
return GetOptimizeFor(desc->file(), options) != FileOptions::LITE_RUNTIME &&
!options.bootstrap && !options.opensource_runtime &&
AllocExpected(desc);
}
bool EnableMessageOwnedArena(const Descriptor* desc, const Options& options) {
(void)desc;
(void)options;
return false;
}
bool HasMessageFieldOrExtension(const Descriptor* desc) {
if (desc->extension_range_count() > 0) return true;
for (const auto* f : FieldRange(desc)) {

@ -1020,8 +1020,6 @@ inline OneOfRangeImpl OneOfRange(const Descriptor* desc) { return {desc}; }
PROTOC_EXPORT std::string StripProto(const std::string& filename);
bool EnableMessageOwnedArena(const Descriptor* desc, const Options& options);
bool ShouldVerify(const Descriptor* descriptor, const Options& options,
MessageSCCAnalyzer* scc_analyzer);
bool ShouldVerify(const FileDescriptor* file, const Options& options,

@ -1367,13 +1367,7 @@ void MessageGenerator::GenerateClassDefinition(io::Printer* p) {
format(" public:\n");
format.Indent();
if (EnableMessageOwnedArena(descriptor_, options_)) {
format(
"inline $classname$() : $classname$("
"::$proto_ns$::Arena::InternalCreateMessageOwnedArena(), true) {}\n");
} else {
format("inline $classname$() : $classname$(nullptr) {}\n");
}
format("inline $classname$() : $classname$(nullptr) {}\n");
if (!HasSimpleBaseClass(descriptor_, options_)) {
format("~$classname$() override;\n");
}

@ -534,13 +534,6 @@
#define PROTOBUF_NODISCARD
#endif
// Enable all stable experiments if this flag is set. This allows us to group
// all of these experiments under a single build flag, which can be enabled in
// the protobuf.stable-experiments TAP project.
#ifdef PROTOBUF_ENABLE_STABLE_EXPERIMENTS
#define PROTOBUF_FORCE_MESSAGE_OWNED_ARENA
#endif // !PROTOBUF_ENABLE_STABLE_EXPERIMENTS
#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
#error PROTOBUF_FORCE_COPY_IN_RELEASE was previously defined
#endif

Loading…
Cancel
Save