[llvm] 38b7b1d - [UpdateCCTestChecks][NFC] Permit other comments in common.py
Joel E. Denny via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 23 08:18:08 PDT 2021
Author: Joel E. Denny
Date: 2021-06-23T11:12:42-04:00
New Revision: 38b7b1d4a2930cc82e69a8069fad4b363f73a212
URL: https://github.com/llvm/llvm-project/commit/38b7b1d4a2930cc82e69a8069fad4b363f73a212
DIFF: https://github.com/llvm/llvm-project/commit/38b7b1d4a2930cc82e69a8069fad4b363f73a212.diff
LOG: [UpdateCCTestChecks][NFC] Permit other comments in common.py
Some parts of common.py already permit comment styles besides `;`.
Handle the remaining cases. Specifically, a future patch will extend
update_cc_test_checks.py to call add_global_checks.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D104713
Added:
Modified:
llvm/utils/UpdateTestChecks/common.py
Removed:
################################################################################
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index 3f3682c5b9de..63fbf9476050 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -121,12 +121,12 @@ def itertests(test_patterns, parser, script_name, comment_prefix=None, argparse_
comment_prefix, argparse_callback)
-def should_add_line_to_output(input_line, prefix_set, skip_global_checks = False):
+def should_add_line_to_output(input_line, prefix_set, skip_global_checks = False, comment_marker = ';'):
# Skip any blank comment lines in the IR.
- if not skip_global_checks and input_line.strip() == ';':
+ if not skip_global_checks and input_line.strip() == comment_marker:
return False
# Skip a special double comment line we use as a separator.
- if input_line.strip() == SEPARATOR:
+ if input_line.strip() == comment_marker + SEPARATOR:
return False
# Skip any blank lines in the IR.
#if input_line.strip() == '':
@@ -204,7 +204,7 @@ def invoke_tool(exe, cmd_args, ir, preprocess_cmd=None, verbose=False):
r'# =>This Inner Loop Header:.*|# in Loop:.*', flags=re.M)
SCRUB_TAILING_COMMENT_TOKEN_RE = re.compile(r'(?<=\S)+[ \t]*#$', flags=re.M)
-SEPARATOR = ';.'
+SEPARATOR = '.'
def error(msg, test_file=None):
if test_file:
@@ -794,7 +794,7 @@ def add_global_checks(glob_val_dict, comment_marker, prefix_list, output_lines,
if not glob_val_dict[checkprefix][nameless_value.check_prefix]:
continue
- output_lines.append(SEPARATOR)
+ output_lines.append(comment_marker + SEPARATOR)
global_vars_seen_before = [key for key in global_vars_seen.keys()]
for line in glob_val_dict[checkprefix][nameless_value.check_prefix]:
@@ -810,7 +810,7 @@ def add_global_checks(glob_val_dict, comment_marker, prefix_list, output_lines,
break
if printed_prefixes:
- output_lines.append(SEPARATOR)
+ output_lines.append(comment_marker + SEPARATOR)
def check_prefix(prefix):
@@ -903,7 +903,7 @@ def dump_input_lines(output_lines, test_info, prefix_set, comment_string):
args = input_line_info.args
if line.strip() == comment_string:
continue
- if line.strip() == SEPARATOR:
+ if line.strip() == comment_string + SEPARATOR:
continue
if line.lstrip().startswith(comment_string):
m = CHECK_RE.match(line)
More information about the llvm-commits
mailing list