Only consider scalar submessages eligible for explicit lazy.

While other fields can be tagged "lazy", they do not impact codegen.

PiperOrigin-RevId: 604443879
pull/15731/head
Chris Kennelly 1 year ago committed by Copybara-Service
parent 9e57b8e0d8
commit 37826c1da6
  1. 8
      src/google/protobuf/compiler/cpp/helpers.h

@ -383,6 +383,14 @@ bool IsLazy(const FieldDescriptor* field, const Options& options,
// Is this an explicit (non-profile driven) lazy field, as denoted by
// lazy/unverified_lazy in the descriptor?
inline bool IsExplicitLazy(const FieldDescriptor* field) {
if (field->is_map() || field->is_repeated()) {
return false;
}
if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) {
return false;
}
return field->options().lazy() || field->options().unverified_lazy();
}

Loading…
Cancel
Save