[PATCH] D85099: [UpdateTestChecks] Match unnamed values like "@[0-9]+" and "![0-9]+"
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 3 21:38:15 PDT 2020
MaskRay added inline comments.
================
Comment at: llvm/utils/UpdateTestChecks/common.py:316
+# other locations will need adjustment as well.
+IR_VALUE_REGEXP_PREFIX = r'(\s+)'
+IR_VALUE_REGEXP_STRING = r''
----------------
Is this a capturing group? If not, use `(?:\s+)
The 3 in the `range(3, match.lastindex):` below looks strange. I hope we can get rid if it.
================
Comment at: llvm/utils/UpdateTestChecks/common.py:324
+ IR_VALUE_REGEXP_STRING += IR_VALUE_PREFIXES[i] + r'(' + kind_regexp + r')'
+IR_VALUE_REGEXP_SUFFIX = r'([,\s\(\)]|\Z)'
+IR_VALUE_RE = re.compile(IR_VALUE_REGEXP_PREFIX + r'(' + IR_VALUE_REGEXP_STRING + r')' + IR_VALUE_REGEXP_SUFFIX)
----------------
Use non-capturing group
================
Comment at: llvm/utils/UpdateTestChecks/common.py:402
+ while changed:
+ (lines[i], changed) = IR_VALUE_RE.subn(transform_line_vars, lines[i])
return lines
----------------
Do you have an example that not substituting repeatedly can fail?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D85099/new/
https://reviews.llvm.org/D85099
More information about the llvm-commits
mailing list