Skip to content
Merged
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
7 changes: 7 additions & 0 deletions llvm/lib/Support/FormattedStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ void formatted_raw_ostream::UpdatePosition(const char *Ptr, size_t Size) {
// Now scan the rest of the buffer.
unsigned NumBytes;
for (const char *End = Ptr + Size; Ptr < End; Ptr += NumBytes) {
// Fast path for printable ASCII characters without special handling.
if (*Ptr >= 0x20 && *Ptr <= 0x7e) {
NumBytes = 1;
++Column;
continue;
}

NumBytes = getNumBytesForUTF8(*Ptr);

// The buffer might end part way through a UTF-8 code unit sequence for a
Expand Down