make Context::Emit pass SourceLocation

PiperOrigin-RevId: 529172439
pull/12585/head
Matt Kulukundis 2 years ago committed by Copybara-Service
parent 823ba794c5
commit 126e361e64
  1. 13
      src/google/protobuf/compiler/rust/context.h
  2. 6
      src/google/protobuf/io/printer.h

@ -106,10 +106,15 @@ class Context {
}
// Forwards to Emit(), which will likely be called all the time.
void Emit(absl::string_view format) const { printer_->Emit(format); }
void Emit(absl::Span<const io::Printer::Sub> vars,
absl::string_view format) const {
printer_->Emit(vars, format);
void Emit(absl::string_view format,
io::Printer::SourceLocation loc =
io::Printer::SourceLocation::current()) const {
printer_->Emit(format, loc);
}
void Emit(absl::Span<const io::Printer::Sub> vars, absl::string_view format,
io::Printer::SourceLocation loc =
io::Printer::SourceLocation::current()) const {
printer_->Emit(vars, format, loc);
}
private:

@ -465,6 +465,9 @@ class AnnotationProtoCollector : public AnnotationCollector {
// call_ descriptor.
class PROTOBUF_EXPORT Printer {
private:
struct AnnotationRecord;
public:
// This type exists to work around an absl type that has not yet been
// released.
struct SourceLocation {
@ -473,9 +476,6 @@ class PROTOBUF_EXPORT Printer {
int line() { return 0; }
};
struct AnnotationRecord;
public:
static constexpr char kDefaultVariableDelimiter = '$';
static constexpr absl::string_view kProtocCodegenTrace =
"PROTOC_CODEGEN_TRACE";

Loading…
Cancel
Save