diff options
author | Giorgis Georgakoudis <georgakoudis1@llnl.gov> | 2021-03-21 13:08:44 -0700 |
---|---|---|
committer | Giorgis Georgakoudis <georgakoudis1@llnl.gov> | 2021-03-24 17:47:33 -0700 |
commit | 7ad55a3df51a0d8c904fec3f52117932c23f0b01 (patch) | |
tree | a6fece378ac335fe343f924844e44152ebde12df /llvm/utils/UpdateTestChecks/common.py | |
parent | f5ba3eea6746559513af7ed32db8083ad52661a3 (diff) | |
download | llvm-7ad55a3df51a0d8c904fec3f52117932c23f0b01.zip llvm-7ad55a3df51a0d8c904fec3f52117932c23f0b01.tar.gz llvm-7ad55a3df51a0d8c904fec3f52117932c23f0b01.tar.bz2 |
[Utils][NFC] Fix regex substitution for update test checks
Relates to: https://reviews.llvm.org/D97107
Diffstat (limited to 'llvm/utils/UpdateTestChecks/common.py')
-rw-r--r-- | llvm/utils/UpdateTestChecks/common.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 38b5b1d..1940ac3 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -362,8 +362,8 @@ class FunctionTestBuilder: func_repl = regex # Replace any capture groups with their matched strings. for g in match.groups(): - func_repl = group_regex.sub(g, func_repl, count=1) - func = '{{' + func_repl + '}}' + func_repl = group_regex.sub(re.escape(g), func_repl, count=1) + func = re.sub(func_repl, '{{' + func_repl + '}}', func) # Replace all calls to regex matching functions. matches = re.finditer(regex, scrubbed_body) @@ -371,7 +371,7 @@ class FunctionTestBuilder: func_repl = regex # Replace any capture groups with their matched strings. for g in match.groups(): - func_repl = group_regex.sub(g, func_repl, count=1) + func_repl = group_regex.sub(re.escape(g), func_repl, count=1) # Substitute function call names that match the regex with the same # capture groups set. scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body) |