[cfe-commits] [clang-tools-extra] r171480 - /clang-tools-extra/trunk/clang-format/clang-format.py

Daniel Jasper djasper at google.com
Fri Jan 4 10:24:13 PST 2013


Author: djasper
Date: Fri Jan  4 12:24:12 2013
New Revision: 171480

URL: http://llvm.org/viewvc/llvm-project?rev=171480&view=rev
Log:
Handle segfaults in clang-format vim-integration.

A segfault used to clear the entire buffer. With this change, a message
to report a bug is displayed instead.

This should solve most cases similar to llvm.org/PR14774.

Modified:
    clang-tools-extra/trunk/clang-format/clang-format.py

Modified: clang-tools-extra/trunk/clang-format/clang-format.py
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-format/clang-format.py?rev=171480&r1=171479&r2=171480&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-format/clang-format.py (original)
+++ clang-tools-extra/trunk/clang-format/clang-format.py Fri Jan  4 12:24:12 2013
@@ -43,7 +43,9 @@
 if stderr:
   print stderr
 else:
-  if stdout != text:
+  if not stdout:
+    print 'Segfault occurred. Please report to bugs.llvm.org.'
+  elif stdout != text:
     lines = stdout.split('\n')
     for i in range(min(len(buf), len(lines))):
       buf[i] = lines[i]





More information about the cfe-commits mailing list