int int_offset = static_cast<int>(offset);
Location begin_loc(token.location().file(),
token.location().line_number(),
- token.location().char_offset() + int_offset + 1);
- Location end_loc(token.location().file(),
- token.location().line_number(),
- token.location().char_offset() + int_offset + 1 +
- static_cast<int>(size));
+ token.location().char_offset() + int_offset + 1,
+ token.location().byte() + int_offset + 1);
+ Location end_loc(
+ token.location().file(),
+ token.location().line_number(),
+ token.location().char_offset() + int_offset + 1 + static_cast<int>(size),
+ token.location().byte() + int_offset + 1 + static_cast<int>(size));
return Err(LocationRange(begin_loc, end_loc), msg, help);
}
str.compare(0, prefix.size(), prefix) == 0);
return str.substr(prefix.size());
}
+
+void TrimTrailingSlash(std::string* str) {
+ if (!str->empty()) {
+ DCHECK((*str)[str->size() - 1] == '/');
+ str->resize(str->size() - 1);
+ }
+}