aboutsummaryrefslogtreecommitdiff
path: root/clang/tools/clang-format/clang-format.py
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2016-10-27 13:46:49 +0000
committerAlexander Kornienko <alexfh@google.com>2016-10-27 13:46:49 +0000
commit179e803abd0f3232f01b1523e16c68c096f3f71a (patch)
tree8543720927fd42b28c9ca1cf7b4504a584e120e3 /clang/tools/clang-format/clang-format.py
parenta8631e3887698583e5bd0f118921571dd92757b1 (diff)
downloadllvm-179e803abd0f3232f01b1523e16c68c096f3f71a.zip
llvm-179e803abd0f3232f01b1523e16c68c096f3f71a.tar.gz
llvm-179e803abd0f3232f01b1523e16c68c096f3f71a.tar.bz2
Fix warnings from python difflib.
llvm-svn: 285291
Diffstat (limited to 'clang/tools/clang-format/clang-format.py')
-rw-r--r--clang/tools/clang-format/clang-format.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/tools/clang-format/clang-format.py b/clang/tools/clang-format/clang-format.py
index 6a57406..5a5f99b 100644
--- a/clang/tools/clang-format/clang-format.py
+++ b/clang/tools/clang-format/clang-format.py
@@ -51,8 +51,8 @@ if vim.eval('exists("g:clang_format_fallback_style")') == "1":
def main():
# Get the current text.
encoding = vim.eval("&encoding")
- buf = vim.current.buffer
- text = unicode('\n'.join(buf), encoding)
+ buf = [ unicode(line, encoding) for line in vim.current.buffer ]
+ text = '\n'.join(buf)
# Determine range to format.
if vim.eval('exists("l:lines")') == '1':
@@ -99,7 +99,7 @@ def main():
lines = stdout.decode(encoding).split('\n')
output = json.loads(lines[0])
lines = lines[1:]
- sequence = difflib.SequenceMatcher(None, vim.current.buffer, lines)
+ sequence = difflib.SequenceMatcher(None, buf, lines)
for op in reversed(sequence.get_opcodes()):
if op[0] is not 'equal':
vim.current.buffer[op[1]:op[2]] = lines[op[3]:op[4]]