From 00e783d113a41efdeb626af5fadf742f2a4fb80a Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Thu, 16 Nov 2023 03:19:19 -0800 Subject: [PATCH] Apply clang-tidy fixes to change `static_cast` to `proto2::DownCastToGenerated` in sr_www dependencies. As a prerequisite of enabling go/protobuf-weak-speed-messages downcasts using built-in cast operations need to be changed to cast functions recommended by protobuf team (go/protobuf-downcast-recommendation) **More information**: go/protobuf-stripping-lsc #codehealth PiperOrigin-RevId: 582977861 --- python/google/protobuf/pyext/descriptor_database.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/python/google/protobuf/pyext/descriptor_database.cc b/python/google/protobuf/pyext/descriptor_database.cc index 92d1928493..2a608e5339 100644 --- a/python/google/protobuf/pyext/descriptor_database.cc +++ b/python/google/protobuf/pyext/descriptor_database.cc @@ -16,6 +16,7 @@ #include "google/protobuf/descriptor.pb.h" #include "absl/log/absl_log.h" +#include "google/protobuf/message.h" #include "google/protobuf/pyext/message.h" #include "google/protobuf/pyext/scoped_pyobject_ptr.h" @@ -54,7 +55,7 @@ static bool GetFileDescriptorProto(PyObject* py_descriptor, message->message->GetDescriptor() == filedescriptor_descriptor) { // Fast path: Just use the pointer. FileDescriptorProto* file_proto = - static_cast(message->message); + google::protobuf::DownCastToGenerated(message->message); *output = *file_proto; return true; } else {