[all-commits] [llvm/llvm-project] 28d0c0: [lldb] Tidy some regex in crashlog.py (NFC)

Dave Lee via All-commits all-commits at lists.llvm.org
Thu Aug 11 15:25:20 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 28d0c0c2c8e88d2b6599ee34c84eb58eed43a626
      https://github.com/llvm/llvm-project/commit/28d0c0c2c8e88d2b6599ee34c84eb58eed43a626
  Author: Dave Lee <davelee.com at gmail.com>
  Date:   2022-08-11 (Thu, 11 Aug 2022)

  Changed paths:
    M lldb/examples/python/crashlog.py
    M lldb/test/Shell/ScriptInterpreter/Python/Crashlog/parser_text.test

  Log Message:
  -----------
  [lldb] Tidy some regex in crashlog.py (NFC)

A spiritual follow up to D131032. I noticed some regex could be simplified.

This does some of the following:
1. Removes unused capture groups
2. Uses non-capturing `(?:...)` groups where grouping is needed but capturing isn't
3. Removes trailing `.*`
4. Uses `\d` over `[0-9]`
5. Uses raw strings
6. Uses `{N,}` to indicate N-or-more

Also improves the call site of a `re.findall`.

Differential Revision: https://reviews.llvm.org/D131305




More information about the All-commits mailing list