diff options
Diffstat (limited to 'llvm/utils/UpdateTestChecks/common.py')
-rw-r--r-- | llvm/utils/UpdateTestChecks/common.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py index 74044f9..88b2ccc2 100644 --- a/llvm/utils/UpdateTestChecks/common.py +++ b/llvm/utils/UpdateTestChecks/common.py @@ -1171,6 +1171,9 @@ def generalize_check_lines_common( return match.group(1) + rv + match.group(match.lastindex) lines_with_def = [] + multiple_braces_re = re.compile(r"({{+)|(}}+)") + def escape_braces(match_obj): + return '{{' + re.escape(match_obj.group(0)) + '}}' for i, line in enumerate(lines): if not is_asm and not is_analyze: @@ -1200,6 +1203,10 @@ def generalize_check_lines_common( (lines[i], changed) = nameless_value_regex.subn( transform_line_vars, lines[i], count=1 ) + if is_analyze: + # Escape multiple {{ or }} as {{}} denotes a FileCheck regex. + scrubbed_line = multiple_braces_re.sub(escape_braces, lines[i]) + lines[i] = scrubbed_line return lines |