[PATCH] D104713: [UpdateCCTestChecks][NFC] Permit other comments in common.py
Joel E. Denny via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 22 07:23:44 PDT 2021
jdenny created this revision.
jdenny added reviewers: arichardson, ggeorgakoudis, jdoerfert, MaskRay, mtrofin, greened.
jdenny requested review of this revision.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D104713
Files:
llvm/utils/UpdateTestChecks/common.py
Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -121,12 +121,12 @@
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 @@
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:
@@ -793,7 +793,7 @@
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]:
@@ -809,7 +809,7 @@
break
if printed_prefixes:
- output_lines.append(SEPARATOR)
+ output_lines.append(comment_marker + SEPARATOR)
def check_prefix(prefix):
@@ -902,7 +902,7 @@
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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104713.353643.patch
Type: text/x-patch
Size: 2008 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210622/6724d161/attachment.bin>
More information about the llvm-commits
mailing list