|
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 |
|
@@ -2282,23 +2282,46 @@ def add_checks( |
2282 | 2282 | original_check_lines=original_check_lines.get(checkprefix), |
2283 | 2283 | ) |
2284 | 2284 |
|
| 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 |
2285 | 2297 |
|
2286 | 2298 | for func_line in func_body: |
2287 | 2299 | if func_line.strip() == "": |
2288 | | - # Instead of skipping blank lines, using CHECK_EMPTY is more defensive. |
2289 | | - output_lines.append( |
2290 | | - "{} {}-EMPTY:".format(comment_marker, checkprefix) |
2291 | | - ) |
| 2300 | + if ginfo.get_version() >= 7: |
| 2301 | + output_lines.append( |
| 2302 | + "{} {}-EMPTY:".format(comment_marker, checkprefix) |
| 2303 | + ) |
| 2304 | + else: |
| 2305 | + is_blank_line = True |
2292 | 2306 | continue |
2293 | 2307 | # Do not waste time checking IR comments. |
2294 | 2308 | func_line = SCRUB_IR_COMMENT_RE.sub(r"", func_line) |
2295 | 2309 |
|
2296 | | - check_suffix = "-NEXT" if not is_filtered else "" |
2297 | | - output_lines.append( |
2298 | | - "{} {}{}: {}".format( |
2299 | | - comment_marker, checkprefix, check_suffix, func_line |
| 2310 | + # Skip blank lines instead of checking them. |
| 2311 | + if is_blank_line: |
| 2312 | + output_lines.append( |
| 2313 | + "{} {}: {}".format( |
| 2314 | + comment_marker, checkprefix, func_line |
| 2315 | + ) |
2300 | 2316 | ) |
2301 | | - ) |
| 2317 | + else: |
| 2318 | + check_suffix = "-NEXT" if not is_filtered else "" |
| 2319 | + output_lines.append( |
| 2320 | + "{} {}{}: {}".format( |
| 2321 | + comment_marker, checkprefix, check_suffix, func_line |
| 2322 | + ) |
| 2323 | + ) |
| 2324 | + is_blank_line = False |
2302 | 2325 |
|
2303 | 2326 | # Add space between different check prefixes and also before the first |
2304 | 2327 | # line of code in the test function. |
|
0 commit comments