Skip to content

Commit 0a10191

Browse files
committed
[UTC] CHECK-EMPTY instead of skiping blank lines
1 parent 511c9c0 commit 0a10191

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

llvm/utils/UpdateTestChecks/common.py

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2292,42 +2292,24 @@ def add_checks(
22922292
ignore_all_comments=not check_inst_comments,
22932293
)
22942294

2295-
# This could be selectively enabled with an optional invocation argument.
2296-
# Disabled for now: better to check everything. Be safe rather than sorry.
2297-
2298-
# Handle the first line of the function body as a special case because
2299-
# it's often just noise (a useless asm comment or entry label).
2300-
# if func_body[0].startswith("#") or func_body[0].startswith("entry:"):
2301-
# is_blank_line = True
2302-
# else:
2303-
# output_lines.append('%s %s: %s' % (comment_marker, checkprefix, func_body[0]))
2304-
# is_blank_line = False
2305-
2306-
is_blank_line = False
23072295

23082296
for func_line in func_body:
23092297
if func_line.strip() == "":
2310-
is_blank_line = True
2298+
# Instead of skipping blank lines, using CHECK_EMPTY is more defensive.
2299+
output_lines.append(
2300+
"{} {}-EMPTY:".format(comment_marker, checkprefix)
2301+
)
23112302
continue
23122303
if not check_inst_comments:
23132304
# Do not waste time checking IR comments unless necessary.
23142305
func_line = SCRUB_IR_COMMENT_RE.sub(r"", func_line)
23152306

2316-
# Skip blank lines instead of checking them.
2317-
if is_blank_line:
2318-
output_lines.append(
2319-
"{} {}: {}".format(
2320-
comment_marker, checkprefix, func_line
2321-
)
2322-
)
2323-
else:
2324-
check_suffix = "-NEXT" if not is_filtered else ""
2325-
output_lines.append(
2326-
"{} {}{}: {}".format(
2327-
comment_marker, checkprefix, check_suffix, func_line
2328-
)
2307+
check_suffix = "-NEXT" if not is_filtered else ""
2308+
output_lines.append(
2309+
"{} {}{}: {}".format(
2310+
comment_marker, checkprefix, check_suffix, func_line
23292311
)
2330-
is_blank_line = False
2312+
)
23312313

23322314
# Add space between different check prefixes and also before the first
23332315
# line of code in the test function.

0 commit comments

Comments
 (0)