Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from Add*() to Record*() set of methods #37659

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class StringErrorCollector : public google::protobuf::io::ErrorCollector {
bool ignore_warnings = false);

// google::protobuf::io::ErrorCollector:
void AddError(int line, ColumnNumber column, const std::string& message) override;
void AddWarning(int line, ColumnNumber column, const std::string& message) override;
void RecordError(int line, int column, absl::string_view message) override;
void RecordWarning(int line, int column, absl::string_view message) override;

private:
std::string& error_text_;
Expand All @@ -47,16 +47,16 @@ StringErrorCollector::StringErrorCollector(std::string& error_text, bool one_ind
: error_text_(error_text), index_offset_(one_indexing ? 1 : 0),
ignore_warnings_(ignore_warnings) {}

void StringErrorCollector::AddError(int line, ColumnNumber column, const std::string& message) {
void StringErrorCollector::RecordError(int line, ColumnNumber column, absl::string_view message) {
absl::SubstituteAndAppend(&error_text_, "$0($1): $2\n", line + index_offset_,
column + index_offset_, message);
}

void StringErrorCollector::AddWarning(int line, ColumnNumber column, const std::string& message) {
void StringErrorCollector::RecordWarning(int line, ColumnNumber column, absl::string_view message) {
if (ignore_warnings_) {
return;
}
AddError(line, column, message);
RecordError(line, column, message);
}

using ::testing::Eq;
Expand Down