diff --git a/llvm/lib/Support/Unicode.cpp b/llvm/lib/Support/Unicode.cpp --- a/llvm/lib/Support/Unicode.cpp +++ b/llvm/lib/Support/Unicode.cpp @@ -476,31 +476,31 @@ return 1; } -static bool isprintableascii(char c) { return c > 31 && c < 127; } +static bool isPrintableASCII(char C) { return C > 31 && C < 127; } int columnWidthUTF8(StringRef Text) { unsigned ColumnWidth = 0; unsigned Length; - for (size_t i = 0, e = Text.size(); i < e; i += Length) { - Length = getNumBytesForUTF8(Text[i]); + for (size_t I = 0, E = Text.size(); I < E; I += Length) { + Length = getNumBytesForUTF8(Text[I]); // fast path for ASCII characters if (Length == 1) { - if (!isprintableascii(Text[i])) + if (!isPrintableASCII(Text[I])) return ErrorNonPrintableCharacter; ColumnWidth += 1; continue; } - if (Length <= 0 || i + Length > Text.size()) + if (Length <= 0 || I + Length > Text.size()) return ErrorInvalidUTF8; - UTF32 buf[1]; - const UTF8 *Start = reinterpret_cast(Text.data() + i); - UTF32 *Target = &buf[0]; + UTF32 Buf[1]; + const UTF8 *Start = reinterpret_cast(Text.data() + I); + UTF32 *Target = &Buf[0]; if (conversionOK != ConvertUTF8toUTF32(&Start, Start + Length, &Target, Target + 1, strictConversion)) return ErrorInvalidUTF8; - int Width = charWidth(buf[0]); + int Width = charWidth(Buf[0]); if (Width < 0) return ErrorNonPrintableCharacter; ColumnWidth += Width;