protoc-raw-string-literals.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --- a/src/google/protobuf/compiler/cpp/file.cc (index)
  2. +++ b/src/google/protobuf/compiler/cpp/file.cc (working tree)
  3. @@ -188,9 +188,9 @@ void FileGenerator::GenerateMacroUndefs(io::Printer* p) {
  4. }
  5. p->Emit({{"name", TProtoStringType(name)}}, R"(
  6. - #ifdef $name$
  7. - #undef $name$
  8. - #endif // $name$
  9. + #)" "ifdef" R"( $name$
  10. + #)" "undef" R"( $name$
  11. + #)" "endif" R"( // $name$
  12. )");
  13. }
  14. }
  15. @@ -285,7 +285,7 @@ void FileGenerator::GenerateProtoHeader(io::Printer* p,
  16. }
  17. if (IsBootstrapProto(options_, file_)) {
  18. p->Emit({{"name", StripProto(file_->name())}}, R"cc(
  19. - // IWYU pragma: private, include "$name$.proto.h"
  20. + // IWYU pragma: private, include "$name$.pb.h"
  21. )cc");
  22. }
  23. @@ -297,7 +297,7 @@ void FileGenerator::GenerateProtoHeader(io::Printer* p,
  24. for (int i = 0; i < file_->public_dependency_count(); ++i) {
  25. const FileDescriptor* dep = file_->public_dependency(i);
  26. p->Emit({{"name", StripProto(dep->name())}}, R"(
  27. - #include "$name$.proto.h"
  28. + #)" R"(include "$name$.pb.h"
  29. )");
  30. }
  31. }},
  32. @@ -443,7 +443,7 @@ void FileGenerator::GenerateSourceIncludes(io::Printer* p) {
  33. // Generated by the protocol buffer compiler. DO NOT EDIT!
  34. // source: $filename$
  35. - #include $h_include$
  36. + #)" "include" R"( $h_include$
  37. #include <algorithm>
  38. )");
  39. @@ -485,7 +485,7 @@ void FileGenerator::GenerateSourceIncludes(io::Printer* p) {
  40. GetBootstrapBasename(options_, basename, &basename);
  41. }
  42. p->Emit({{"name", basename}}, R"(
  43. - #include "$name$.proto.h"
  44. + #)" R"(include "$name$.pb.h"
  45. )");
  46. }
  47. }
  48. @@ -1390,9 +1390,8 @@ void FileGenerator::GenerateDependencyIncludes(io::Printer* p) {
  49. p->Emit(
  50. {{"name", CreateHeaderInclude(absl::StrCat(basename, ".pb.h"), dep)}},
  51. - R"(
  52. - #include $name$
  53. - )");
  54. + "#" "include" "$name$\n"
  55. + );
  56. }
  57. }