Skip to content

Commit 795b217

Browse files
committed
[UTC] CHECK-EMPTY instead of skiping blank lines
1 parent 22a10c8 commit 795b217

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
@@ -2282,41 +2282,23 @@ def add_checks(
22822282
original_check_lines=original_check_lines.get(checkprefix),
22832283
)
22842284

2285-
# This could be selectively enabled with an optional invocation argument.
2286-
# Disabled for now: better to check everything. Be safe rather than sorry.
2287-
2288-
# Handle the first line of the function body as a special case because
2289-
# it's often just noise (a useless asm comment or entry label).
2290-
# if func_body[0].startswith("#") or func_body[0].startswith("entry:"):
2291-
# is_blank_line = True
2292-
# else:
2293-
# output_lines.append('%s %s: %s' % (comment_marker, checkprefix, func_body[0]))
2294-
# is_blank_line = False
2295-
2296-
is_blank_line = False
22972285

22982286
for func_line in func_body:
22992287
if func_line.strip() == "":
2300-
is_blank_line = True
2288+
# Instead of skipping blank lines, using CHECK_EMPTY is more defensive.
2289+
output_lines.append(
2290+
"{} {}-EMPTY:".format(comment_marker, checkprefix)
2291+
)
23012292
continue
23022293
# Do not waste time checking IR comments.
23032294
func_line = SCRUB_IR_COMMENT_RE.sub(r"", func_line)
23042295

2305-
# Skip blank lines instead of checking them.
2306-
if is_blank_line:
2307-
output_lines.append(
2308-
"{} {}: {}".format(
2309-
comment_marker, checkprefix, func_line
2310-
)
2311-
)
2312-
else:
2313-
check_suffix = "-NEXT" if not is_filtered else ""
2314-
output_lines.append(
2315-
"{} {}{}: {}".format(
2316-
comment_marker, checkprefix, check_suffix, func_line
2317-
)
2296+
check_suffix = "-NEXT" if not is_filtered else ""
2297+
output_lines.append(
2298+
"{} {}{}: {}".format(
2299+
comment_marker, checkprefix, check_suffix, func_line
23182300
)
2319-
is_blank_line = False
2301+
)
23202302

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

0 commit comments

Comments
 (0)