[clang-tools-extra] e339b07 - [include-cleaner] No need to overwrite the source file if there is no

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 22 05:37:20 PDT 2023


Author: Haojian Wu
Date: 2023-06-22T14:37:11+02:00
New Revision: e339b07944799ebd1692e8f7019690fe14a33257

URL: https://github.com/llvm/llvm-project/commit/e339b07944799ebd1692e8f7019690fe14a33257
DIFF: https://github.com/llvm/llvm-project/commit/e339b07944799ebd1692e8f7019690fe14a33257.diff

LOG: [include-cleaner] No need to overwrite the source file if there is no
cleanups

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
index 008da47164092..574023fda4968 100644
--- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -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;


        


More information about the cfe-commits mailing list