Automated rollback of changelist 520827894.

PiperOrigin-RevId: 523213865
pull/12438/head
chandlerc 2 years ago committed by Copybara-Service
parent 09f094c811
commit 9f94950e20
  1. 7
      src/google/protobuf/compiler/retention.cc

@ -102,10 +102,13 @@ void ConvertToDynamicMessageAndStripOptions(
const Descriptor* descriptor = pool.FindMessageTypeByName(m.GetTypeName());
std::vector<int> path;
if (descriptor == nullptr) {
if (descriptor == nullptr ||
descriptor->file()->pool() == DescriptorPool::generated_pool()) {
// If the pool does not contain the descriptor, then this proto file does
// not transitively depend on descriptor.proto, in which case we know there
// are no custom options to worry about.
// are no custom options to worry about. If we are working with the
// generated pool, then we can still access any custom options without
// having to resort to DynamicMessage.
StripMessage(m, path, stripped_paths);
} else {
DynamicMessageFactory factory;

Loading…
Cancel
Save