19 bool HonorLineBreaks =
true) {
20 const char *CurPtr = Buffer.begin();
35 SmallVector<BidiChar> BidiContexts;
42 while (CurPtr < Buffer.end()) {
43 const unsigned char C = *CurPtr;
46 const bool IsParagrapSep =
47 (C == 0xA || C == 0xD || (0x1C <= C && C <= 0x1E) || C == 0x85);
48 const bool IsSegmentSep = (C == 0x9 || C == 0xB || C == 0x1F);
49 if (IsParagrapSep || IsSegmentSep)
53 llvm::UTF32 CodePoint = 0;
54 const llvm::ConversionResult Result = llvm::convertUTF8Sequence(
55 reinterpret_cast<const llvm::UTF8 **
>(&CurPtr),
56 reinterpret_cast<const llvm::UTF8 *
>(Buffer.end()), &CodePoint,
57 llvm::strictConversion);
60 if (Result != llvm::conversionOK) {
66 if (CodePoint == RLO || CodePoint == RLE || CodePoint == LRO ||
68 BidiContexts.push_back(PDF);
70 else if (CodePoint == PDF) {
71 if (!BidiContexts.empty() && BidiContexts.back() == PDF)
72 BidiContexts.pop_back();
75 else if (CodePoint == RLI || CodePoint == LRI || CodePoint == FSI)
76 BidiContexts.push_back(PDI);
78 else if (CodePoint == PDI) {
79 auto R = llvm::find(llvm::reverse(BidiContexts), PDI);
80 if (R != BidiContexts.rend())
81 BidiContexts.resize(BidiContexts.rend() - R - 1);
84 else if (CodePoint == PS)
87 return !BidiContexts.empty();
Every ClangTidyCheck reports errors through a DiagnosticsEngine provided by this context.