|
29 | 29 | 'none' and 'all'. 'smart' is the default. |
30 | 30 | 5: Basic block labels are matched by FileCheck expressions |
31 | 31 | 6: The semantics of TBAA checks has been incorporated in the check lines. |
32 | | -7: Indent switch-cases correctly. |
| 32 | +7: Indent switch-cases correctly; CHECK-EMPTY instead of skipping blank lines. |
33 | 33 | """ |
34 | 34 | DEFAULT_VERSION = 6 |
35 | 35 |
|
@@ -2292,24 +2292,47 @@ def add_checks( |
2292 | 2292 | ignore_all_comments=not check_inst_comments, |
2293 | 2293 | ) |
2294 | 2294 |
|
| 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 |
2295 | 2307 |
|
2296 | 2308 | for func_line in func_body: |
2297 | 2309 | if func_line.strip() == "": |
2298 | | - # Instead of skipping blank lines, using CHECK_EMPTY is more defensive. |
2299 | | - output_lines.append( |
2300 | | - "{} {}-EMPTY:".format(comment_marker, checkprefix) |
2301 | | - ) |
| 2310 | + if ginfo.get_version() >= 7: |
| 2311 | + output_lines.append( |
| 2312 | + "{} {}-EMPTY:".format(comment_marker, checkprefix) |
| 2313 | + ) |
| 2314 | + else: |
| 2315 | + is_blank_line = True |
2302 | 2316 | continue |
2303 | 2317 | if not check_inst_comments: |
2304 | 2318 | # Do not waste time checking IR comments unless necessary. |
2305 | 2319 | func_line = SCRUB_IR_COMMENT_RE.sub(r"", func_line) |
2306 | 2320 |
|
2307 | | - check_suffix = "-NEXT" if not is_filtered else "" |
2308 | | - output_lines.append( |
2309 | | - "{} {}{}: {}".format( |
2310 | | - comment_marker, checkprefix, check_suffix, func_line |
| 2321 | + # Skip blank lines instead of checking them. |
| 2322 | + if is_blank_line: |
| 2323 | + output_lines.append( |
| 2324 | + "{} {}: {}".format( |
| 2325 | + comment_marker, checkprefix, func_line |
| 2326 | + ) |
2311 | 2327 | ) |
2312 | | - ) |
| 2328 | + else: |
| 2329 | + check_suffix = "-NEXT" if not is_filtered else "" |
| 2330 | + output_lines.append( |
| 2331 | + "{} {}{}: {}".format( |
| 2332 | + comment_marker, checkprefix, check_suffix, func_line |
| 2333 | + ) |
| 2334 | + ) |
| 2335 | + is_blank_line = False |
2313 | 2336 |
|
2314 | 2337 | # Add space between different check prefixes and also before the first |
2315 | 2338 | # line of code in the test function. |
|
0 commit comments