diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc index 892a2a4426..8352040153 100644 --- a/conformance/binary_json_conformance_suite.cc +++ b/conformance/binary_json_conformance_suite.cc @@ -36,8 +36,6 @@ #include "google/protobuf/endian.h" #include "google/protobuf/json/json.h" #include "google/protobuf/test_messages_proto2.pb.h" -#include "google/protobuf/test_messages_proto2.pb.h" -#include "google/protobuf/test_messages_proto3.pb.h" #include "google/protobuf/test_messages_proto3.pb.h" #include "google/protobuf/text_format.h" #include "google/protobuf/unknown_field_set.h" diff --git a/conformance/conformance_cpp.cc b/conformance/conformance_cpp.cc index 45fa91aa7f..2418e99d25 100644 --- a/conformance/conformance_cpp.cc +++ b/conformance/conformance_cpp.cc @@ -22,7 +22,6 @@ #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "conformance/conformance.pb.h" -#include "conformance/conformance.pb.h" #include "conformance/test_protos/test_messages_edition2023.pb.h" #include "editions/golden/test_messages_proto2_editions.pb.h" #include "editions/golden/test_messages_proto3_editions.pb.h" @@ -31,7 +30,6 @@ #include "google/protobuf/message.h" #include "google/protobuf/test_messages_proto2.pb.h" #include "google/protobuf/test_messages_proto3.pb.h" -#include "google/protobuf/test_messages_proto3.pb.h" #include "google/protobuf/text_format.h" #include "google/protobuf/util/json_util.h" #include "google/protobuf/util/type_resolver.h" diff --git a/conformance/conformance_test.cc b/conformance/conformance_test.cc index ed2b33f3f4..1b626cd5f9 100644 --- a/conformance/conformance_test.cc +++ b/conformance/conformance_test.cc @@ -29,7 +29,6 @@ #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" #include "conformance/conformance.pb.h" -#include "conformance/conformance.pb.h" #include "failure_list_trie_node.h" #include "google/protobuf/descriptor_legacy.h" #include "google/protobuf/endian.h" diff --git a/conformance/conformance_test.h b/conformance/conformance_test.h index 9e39ca8a18..7f88e370fb 100644 --- a/conformance/conformance_test.h +++ b/conformance/conformance_test.h @@ -25,7 +25,6 @@ #include "absl/container/btree_map.h" #include "absl/container/flat_hash_set.h" #include "conformance/conformance.pb.h" -#include "conformance/conformance.pb.h" #include "failure_list_trie_node.h" #include "google/protobuf/descriptor.h" diff --git a/conformance/conformance_test_runner.cc b/conformance/conformance_test_runner.cc index 88125d13e2..18e29beb61 100644 --- a/conformance/conformance_test_runner.cc +++ b/conformance/conformance_test_runner.cc @@ -55,7 +55,6 @@ #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" #include "conformance/conformance.pb.h" -#include "conformance/conformance.pb.h" #include "conformance_test.h" #include "google/protobuf/endian.h" diff --git a/hpb_generator/gen_enums.cc b/hpb_generator/gen_enums.cc index 1f20aaab51..8c3f5c2807 100644 --- a/hpb_generator/gen_enums.cc +++ b/hpb_generator/gen_enums.cc @@ -13,9 +13,9 @@ #include #include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/descriptor.h" #include "google/protobuf/compiler/hpb/gen_utils.h" #include "google/protobuf/compiler/hpb/names.h" +#include "google/protobuf/descriptor.h" namespace google::protobuf::hpb_generator { diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index b55dd3337e..dda4190d86 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -51,6 +51,7 @@ #include "google/protobuf/test_util2.h" #include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_custom_options.pb.h" +#include "google/protobuf/unittest_import.pb.h" #ifdef GOOGLE_PROTOBUF_USE_BAZEL_GENERATED_PLUGIN_PATHS // This is needed because of https://github.com/bazelbuild/bazel/issues/19124. diff --git a/src/google/protobuf/compiler/cpp/metadata_test.cc b/src/google/protobuf/compiler/cpp/metadata_test.cc index 734d58ffaa..b646e8eb66 100644 --- a/src/google/protobuf/compiler/cpp/metadata_test.cc +++ b/src/google/protobuf/compiler/cpp/metadata_test.cc @@ -12,7 +12,6 @@ #include "google/protobuf/compiler/cpp/generator.h" #include "google/protobuf/compiler/command_line_interface.h" #include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/descriptor.pb.h" #include #include "absl/log/absl_check.h" #include "google/protobuf/compiler/annotation_test_util.h" diff --git a/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc b/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc index b06acd5696..972c79accc 100644 --- a/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc +++ b/src/google/protobuf/compiler/csharp/csharp_generator_unittest.cc @@ -8,8 +8,8 @@ #include #include "google/protobuf/any.pb.h" -#include "google/protobuf/compiler/command_line_interface.h" #include +#include "google/protobuf/compiler/command_line_interface.h" #include "google/protobuf/compiler/csharp/csharp_helpers.h" #include "google/protobuf/descriptor.pb.h" #include "google/protobuf/io/printer.h" diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index 3ee6e96674..b08d6a9d52 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -30,7 +30,6 @@ #include "google/protobuf/any.pb.h" #include "google/protobuf/descriptor.pb.h" -#include "google/protobuf/descriptor.pb.h" #include #include #include "absl/base/log_severity.h" diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc index 9c06ceb4db..e062470f9e 100644 --- a/src/google/protobuf/extension_set_unittest.cc +++ b/src/google/protobuf/extension_set_unittest.cc @@ -32,8 +32,8 @@ #include "google/protobuf/test_util2.h" #include "google/protobuf/text_format.h" #include "google/protobuf/unittest.pb.h" -#include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_mset.pb.h" +#include "google/protobuf/unittest_mset_wire_format.pb.h" #include "google/protobuf/unittest_proto3_extensions.pb.h" #include "google/protobuf/wire_format.h" #include "google/protobuf/wire_format_lite.h" diff --git a/src/google/protobuf/generated_message_reflection_unittest.cc b/src/google/protobuf/generated_message_reflection_unittest.cc index 22cbe122b2..8436903879 100644 --- a/src/google/protobuf/generated_message_reflection_unittest.cc +++ b/src/google/protobuf/generated_message_reflection_unittest.cc @@ -38,7 +38,6 @@ #include "google/protobuf/message.h" #include "google/protobuf/test_util.h" #include "google/protobuf/unittest.pb.h" -#include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_mset.pb.h" #include "google/protobuf/unittest_mset_wire_format.pb.h" #include "google/protobuf/unittest_proto3.pb.h" diff --git a/src/google/protobuf/map_lite_test_util.cc b/src/google/protobuf/map_lite_test_util.cc index 4a87301f38..de15a28157 100644 --- a/src/google/protobuf/map_lite_test_util.cc +++ b/src/google/protobuf/map_lite_test_util.cc @@ -9,6 +9,7 @@ #include "google/protobuf/map_lite_unittest.pb.h" #include "google/protobuf/map_test_util_impl.h" +#include "google/protobuf/unittest_lite.pb.h" namespace google { namespace protobuf { diff --git a/src/google/protobuf/proto3_arena_unittest.cc b/src/google/protobuf/proto3_arena_unittest.cc index 49fc0b15c7..1c56ebee40 100644 --- a/src/google/protobuf/proto3_arena_unittest.cc +++ b/src/google/protobuf/proto3_arena_unittest.cc @@ -9,6 +9,7 @@ #include #include +#include "google/protobuf/descriptor.pb.h" #include #include "absl/log/absl_check.h" #include "absl/strings/match.h" diff --git a/src/google/protobuf/test_util.inc b/src/google/protobuf/test_util.inc index 77ea70ba2e..3b99b77e81 100644 --- a/src/google/protobuf/test_util.inc +++ b/src/google/protobuf/test_util.inc @@ -19,6 +19,7 @@ #include "absl/log/absl_check.h" #include "google/protobuf/descriptor.h" #include "google/protobuf/message.h" +#include "google/protobuf/unittest_import.pb.h" namespace google { namespace protobuf { diff --git a/src/google/protobuf/test_util_lite.cc b/src/google/protobuf/test_util_lite.cc index 834562cf60..1e4f118d26 100644 --- a/src/google/protobuf/test_util_lite.cc +++ b/src/google/protobuf/test_util_lite.cc @@ -13,6 +13,7 @@ #include #include "absl/strings/string_view.h" +#include "google/protobuf/unittest_import_lite.pb.h" namespace google { namespace protobuf { diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc index ab7cb8fa7b..1902ad3072 100644 --- a/src/google/protobuf/text_format_unittest.cc +++ b/src/google/protobuf/text_format_unittest.cc @@ -45,7 +45,6 @@ #include "google/protobuf/test_util.h" #include "google/protobuf/test_util2.h" #include "google/protobuf/unittest.pb.h" -#include "google/protobuf/unittest.pb.h" #include "google/protobuf/unittest_delimited.pb.h" #include "google/protobuf/unittest_mset.pb.h" #include "google/protobuf/unittest_mset_wire_format.pb.h" diff --git a/src/google/protobuf/util/BUILD.bazel b/src/google/protobuf/util/BUILD.bazel index fcc64040ca..5522789089 100644 --- a/src/google/protobuf/util/BUILD.bazel +++ b/src/google/protobuf/util/BUILD.bazel @@ -208,6 +208,7 @@ cc_library( visibility = ["//:__subpackages__"], deps = [ "//src/google/protobuf", + "//src/google/protobuf:any_cc_proto", "//src/google/protobuf:descriptor_legacy", "//src/google/protobuf:port", "//src/google/protobuf:source_context_cc_proto", diff --git a/src/google/protobuf/util/type_resolver.h b/src/google/protobuf/util/type_resolver.h index c3cce54973..c3880736d8 100644 --- a/src/google/protobuf/util/type_resolver.h +++ b/src/google/protobuf/util/type_resolver.h @@ -12,6 +12,9 @@ #include +// This inclusion is unused, but we cannot remove it without first fixing IWYU +// issues in upstream dependencies. +#include "google/protobuf/any.pb.h" // IWYU pragma: keep #include "google/protobuf/type.pb.h" #include "absl/status/status.h" #include "google/protobuf/port.h" diff --git a/src/google/protobuf/util/type_resolver_util.cc b/src/google/protobuf/util/type_resolver_util.cc index 694abed815..3efe45060d 100644 --- a/src/google/protobuf/util/type_resolver_util.cc +++ b/src/google/protobuf/util/type_resolver_util.cc @@ -10,6 +10,7 @@ #include #include +#include "google/protobuf/any.pb.h" #include "google/protobuf/source_context.pb.h" #include "google/protobuf/type.pb.h" #include "google/protobuf/wrappers.pb.h"