[PATCH] D112913: Misleading bidirectional detection
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 11 19:07:26 PST 2022
MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.
================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:16
+using namespace clang;
+
+static bool containsMisleadingBidi(StringRef Buffer,
----------------
Consider `using clang::tidy::misc::MisleadingBidirectionalCheck` to avoid specifying the long name repeatedly.
================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:43
+ while (CurPtr < Buffer.end()) {
+ ++i;
+ unsigned char C = *CurPtr;
----------------
`i` is unused
================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:48
+ // Paragraph separator
+ if (C == 0xA || C == 0xD || (0x1C <= C && C <= 0x1E) || C == 0x85)
+ BidiContexts.clear();
----------------
You may save the conditions to two booleans to avoid repeated `BidiContexts.clear();`
================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:66
+
+ // Open a PDF context
+ if (CodePoint == RLO || CodePoint == RLE || CodePoint == LRO ||
----------------
A sentence should end with a period.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112913/new/
https://reviews.llvm.org/D112913
More information about the cfe-commits
mailing list