[PATCH] D68851: [Utils] Allow update_test_checks to scrub attribute annotations
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 1 10:47:36 PDT 2019
jdoerfert updated this revision to Diff 227480.
jdoerfert added a comment.
Make the decision per test (in preperation of D69701 <https://reviews.llvm.org/D69701>)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68851/new/
https://reviews.llvm.org/D68851
Files:
llvm/utils/UpdateTestChecks/common.py
llvm/utils/update_test_checks.py
Index: llvm/utils/update_test_checks.py
===================================================================
--- llvm/utils/update_test_checks.py
+++ llvm/utils/update_test_checks.py
@@ -68,6 +68,8 @@
help='Do not scrub IR names')
parser.add_argument('--function-signature', action='store_true',
help='Keep function signature information around for the check line')
+ parser.add_argument('--scrub-attributes', action='store_true',
+ help='Remove attribute annotations (#0) from the end of check line')
parser.add_argument('tests', nargs='+')
args = parser.parse_args()
@@ -103,6 +105,12 @@
common.warn("Skipping test which isn't autogenerated: " + test)
continue
+ # If requested we scrub trailing attribute annotations, e.g., '#0', together with whitespaces
+ if args.scrub_attributes:
+ common.SCRUB_TRAILING_WHITESPACE_TEST_RE = common.SCRUB_TRAILING_WHITESPACE_AND_ATTRIBUTES_RE
+ else:
+ common.SCRUB_TRAILING_WHITESPACE_TEST_RE = common.SCRUB_TRAILING_WHITESPACE_RE
+
raw_lines = [m.group(1)
for m in [common.RUN_LINE_RE.match(l) for l in input_lines] if m]
run_lines = [raw_lines[0]] if len(raw_lines) > 0 else []
Index: llvm/utils/UpdateTestChecks/common.py
===================================================================
--- llvm/utils/UpdateTestChecks/common.py
+++ llvm/utils/UpdateTestChecks/common.py
@@ -68,6 +68,8 @@
SCRUB_LEADING_WHITESPACE_RE = re.compile(r'^(\s+)')
SCRUB_WHITESPACE_RE = re.compile(r'(?!^(| \w))[ \t]+', flags=re.M)
SCRUB_TRAILING_WHITESPACE_RE = re.compile(r'[ \t]+$', flags=re.M)
+SCRUB_TRAILING_WHITESPACE_TEST_RE = SCRUB_TRAILING_WHITESPACE_RE
+SCRUB_TRAILING_WHITESPACE_AND_ATTRIBUTES_RE = re.compile(r'([ \t]|(#[0-9]+))+$', flags=re.M)
SCRUB_KILL_COMMENT_RE = re.compile(r'^ *#+ +kill:.*\n')
SCRUB_LOOP_COMMENT_RE = re.compile(
r'# =>This Inner Loop Header:.*|# in Loop:.*', flags=re.M)
@@ -90,7 +92,7 @@
# Expand the tabs used for indentation.
body = string.expandtabs(body, 2)
# Strip trailing whitespace.
- body = SCRUB_TRAILING_WHITESPACE_RE.sub(r'', body)
+ body = SCRUB_TRAILING_WHITESPACE_TEST_RE.sub(r'', body)
return body
def do_scrub(body, scrubber, scrubber_args, extra):
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68851.227480.patch
Type: text/x-patch
Size: 2301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191101/84775fbf/attachment.bin>
More information about the llvm-commits
mailing list