clang-format: Don't allow -i when reading from stdin.

git-svn-id: svn://svn.chromium.org/llvm-project/cfe/trunk/tools/clang-format@236592 0b72dbe1-c17f-4bc7-b9db-2b4152be0356
diff --git a/ClangFormat.cpp b/ClangFormat.cpp
index f611f70..fe7d678 100644
--- a/ClangFormat.cpp
+++ b/ClangFormat.cpp
@@ -247,7 +247,9 @@
     Rewriter Rewrite(Sources, LangOptions());
     tooling::applyAllReplacements(Replaces, Rewrite);
     if (Inplace) {
-      if (Rewrite.overwriteChangedFiles())
+      if (FileName == "-")
+        llvm::errs() << "error: cannot use -i when reading from stdin.\n";
+      else if (Rewrite.overwriteChangedFiles())
         return true;
     } else {
       if (Cursor.getNumOccurrences() != 0)