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: svn://svn.chromium.org/llvm-project/cfe/trunk/tools/clang-format@192184 0b72dbe1-c17f-4bc7-b9db-2b4152be0356
diff --git a/ClangFormat.cpp b/ClangFormat.cpp
index e08aa2d..2ca2bed 100644
--- a/ClangFormat.cpp
+++ b/ClangFormat.cpp
@@ -186,7 +186,7 @@
return true;
}
if (Code->getBufferSize() == 0)
- return true; // Empty files are formatted correctly.
+ return false; // Empty files are formatted correctly.
FileID ID = createInMemoryFile(FileName, Code.get(), Sources, Files);
std::vector<CharSourceRange> Ranges;
if (fillRanges(Sources, ID, Code.get(), Ranges))