Skip to content

Commit 9f9a4df

Browse files
committed
Revert "Replace func name with regex for update test scripts"
This reverts commit 5eaf70a.
1 parent 5eaf70a commit 9f9a4df

File tree

5 files changed

+1
-89
lines changed

5 files changed

+1
-89
lines changed

clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c

Lines changed: 0 additions & 12 deletions
This file was deleted.

clang/test/utils/update_cc_test_checks/Inputs/generated-funcs-regex.c.expected

Lines changed: 0 additions & 36 deletions
This file was deleted.

clang/test/utils/update_cc_test_checks/generated-funcs-regex.test

Lines changed: 0 additions & 9 deletions
This file was deleted.

llvm/utils/UpdateTestChecks/common.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ def parse_commandline_args(parser):
3030
help='Activate CHECK line generation from this point forward')
3131
parser.add_argument('--disable', action='store_false', dest='enabled',
3232
help='Deactivate CHECK line generation from this point forward')
33-
parser.add_argument('--replace-function-regex', nargs='+', default=[],
34-
help='List of regular expressions to replace matching function names')
3533
args = parser.parse_args()
3634
global _verbose
3735
_verbose = args.verbose
@@ -277,8 +275,6 @@ def __init__(self, run_list, flags, scrubber_args):
277275
self._record_args = flags.function_signature
278276
self._check_attributes = flags.check_attributes
279277
self._scrubber_args = scrubber_args
280-
# Strip double-quotes if input was read by UTC_ARGS
281-
self._replace_function_regex = list(map(lambda x: x.strip('"'), flags.replace_function_regex))
282278
self._func_dict = {}
283279
self._func_order = {}
284280
self._global_var_dict = {}
@@ -352,30 +348,6 @@ def process_run_line(self, function_re, scrubber, raw_tool_output, prefixes):
352348
self._func_dict[prefix][func] = None
353349
continue
354350

355-
# Replace function names matching the regex.
356-
for regex in self._replace_function_regex:
357-
# Pattern that matches capture groups in the regex in leftmost order.
358-
group_regex = re.compile('\(.*?\)')
359-
# Replace function name with regex.
360-
match = re.match(regex, func)
361-
if match:
362-
func_repl = regex
363-
# Replace any capture groups with their matched strings.
364-
for g in match.groups():
365-
func_repl = group_regex.sub(g, func_repl, count=1)
366-
func = '{{' + func_repl + '}}'
367-
368-
# Replace all calls to regex matching functions.
369-
matches = re.finditer(regex, scrubbed_body)
370-
for match in matches:
371-
func_repl = regex
372-
# Replace any capture groups with their matched strings.
373-
for g in match.groups():
374-
func_repl = group_regex.sub(g, func_repl, count=1)
375-
# Substitute function call names that match the regex with the same
376-
# capture groups set.
377-
scrubbed_body = re.sub(func_repl, '{{' + func_repl + '}}', scrubbed_body)
378-
379351
self._func_dict[prefix][func] = function_body(
380352
scrubbed_body, scrubbed_extra, args_and_sig, attrs)
381353
self._func_order[prefix].append(func)
@@ -822,8 +794,6 @@ def get_autogennote_suffix(parser, args):
822794
continue # Don't add default values
823795
autogenerated_note_args += action.option_strings[0] + ' '
824796
if action.const is None: # action takes a parameter
825-
if action.nargs == '+':
826-
value = ' '.join(map(lambda v: '"' + v.strip('"') + '"', value))
827797
autogenerated_note_args += '%s ' % value
828798
if autogenerated_note_args:
829799
autogenerated_note_args = ' %s %s' % (UTC_ARGS_KEY, autogenerated_note_args[:-1])

llvm/utils/update_llc_test_checks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ def main():
109109
flags=type('', (object,), {
110110
'verbose': ti.args.verbose,
111111
'function_signature': False,
112-
'check_attributes': False,
113-
'replace_function_regex': []}),
112+
'check_attributes': False}),
114113
scrubber_args=[ti.args])
115114

116115
for prefixes, llc_args, triple_in_cmd, march_in_cmd in run_list:

0 commit comments

Comments
 (0)