================
@@ -672,12 +673,32 @@ def debug(*args, **kwargs):
def find_run_lines(test, lines):
debug("Scanning for RUN lines in test file:", test)
- raw_lines = [m.group(1) for m in [RUN_LINE_RE.match(l) for l in lines] if
m]
- run_lines = [raw_lines[0]] if len(raw_lines) > 0 else []
- for l in raw_lines[1:]:
- if run_lines[-1].endswith("\\"):
- run_lines[-1] = run_lines[-1].rstrip("\\") + " " + l
+ # Collect run and (re)define lines.
+ directives = []
+ for l in lines:
+ m = RUN_LINE_RE.match(l) or DEFINE_LINE_RE.match(l)
+ if not m:
+ continue
+ is_define = m.re is DEFINE_LINE_RE
+ if (
+ directives
+ and directives[-1][0] == is_define
+ and directives[-1][1].endswith("\\")
+ ):
+ directives[-1][1] = directives[-1][1].rstrip("\\") + " " +
m.group(1)
+ else:
+ directives.append([is_define, m.group(1)])
+
+ # Substitute into run lines.
+ substitutions = {}
----------------
MacDue wrote:
Maybe just use an `OrderedDict` if you depend on the order? Though I don't
think your current test shows this.
https://github.com/llvm/llvm-project/pull/237599
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits