[include-cleaner] No need to overwrite the source file if there is no
authorHaojian Wu <hokein.wu@gmail.com>
Thu, 22 Jun 2023 12:35:28 +0000 (14:35 +0200)
committerHaojian Wu <hokein.wu@gmail.com>
Thu, 22 Jun 2023 12:37:11 +0000 (14:37 +0200)
cleanups

clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp

index 008da47..574023f 100644 (file)
@@ -148,7 +148,7 @@ class Action : public clang::ASTFrontendAction {
       }
     }
 
-    if (Edit) {
+    if (Edit && (!Results.Missing.empty() || !Results.Unused.empty())) {
       if (auto Err = llvm::writeToOutput(
               Path, [&](llvm::raw_ostream &OS) -> llvm::Error {
                 OS << Final;