clang-format: Don't exit with failure on empty files.
Also let clang-format-diff.py detect errors based on clang-format's
return code. Otherwise messages like "Can't find usable .clang-format,
falling back to LLVM style" can make it fail, which might be undesired.
Patch by Alp Toker. Thank you!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@192184 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-format/clang-format-diff.py b/tools/clang-format/clang-format-diff.py
index 90723d2..ca949b8 100755
--- a/tools/clang-format/clang-format-diff.py
+++ b/tools/clang-format/clang-format-diff.py
@@ -81,7 +81,8 @@
stdout, stderr = p.communicate()
if stderr:
print stderr
- return
+ if p.returncode != 0:
+ sys.exit(p.returncode);
if __name__ == '__main__':