15 #ifndef LLVM_CLANG_LIB_FORMAT_ENCODING_H 16 #define LLVM_CLANG_LIB_FORMAT_ENCODING_H 19 #include "llvm/ADT/StringRef.h" 20 #include "llvm/Support/ConvertUTF.h" 21 #include "llvm/Support/Unicode.h" 35 const llvm::UTF8 *Ptr =
reinterpret_cast<const llvm::UTF8 *
>(Text.begin());
36 const llvm::UTF8 *BufEnd =
reinterpret_cast<const llvm::UTF8 *
>(Text.end());
37 if (llvm::isLegalUTF8String(&Ptr, BufEnd))
47 int ContentWidth = llvm::sys::unicode::columnWidthUTF8(Text);
52 if (ContentWidth >= 0)
63 unsigned TotalWidth = 0;
64 StringRef Tail =
Text;
66 StringRef::size_type TabPos = Tail.find(
'\t');
67 if (TabPos == StringRef::npos)
70 TotalWidth += TabWidth - (TotalWidth + StartColumn) % TabWidth;
71 Tail = Tail.substr(TabPos + 1);
80 return llvm::getNumBytesForUTF8(FirstChar);
86 inline bool isOctDigit(
char c) {
return '0' <= c && c <=
'7'; }
89 return (
'0' <= c && c <=
'9') || (
'a' <= c && c <=
'f') ||
90 (
'A' <= c && c <=
'F');
97 assert(Text[0] ==
'\\');
108 while (I < Text.size() &&
isHexDigit(Text[I]))
115 while (I < Text.size() && I < 4 &&
isOctDigit(Text[I]))
119 return 1 + llvm::getNumBytesForUTF8(Text[1]);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Dataflow Directional Tag Classes.