[PATCH] D63179: [sanitizer-common] Reduce ANSI color sequences that have no effect.

Petr Hosek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 22:19:38 PDT 2019


phosek added inline comments.


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_report_decorator.cc:22
+SanitizerCommonDecorator::ToKind(const char *s) {
+  if (internal_strncmp(s, "\033[", 2) != 0 || s[2] == '\0' || s[3] != 'm')
+    return kUnknown;
----------------
Why not `internal_strncmp(s, "\033[0", 3) != 0`?


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_report_decorator.cc:119
+        // in a sequence is active.
+        for(auto kind = ToKind(s); kind != kUnknown; kind = ToKind(s)) {
+            next = kind;
----------------
nit: space between `for` and `(`


================
Comment at: compiler-rt/lib/sanitizer_common/sanitizer_report_decorator.cc:148
+      internal_strncpy(z, ToStr(next), n + 1);
+    } else
+      *z = '\0';
----------------
Can you use braces for `else` for consistency?


================
Comment at: compiler-rt/lib/sanitizer_common/tests/sanitizer_printf_test.cc:192
+  {"BxBRTRyB", "BxTRyB"},
+};
+class TestDecorator : public SanitizerCommonDecorator {
----------------
nit: separate with empty line from the class declaration


Repository:
  rCRT Compiler Runtime

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

https://reviews.llvm.org/D63179





More information about the llvm-commits mailing list