File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
llvm/utils/UpdateTestChecks Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -2280,6 +2280,9 @@ def add_checks(
22802280 # For IR output, change all defs to FileCheck variables, so we're immune
22812281 # to variable naming fashions.
22822282 else :
2283+ blank_line_indices = {
2284+ i for i , line in enumerate (func_body ) if line .strip () == ""
2285+ } if ginfo .get_version () >= 7 else set ()
22832286 func_body = generalize_check_lines (
22842287 func_body ,
22852288 ginfo ,
@@ -2305,9 +2308,13 @@ def add_checks(
23052308
23062309 is_blank_line = False
23072310
2308- for func_line in func_body :
2311+ for idx , func_line in enumerate ( func_body ) :
23092312 if func_line .strip () == "" :
2310- if ginfo .get_version () >= 7 :
2313+ # We should distinguish if the line is a 'fake' blank line generated by
2314+ # generalize_check_lines removing comments.
2315+ # Fortunately, generalize_check_lines does not change the index of each line,
2316+ # we can record the indices of blank lines preemptively.
2317+ if idx in blank_line_indices :
23112318 output_lines .append (
23122319 "{} {}-EMPTY:" .format (comment_marker , checkprefix )
23132320 )
You can’t perform that action at this time.
0 commit comments