Skip to content

Commit 144da61

Browse files
committed
[UTC][NFC] Indent switch cases
1 parent b0b4a8e commit 144da61

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

llvm/utils/UpdateTestChecks/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,7 @@ def invoke_tool(exe, cmd_args, ir, preprocess_cmd=None, verbose=False):
606606
DEBUG_ONLY_ARG_RE = re.compile(r"-debug-only[= ]([^ ]+)")
607607

608608
IS_DEBUG_RECORD_RE = re.compile(r"^(\s+)#dbg_")
609+
IS_SWITCH_CASE_RE = re.compile(r"^\s+i\d{1,2} \d+, label %\w+")
609610

610611
SCRUB_LEADING_WHITESPACE_RE = re.compile(r"^(\s+)")
611612
SCRUB_WHITESPACE_RE = re.compile(r"(?!^(| \w))[ \t]+", flags=re.M)

llvm/utils/update_test_checks.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,14 @@ def update_test(ti: common.TestInfo):
260260
skip_same_checks=dropped_previous_line,
261261
):
262262
# This input line of the function body will go as-is into the output.
263-
# Except make leading whitespace uniform: 2 spaces. 4 for debug records.
263+
# Except make leading whitespace uniform: 2 spaces. 4 for debug records/switch cases.
264264
indent = (
265-
" " if not common.IS_DEBUG_RECORD_RE.match(input_line) else " "
265+
" " * 4
266+
if (
267+
common.IS_DEBUG_RECORD_RE.match(input_line)
268+
or common.IS_SWITCH_CASE_RE.match(input_line)
269+
)
270+
else " " * 2
266271
)
267272
input_line = common.SCRUB_LEADING_WHITESPACE_RE.sub(indent, input_line)
268273
output_lines.append(input_line)

0 commit comments

Comments
 (0)