[PATCH] D112913: Misleading bidirectional detection

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 1 17:33:34 PDT 2021


MaskRay requested changes to this revision.
MaskRay added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:19
+
+static bool ContainsMisleadingBidi(StringRef Buffer, bool HonorLineBreaks=true) {
+  const char* CurPtr = Buffer.begin();
----------------
`functionName`


================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:19
+
+static bool ContainsMisleadingBidi(StringRef Buffer, bool HonorLineBreaks=true) {
+  const char* CurPtr = Buffer.begin();
----------------
MaskRay wrote:
> `functionName`
clang-format `bool HonorLineBreaks=true`


================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:20
+static bool ContainsMisleadingBidi(StringRef Buffer, bool HonorLineBreaks=true) {
+  const char* CurPtr = Buffer.begin();
+  unsigned EmbeddingOverride = 0, Isolate = 0;
----------------



================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:47
+    unsigned char C = *CurPtr;
+    if(isASCII(C)) {
+      ++CurPtr;
----------------



================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:51
+      if(C == '\n' || C == '\r' || C == '\f' || C == '\v' || C == 0x85 /*next line*/) {
+        EmbeddingOverride = Isolate = 0;
+      }
----------------
no brace


================
Comment at: clang-tools-extra/clang-tidy/misc/MisleadingBidirectional.cpp:98
+private:
+
+  MisleadingBidirectionalCheck &Check;
----------------
delete blank line


================
Comment at: clang-tools-extra/test/clang-tidy/check_clang_tidy.py:85
 
-  with open(input_file_name, 'r') as input_file:
+  with open(input_file_name, 'r', encoding="utf-8") as input_file:
     input_text = input_file.read()
----------------
Prefer single quotes


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112913/new/

https://reviews.llvm.org/D112913



More information about the cfe-commits mailing list