summaryrefslogtreecommitdiffstats
path: root/tools/clang-format/ClangFormat.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-10-08 15:54:36 +0000
committerDaniel Jasper <djasper@google.com>2013-10-08 15:54:36 +0000
commitf7d9e63858138134953e713f948b20a8b8c9a872 (patch)
tree4fb940d37c35390fbb2f9ba0ca145271f7852557 /tools/clang-format/ClangFormat.cpp
parentd69f37b5822420e3c3a1b2e875b122aca8248533 (diff)
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
Diffstat (limited to 'tools/clang-format/ClangFormat.cpp')
-rw-r--r--tools/clang-format/ClangFormat.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/clang-format/ClangFormat.cpp b/tools/clang-format/ClangFormat.cpp
index e08aa2d5b8..2ca2bed61a 100644
--- a/tools/clang-format/ClangFormat.cpp
+++ b/tools/clang-format/ClangFormat.cpp
@@ -186,7 +186,7 @@ static bool format(std::string FileName) {
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))