[clang-tools-extra] 0cb1476 - [clang-apply-replacements] Change cleanup to only happen with --format (#178763)

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 5 18:54:48 PST 2026


Author: Keith Smiley
Date: 2026-02-05T18:54:44-08:00
New Revision: 0cb14760da3da9abff861f36507450999525e43d

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

LOG: [clang-apply-replacements] Change cleanup to only happen with --format (#178763)

Cleanup can result in many unrelated changes to the given replacements.
This change makes that only apply if the user actually wants
clang-apply-replacements to format their code outside of the
replacements.

Added: 
    

Modified: 
    clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
index 76de8bd877d03..83e47d09f5b53 100644
--- a/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
+++ b/clang-tools-extra/clang-apply-replacements/tool/ClangApplyReplacementsMain.cpp
@@ -139,7 +139,7 @@ int main(int argc, char **argv) {
     return 1;
 
   tooling::ApplyChangesSpec Spec;
-  Spec.Cleanup = true;
+  Spec.Cleanup = DoFormat;
   Spec.Format = DoFormat ? tooling::ApplyChangesSpec::kAll
                          : tooling::ApplyChangesSpec::kNone;
   Spec.Style = DoFormat ? FormatStyle : format::getNoStyle();


        


More information about the cfe-commits mailing list