[llvm] 3b55eeb - [update_cc_test_checks.py] Use CHECK_RE from common
Alex Richardson via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 2 10:20:56 PST 2019
Author: Alex Richardson
Date: 2019-12-02T18:18:47Z
New Revision: 3b55eebd239ee7d518a95ca9ecccf879b17d7e8c
URL: https://github.com/llvm/llvm-project/commit/3b55eebd239ee7d518a95ca9ecccf879b17d7e8c
DIFF: https://github.com/llvm/llvm-project/commit/3b55eebd239ee7d518a95ca9ecccf879b17d7e8c.diff
LOG: [update_cc_test_checks.py] Use CHECK_RE from common
Summary:
This change modifies the common.CHECK_RE regex to also handle '//'
comment prefixes which allows us to share it between clang and IR tests.
Using the regex from common means that *-SAME lines are also stripped
now. Before this change using the --function-signature flag would result
in -SAME: lines from previous runs not being removed.
Reviewers: MaskRay, jdoerfert
Reviewed By: jdoerfert
Subscribers: jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70890
Added:
Modified:
llvm/utils/UpdateTestChecks/common.py
llvm/utils/update_cc_test_checks.py
Removed:
################################################################################
diff --git a/llvm/utils/UpdateTestChecks/common.py b/llvm/utils/UpdateTestChecks/common.py
index dfb3b16ae6bb..5cf79012f100 100644
--- a/llvm/utils/UpdateTestChecks/common.py
+++ b/llvm/utils/UpdateTestChecks/common.py
@@ -61,7 +61,7 @@ def invoke_tool(exe, cmd_args, ir):
RUN_LINE_RE = re.compile(r'^\s*(?://|[;#])\s*RUN:\s*(.*)$')
CHECK_PREFIX_RE = re.compile(r'--?check-prefix(?:es)?[= ](\S+)')
PREFIX_RE = re.compile('^[a-zA-Z0-9_-]+$')
-CHECK_RE = re.compile(r'^\s*[;#]\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL|-SAME)?:')
+CHECK_RE = re.compile(r'^\s*(?://|[;#])\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL|-SAME)?:')
OPT_FUNCTION_RE = re.compile(
r'^\s*define\s+(?:internal\s+)?[^@]*@(?P<func>[\w-]+?)\s*'
diff --git a/llvm/utils/update_cc_test_checks.py b/llvm/utils/update_cc_test_checks.py
index 952f48e5941f..e251ff0b8f54 100755
--- a/llvm/utils/update_cc_test_checks.py
+++ b/llvm/utils/update_cc_test_checks.py
@@ -28,8 +28,6 @@
ADVERT = '// NOTE: Assertions have been autogenerated by '
-CHECK_RE = re.compile(r'^\s*//\s*([^:]+?)(?:-NEXT|-NOT|-DAG|-LABEL)?:')
-
SUBST = {
'%clang': [],
'%clang_cc1': ['-cc1'],
@@ -238,7 +236,7 @@ def main():
input_lines = []
with open(filename, 'r+') as f:
for line in f:
- m = CHECK_RE.match(line)
+ m = common.CHECK_RE.match(line)
if not (m and m.group(1) in prefix_set) and line != '//\n':
input_lines.append(line)
f.seek(0)
More information about the llvm-commits
mailing list