diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2015-10-06 19:11:12 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2015-10-06 19:11:12 +0000 |
commit | 017bfee4560ccd5d9b9f65f5756be6f45f32252e (patch) | |
tree | 19b727b230c234b45d572738c139cd5f231e19b6 | |
parent | ef4be6b4fedc87a08de9b95f912c3048960a43d6 (diff) | |
download | llvm-017bfee4560ccd5d9b9f65f5756be6f45f32252e.zip llvm-017bfee4560ccd5d9b9f65f5756be6f45f32252e.tar.gz llvm-017bfee4560ccd5d9b9f65f5756be6f45f32252e.tar.bz2 |
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.
llvm-svn: 249444
-rwxr-xr-x | clang-tools-extra/clang-tidy/add_new_check.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang-tools-extra/clang-tidy/add_new_check.py b/clang-tools-extra/clang-tidy/add_new_check.py index 6de707d..654f77b 100755 --- a/clang-tools-extra/clang-tidy/add_new_check.py +++ b/clang-tools-extra/clang-tidy/add_new_check.py @@ -29,7 +29,7 @@ def adapt_cmake(module_path, check_name_camel): 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, check_name, check_name_camel): 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, check_name, check_name_camel): 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, check_name): 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, check_name): 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 |