update_test_checks: indent dbg records (#139230)
LLVM prints debug records like `#dbg_value` indented 2 additional spaces.
This commit is contained in:
parent
89d13f87c7
commit
234ae9bfd9
@ -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]+")
|
||||
|
@ -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() == "}":
|
||||
|
Loading…
x
Reference in New Issue
Block a user