[llvm] r290716 - Correctly handle multi-lined RUN lines.

Bryant Wong via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 29 11:32:35 PST 2016


Author: bryant
Date: Thu Dec 29 13:32:34 2016
New Revision: 290716

URL: http://llvm.org/viewvc/llvm-project?rev=290716&view=rev
Log:
Correctly handle multi-lined RUN lines.

`utils/update_{llc_test,test}_checks` ought to be able to handle RUN commands
that span multiple lines, as shown in the example at
http://llvm.org/docs/CommandGuide/FileCheck.html#the-filecheck-check-prefix-option

Differential Revision: https://reviews.llvm.org/D26523

Modified:
    llvm/trunk/utils/update_llc_test_checks.py
    llvm/trunk/utils/update_test_checks.py

Modified: llvm/trunk/utils/update_llc_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_llc_test_checks.py?rev=290716&r1=290715&r2=290716&view=diff
==============================================================================
--- llvm/trunk/utils/update_llc_test_checks.py (original)
+++ llvm/trunk/utils/update_llc_test_checks.py Thu Dec 29 13:32:34 2016
@@ -222,8 +222,15 @@ def main():
         triple_in_ir = m.groups()[0]
         break
 
-    run_lines = [m.group(1)
+    raw_lines = [m.group(1)
                  for m in [RUN_LINE_RE.match(l) for l in input_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
+        else:
+            run_lines.append(l)
+
     if args.verbose:
       print >>sys.stderr, 'Found %d RUN lines:' % (len(run_lines),)
       for l in run_lines:

Modified: llvm/trunk/utils/update_test_checks.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/update_test_checks.py?rev=290716&r1=290715&r2=290716&view=diff
==============================================================================
--- llvm/trunk/utils/update_test_checks.py (original)
+++ llvm/trunk/utils/update_test_checks.py Thu Dec 29 13:32:34 2016
@@ -292,8 +292,15 @@ def main():
     with open(test) as f:
       input_lines = [l.rstrip() for l in f]
 
-    run_lines = [m.group(1)
+    raw_lines = [m.group(1)
                  for m in [RUN_LINE_RE.match(l) for l in input_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
+        else:
+            run_lines.append(l)
+
     if args.verbose:
       print >>sys.stderr, 'Found %d RUN lines:' % (len(run_lines),)
       for l in run_lines:




More information about the llvm-commits mailing list