[clang-tools-extra] r173919 - Don't touch unchanged file for in-place edit.
Daniel Jasper
djasper at google.com
Wed Jan 30 01:52:38 PST 2013
Author: djasper
Date: Wed Jan 30 03:52:38 2013
New Revision: 173919
URL: http://llvm.org/viewvc/llvm-project?rev=173919&view=rev
Log:
Don't touch unchanged file for in-place edit.
This fixes llvm.org/PR15087.
Modified:
clang-tools-extra/trunk/clang-format/ClangFormat.cpp
Modified: clang-tools-extra/trunk/clang-format/ClangFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-format/ClangFormat.cpp?rev=173919&r1=173918&r2=173919&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-format/ClangFormat.cpp (original)
+++ clang-tools-extra/trunk/clang-format/ClangFormat.cpp Wed Jan 30 03:52:38 2013
@@ -97,6 +97,9 @@ static void format() {
Rewriter Rewrite(Sources, LangOptions());
tooling::applyAllReplacements(Replaces, Rewrite);
if (Inplace) {
+ if (Replaces.size() == 0)
+ return; // Nothing changed, don't touch the file.
+
std::string ErrorInfo;
llvm::raw_fd_ostream FileStream(FileName.c_str(), ErrorInfo,
llvm::raw_fd_ostream::F_Binary);
More information about the cfe-commits
mailing list