From d2bf6a37d152b9ce14d2c60f2e8a617a09ba6ed6 Mon Sep 17 00:00:00 2001
From: Adam Cozzette <acozzette@google.com>
Date: Wed, 24 May 2023 13:28:54 -0700
Subject: [PATCH] Internal change

PiperOrigin-RevId: 534961480
---
 src/google/protobuf/descriptor.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index 7f55985aa0..d49601e501 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -3761,7 +3761,7 @@ class DescriptorBuilder {
 
   ~DescriptorBuilder();
 
-  const FileDescriptor* BuildFile(const FileDescriptorProto& proto);
+  const FileDescriptor* BuildFile(const FileDescriptorProto& original_proto);
 
  private:
   DescriptorBuilder(const DescriptorPool* pool, DescriptorPool::Tables* tables,
@@ -5168,8 +5168,10 @@ static void PlanAllocationSize(const FileDescriptorProto& proto,
 }
 
 const FileDescriptor* DescriptorBuilder::BuildFile(
-    const FileDescriptorProto& proto) {
-  filename_ = proto.name();
+    const FileDescriptorProto& original_proto) {
+  filename_ = original_proto.name();
+
+  const FileDescriptorProto& proto = original_proto;
 
   // Check if the file already exists and is identical to the one being built.
   // Note:  This only works if the input is canonical -- that is, it