Author: aaronballman Date: Tue Oct 6 14:11:12 2015 New Revision: 249444 URL: http://llvm.org/viewvc/llvm-project?rev=249444&view=rev Log: Change the write modes to "binary" so that line endings do not get munged on Windows. Otherwise, when this script is run, all files created on Windows have CRLF instead of LF line endings.
Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py Modified: clang-tools-extra/trunk/clang-tidy/add_new_check.py URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/add_new_check.py?rev=249444&r1=249443&r2=249444&view=diff ============================================================================== --- clang-tools-extra/trunk/clang-tidy/add_new_check.py (original) +++ clang-tools-extra/trunk/clang-tidy/add_new_check.py Tue Oct 6 14:11:12 2015 @@ -29,7 +29,7 @@ def adapt_cmake(module_path, check_name_ return False print('Updating %s...' % filename) - with open(filename, 'w') as f: + with open(filename, 'wb') as f: cpp_found = False file_added = False for line in lines: @@ -49,7 +49,7 @@ def write_header(module_path, module, ch check_name_dashes = module + '-' + check_name filename = os.path.join(module_path, check_name_camel) + '.h' print('Creating %s...' % filename) - with open(filename, 'w') as f: + with open(filename, 'wb') as f: header_guard = ('LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_' + module.upper() + '_' + check_name.upper().replace('-', '_') + '_H') f.write('//===--- ') @@ -100,7 +100,7 @@ public: def write_implementation(module_path, check_name_camel): filename = os.path.join(module_path, check_name_camel) + '.cpp' print('Creating %s...' % filename) - with open(filename, 'w') as f: + with open(filename, 'wb') as f: f.write('//===--- ') f.write(os.path.basename(filename)) f.write(' - clang-tidy') @@ -153,7 +153,7 @@ def adapt_module(module_path, module, ch lines = f.readlines() print('Updating %s...' % filename) - with open(filename, 'w') as f: + with open(filename, 'wb') as f: header_added = False header_found = False check_added = False @@ -191,7 +191,7 @@ def write_test(module_path, module, chec os.path.join(module_path, '../../test/clang-tidy', check_name_dashes + '.cpp')) print('Creating %s...' % filename) - with open(filename, 'w') as f: + with open(filename, 'wb') as f: f.write( """// RUN: %%python %%S/check_clang_tidy.py %%s %(check_name_dashes)s %%t @@ -222,7 +222,7 @@ def update_checks_list(module_path): checks.sort() print('Updating %s...' % filename) - with open(filename, 'w') as f: + with open(filename, 'wb') as f: for line in lines: f.write(line) if line.startswith('.. toctree::'): @@ -236,7 +236,7 @@ def write_docs(module_path, module, chec os.path.join(module_path, '../../docs/clang-tidy/checks/', check_name_dashes + '.rst')) print('Creating %s...' % filename) - with open(filename, 'w') as f: + with open(filename, 'wb') as f: f.write( """%(check_name_dashes)s %(underline)s _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits