[llvm] r258987 - [utils] Add windows support to update_llc_test_checks.py

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 27 13:13:19 PST 2016


Author: rksimon
Date: Wed Jan 27 15:13:18 2016
New Revision: 258987

URL: http://llvm.org/viewvc/llvm-project?rev=258987&view=rev
Log:
[utils] Add windows support to update_llc_test_checks.py

Strip dos line endings from llc generated files to allow the regex patterns to match them.

Ensure updated *.ll files are generated with unix style line endings.

Modified:
    llvm/trunk/utils/update_llc_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=258987&r1=258986&r2=258987&view=diff
==============================================================================
--- llvm/trunk/utils/update_llc_test_checks.py (original)
+++ llvm/trunk/utils/update_llc_test_checks.py Wed Jan 27 15:13:18 2016
@@ -20,6 +20,8 @@ def llc(args, cmd_args, ir):
   with open(ir) as ir_file:
     stdout = subprocess.check_output(args.llc_binary + ' ' + cmd_args,
                                      shell=True, stdin=ir_file)
+  # Fix line endings to unix CR style.
+  stdout = stdout.replace('\r\n', '\n')
   return stdout
 
 
@@ -211,7 +213,7 @@ def main():
     if args.verbose:
       print>>sys.stderr, 'Writing %d fixed lines to %s...' % (
           len(fixed_lines), test)
-    with open(test, 'w') as f:
+    with open(test, 'wb') as f:
       f.writelines([l + '\n' for l in fixed_lines])
 
 




More information about the llvm-commits mailing list