From f378d224059c053d62556391ab1811197137fd82 Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Thu, 17 Aug 2023 01:57:58 -0700 Subject: [PATCH] Clang tool: Skip protobuf namespaces when emitting headers The protobuf internals are not needed in the API header and will be made available as soon as user code includes any generated proto header. PiperOrigin-RevId: 557749772 Change-Id: Idc48a652ab1892dae559192afbde20ae34e4c7ce --- sandboxed_api/tools/clang_generator/emitter.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sandboxed_api/tools/clang_generator/emitter.cc b/sandboxed_api/tools/clang_generator/emitter.cc index b95ce25..9232a1a 100644 --- a/sandboxed_api/tools/clang_generator/emitter.cc +++ b/sandboxed_api/tools/clang_generator/emitter.cc @@ -484,6 +484,10 @@ void Emitter::EmitType(clang::TypeDecl* type_decl) { return; } } + // Skip Protocol Buffers namespaces + if (ns_root == "google" && ns_path.size() > 1 && ns_path[1] == "protobuf") { + return; + } ns_name = absl::StrJoin(ns_path, "::"); }