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

llvm-svn: 236592
This commit is contained in:
Daniel Jasper 2015-05-06 11:56:54 +00:00
parent 20e0af6b62
commit fc510b67fe
1 changed files with 3 additions and 1 deletions

View File

@ -247,7 +247,9 @@ static bool format(StringRef FileName) {
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)