[llvm] [llvm-lit] Process ANSI color codes in test output when formatting (PR #106776)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 15:14:19 PDT 2024


================
@@ -1005,6 +1005,44 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
     return exitCode
 
 
+def reFindLast(r, s):
+    matches = r.findall(s)
+    if not matches:
+        return None
+    return matches[-1]
+
+
+def findColor(s, curr_color):
+    m = reFindLast(color_re, s)
----------------
arichardson wrote:

I'd inline the reFindLast here since it's only used once.

https://github.com/llvm/llvm-project/pull/106776


More information about the llvm-commits mailing list