diff --git a/tools/distrib/python/grpcio_tools/BUILD.bazel b/tools/distrib/python/grpcio_tools/BUILD.bazel index 25cd7fe15b2..fac6bb3babd 100644 --- a/tools/distrib/python/grpcio_tools/BUILD.bazel +++ b/tools/distrib/python/grpcio_tools/BUILD.bazel @@ -28,6 +28,7 @@ cc_library( includes = ["."], deps = [ "//src/compiler:grpc_plugin_support", + "@com_google_absl//absl/strings", "@com_google_protobuf//:protoc_lib", ], ) diff --git a/tools/distrib/python/grpcio_tools/grpc_tools/main.cc b/tools/distrib/python/grpcio_tools/grpc_tools/main.cc index d49edd323a9..1d9749861bc 100644 --- a/tools/distrib/python/grpcio_tools/grpc_tools/main.cc +++ b/tools/distrib/python/grpcio_tools/grpc_tools/main.cc @@ -29,6 +29,8 @@ #include #include +#include "absl/strings/string_view.h" + #include "src/compiler/python_generator.h" using ::google::protobuf::FileDescriptor; @@ -105,14 +107,16 @@ class ErrorCollectorImpl : public MultiFileErrorCollector { std::vector<::grpc_tools::ProtocWarning>* warnings) : errors_(errors), warnings_(warnings) {} - void AddError(const std::string& filename, int line, int column, - const std::string& message) { - errors_->emplace_back(filename, line, column, message); + void RecordError(absl::string_view filename, int line, int column, + absl::string_view message) { + errors_->emplace_back(std::string(filename), line, column, + std::string(message)); } - void AddWarning(const std::string& filename, int line, int column, - const std::string& message) { - warnings_->emplace_back(filename, line, column, message); + void RecordWarning(absl::string_view filename, int line, int column, + absl::string_view message) { + warnings_->emplace_back(std::string(filename), line, column, + std::string(message)); } private: