location -> loc abbreviation (#3826)

This commit is contained in:
Jon Ross-Perkins authored and GitHub committed 2024-03-28 18:15:18 +00:00
1 parent 72564a08d4
commit b5d28f2c4b
48 files changed
+341 -373

No files matched your search

+8 -8
View File
@@ -35,7 +35,7 @@ auto TokenizedBuffer::GetColumnNumber(TokenIndex token) const -> int {
return GetTokenInfo(token).column + 1;
}
auto TokenizedBuffer::GetEndLocation(TokenIndex token) const
auto TokenizedBuffer::GetEndLoc(TokenIndex token) const
-> std::pair<LineIndex, int> {
auto line = GetLine(token);
int column = GetColumnNumber(token);
@@ -345,8 +345,8 @@ auto TokenIterator::Print(llvm::raw_ostream& output) const -> void {
output << token_.index;
}
auto TokenizedBuffer::SourceBufferDiagnosticConverter::ConvertLocation(
const char* loc, ContextFnT /*context_fn*/) const -> DiagnosticLocation {
auto TokenizedBuffer::SourceBufferDiagnosticConverter::ConvertLoc(
const char* loc, ContextFnT /*context_fn*/) const -> DiagnosticLoc {
CARBON_CHECK(StringRefContainsPointer(buffer_->source_->text(), loc))
<< "location not within buffer";
int64_t offset = loc - buffer_->source_->text().begin();
@@ -390,9 +390,9 @@ auto TokenizedBuffer::SourceBufferDiagnosticConverter::ConvertLocation(
.column_number = column_number + 1};
}
auto TokenDiagnosticConverter::ConvertLocation(TokenIndex token,
ContextFnT context_fn) const
-> DiagnosticLocation {
auto TokenDiagnosticConverter::ConvertLoc(TokenIndex token,
ContextFnT context_fn) const
-> DiagnosticLoc {
// Map the token location into a position within the source buffer.
const auto& token_info = buffer_->GetTokenInfo(token);
const auto& line_info = buffer_->GetLineInfo(token_info.token_line);
@@ -402,8 +402,8 @@ auto TokenDiagnosticConverter::ConvertLocation(TokenIndex token,
// Find the corresponding file location.
// TODO: Should we somehow indicate in the diagnostic location if this token
// is a recovery token that doesn't correspond to the original source?
DiagnosticLocation loc =
TokenizedBuffer::SourceBufferDiagnosticConverter(buffer_).ConvertLocation(
DiagnosticLoc loc =
TokenizedBuffer::SourceBufferDiagnosticConverter(buffer_).ConvertLoc(
token_start, context_fn);
loc.length = buffer_->GetTokenText(token).size();
return loc;