update_test_checks: indent dbg records (#139230)

LLVM prints debug records like `#dbg_value` indented 2 additional spaces.
This commit is contained in:
Orlando Cazalet-Hyams 2025-05-09 11:23:43 +01:00 committed by GitHub
parent 89d13f87c7
commit 234ae9bfd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 32 additions and 27 deletions

View File

@ -602,6 +602,8 @@ TRIPLE_ARG_RE = re.compile(r"-m?triple[= ]([^ ]+)")
MARCH_ARG_RE = re.compile(r"-march[= ]([^ ]+)")
DEBUG_ONLY_ARG_RE = re.compile(r"-debug-only[= ]([^ ]+)")
IS_DEBUG_RECORD_RE = re.compile(r"^(\s+)#dbg_")
SCRUB_LEADING_WHITESPACE_RE = re.compile(r"^(\s+)")
SCRUB_WHITESPACE_RE = re.compile(r"(?!^(| \w))[ \t]+", flags=re.M)
SCRUB_PRESERVE_LEADING_WHITESPACE_RE = re.compile(r"((?!^)[ \t]*(\S))[ \t]+")

View File

@ -251,8 +251,11 @@ def update_test(ti: common.TestInfo):
skip_same_checks=dropped_previous_line,
):
# This input line of the function body will go as-is into the output.
# Except make leading whitespace uniform: 2 spaces.
input_line = common.SCRUB_LEADING_WHITESPACE_RE.sub(r" ", input_line)
# Except make leading whitespace uniform: 2 spaces. 4 for debug records.
indent = (
" " if not common.IS_DEBUG_RECORD_RE.match(input_line) else " "
)
input_line = common.SCRUB_LEADING_WHITESPACE_RE.sub(indent, input_line)
output_lines.append(input_line)
dropped_previous_line = False
if input_line.strip() == "}":