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
This commit is contained in:
Christian Blichmann 2023-08-17 01:57:58 -07:00 committed by Copybara-Service
parent 0a0bf05dc3
commit f378d22405

View File

@ -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, "::");
}