[PATCH] D63697: clang-format: Fix error return when using inplace with stdin

William Woodruff via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 23 18:48:01 PDT 2019


woodruffw created this revision.
woodruffw added reviewers: clang, thakis.
woodruffw added a project: clang.
Herald added a subscriber: cfe-commits.

Causes clang-format to exit with an appropriate error code
when the invalid combination of -i and stdin is provided.


Repository:
  rC Clang

https://reviews.llvm.org/D63697

Files:
  tools/clang-format/ClangFormat.cpp


Index: tools/clang-format/ClangFormat.cpp
===================================================================
--- tools/clang-format/ClangFormat.cpp
+++ tools/clang-format/ClangFormat.cpp
@@ -243,7 +243,7 @@
 static bool format(StringRef FileName) {
   if (!OutputXML && Inplace && FileName == "-") {
     errs() << "error: cannot use -i when reading from stdin.\n";
-    return false;
+    return true;
   }
   // On Windows, overwriting a file with an open file mapping doesn't work,
   // so read the whole file into memory when formatting in-place.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63697.206149.patch
Type: text/x-patch
Size: 553 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190624/ff382f66/attachment.bin>


More information about the cfe-commits mailing list