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)
71 TotalWidth += TabWidth - (TotalWidth + StartColumn) % TabWidth;
72 Tail = Tail.substr(TabPos + 1);
81 return llvm::getNumBytesForUTF8(FirstChar);
87 inline bool isOctDigit(
char c) {
return '0' <= c && c <=
'7'; }
90 return (
'0' <= c && c <=
'9') || (
'a' <= c && c <=
'f') ||
91 (
'A' <= c && c <=
'F');
98 assert(Text[0] ==
'\\');
109 while (I < Text.size() &&
isHexDigit(Text[I]))
116 while (I < Text.size() && I < 4 &&
isOctDigit(Text[I]))
120 return 1 + llvm::getNumBytesForUTF8(Text[1]);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Dataflow Directional Tag Classes.