Fix C++ ifndef_guard printer to also convert "-" to "_".

PiperOrigin-RevId: 679648401
pull/18524/head
Protobuf Team Bot 2 months ago committed by Copybara-Service
parent d81e6f7019
commit 7331b77097
  1. 1
      src/google/protobuf/compiler/cpp/ifndef_guard.cc
  2. 2
      src/google/protobuf/compiler/cpp/ifndef_guard_unittest.cc

@ -30,6 +30,7 @@ std::string MakeIfdefGuardIdentifier(const absl::string_view header_path) {
{ {
{"/", "_"}, {"/", "_"},
{".", "_"}, {".", "_"},
{"-", "_"},
})), })),
"_"); "_");
} }

@ -36,7 +36,7 @@ TEST_F(IfnDefGuardTest, Basic) {
{ {
io::Printer printer(output(), '$'); io::Printer printer(output(), '$');
const IfdefGuardPrinter ifdef_guard(&printer, "A/B/E/alpha"); const IfdefGuardPrinter ifdef_guard(&printer, "A/B-E.alpha");
EXPECT_FALSE(printer.failed()); EXPECT_FALSE(printer.failed());
} }

Loading…
Cancel
Save