This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG86278114085b: [clang-format] Support new file formatting with vim (authored by jsji).
Changed prior to commit: https://reviews.llvm.org/D138234?vs=476905&id=476984#toc Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D138234/new/ https://reviews.llvm.org/D138234 Files: clang/tools/clang-format/clang-format.py Index: clang/tools/clang-format/clang-format.py =================================================================== --- clang/tools/clang-format/clang-format.py +++ clang/tools/clang-format/clang-format.py @@ -41,6 +41,7 @@ import difflib import json +import os.path import platform import subprocess import sys @@ -76,7 +77,8 @@ # Determine range to format. if vim.eval('exists("l:lines")') == '1': lines = ['-lines', vim.eval('l:lines')] - elif vim.eval('exists("l:formatdiff")') == '1': + elif vim.eval('exists("l:formatdiff")') == '1' and \ + os.path.exists(vim.current.buffer.name): with open(vim.current.buffer.name, 'r') as f: ondisk = f.read().splitlines(); sequence = difflib.SequenceMatcher(None, ondisk, vim.current.buffer)
Index: clang/tools/clang-format/clang-format.py =================================================================== --- clang/tools/clang-format/clang-format.py +++ clang/tools/clang-format/clang-format.py @@ -41,6 +41,7 @@ import difflib import json +import os.path import platform import subprocess import sys @@ -76,7 +77,8 @@ # Determine range to format. if vim.eval('exists("l:lines")') == '1': lines = ['-lines', vim.eval('l:lines')] - elif vim.eval('exists("l:formatdiff")') == '1': + elif vim.eval('exists("l:formatdiff")') == '1' and \ + os.path.exists(vim.current.buffer.name): with open(vim.current.buffer.name, 'r') as f: ondisk = f.read().splitlines(); sequence = difflib.SequenceMatcher(None, ondisk, vim.current.buffer)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits