]> granicus.if.org Git - clang/commitdiff
Make vim also output a helpful message in some error cases.
authorManuel Klimek <klimek@google.com>
Tue, 2 Jun 2015 12:01:50 +0000 (12:01 +0000)
committerManuel Klimek <klimek@google.com>
Tue, 2 Jun 2015 12:01:50 +0000 (12:01 +0000)
When clang-format encounters a syntax error, it will not format that
line; we're now using the same mechanism we're already using in emacs to
show a helpful error message to the user.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238823 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-format/clang-format.py

index 56a6e5d86bf43421dbd5d155851e27b1f5e6781e..baa6cdffbe3671b7969a6a4035eb4c00c9d00fd1 100644 (file)
@@ -85,6 +85,8 @@ def main():
     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]]
+    if output['IncompleteFormat']:
+      print 'clang-format: incomplete (syntax errors)'
     vim.command('goto %d' % (output['Cursor'] + 1))
 
 main()