[llvm] update_test_checks: keep meta variables stable by default (PR #76748)
Jannik Silvanus via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 10 07:51:29 PST 2024
Nicolai =?utf-8?q?Hähnle?= <nicolai.haehnle at amd.com>,
Nicolai =?utf-8?q?Hähnle?= <nicolai.haehnle at amd.com>,
Nicolai =?utf-8?q?Hähnle?= <nicolai.haehnle at amd.com>,
Nicolai =?utf-8?q?Hähnle?= <nicolai.haehnle at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/76748 at github.com>
================
@@ -410,6 +412,42 @@ def should_add_line_to_output(
return True
+def collect_original_check_lines(original_check_lines, ti: TestInfo, prefix_set: set):
+ """
+ Collect pre-existing check lines in a the dictionary original_check_lines.
+ original_check_lines[func_name][prefix] is filled with a list of
+ right-hand-sides of check lines.
+ """
+ in_function_start = None
+ for input_line_info in ti.ro_iterlines():
+ input_line = input_line_info.line
+ if in_function_start is not None:
+ if input_line == "":
+ continue
+ if input_line.lstrip().startswith(";"):
+ m = CHECK_RE.match(input_line)
+ if (
+ m is not None
+ and m.group(1) in prefix_set
+ and m.group(2) not in ["LABEL", "SAME"]
+ ):
+ if m.group(1) not in in_function_start:
+ in_function_start[m.group(1)] = []
+ in_function_start[m.group(1)].append(
+ input_line[m.span()[1] :].strip()
----------------
jasilvanus wrote:
`m.span()[0]` is `m.start()`, and `m.span()[1]` is `m.end()`. I find these more expressive. Same on the many other similar uses of `m.span()[i]`.
https://github.com/llvm/llvm-project/pull/76748
More information about the llvm-commits
mailing list