https://github.com/hulxv created https://github.com/llvm/llvm-project/pull/132991
Closes #132983 >From c476948593a80ed31765cdd711a626e4e03930ab Mon Sep 17 00:00:00 2001 From: hulxv <hul...@gmail.com> Date: Tue, 25 Mar 2025 22:56:51 +0200 Subject: [PATCH] [include-cleaner] rename enabled flags to `disable-*` --- .../include-cleaner/test/tool.cpp | 4 ++-- .../include-cleaner/tool/IncludeCleaner.cpp | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/clang-tools-extra/include-cleaner/test/tool.cpp b/clang-tools-extra/include-cleaner/test/tool.cpp index d72d2317ce2b1..8b723a5bf40e2 100644 --- a/clang-tools-extra/include-cleaner/test/tool.cpp +++ b/clang-tools-extra/include-cleaner/test/tool.cpp @@ -6,11 +6,11 @@ int x = foo(); // CHANGE: - "foobar.h" // CHANGE-NEXT: + "foo.h" -// RUN: clang-include-cleaner -remove=0 -print=changes %s -- -I%S/Inputs/ | FileCheck --check-prefix=INSERT %s +// RUN: clang-include-cleaner -disable-remove -print=changes %s -- -I%S/Inputs/ | FileCheck --check-prefix=INSERT %s // INSERT-NOT: - "foobar.h" // INSERT: + "foo.h" -// RUN: clang-include-cleaner -insert=0 -print=changes %s -- -I%S/Inputs/ | FileCheck --check-prefix=REMOVE %s +// RUN: clang-include-cleaner -disable-insert -print=changes %s -- -I%S/Inputs/ | FileCheck --check-prefix=REMOVE %s // REMOVE: - "foobar.h" // REMOVE-NOT: + "foo.h" diff --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp index 1d9458ffc4d32..472611073f732 100644 --- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp +++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp @@ -91,16 +91,16 @@ cl::opt<bool> Edit{ cl::cat(IncludeCleaner), }; -cl::opt<bool> Insert{ - "insert", - cl::desc("Allow header insertions"), - cl::init(true), +cl::opt<bool> DisableInsert{ + "disable-insert", + cl::desc("DIsable header insertions"), + cl::init(false), cl::cat(IncludeCleaner), }; -cl::opt<bool> Remove{ - "remove", - cl::desc("Allow header removals"), - cl::init(true), +cl::opt<bool> DisableRemove{ + "disable-remove", + cl::desc("Disable header removals"), + cl::init(false), cl::cat(IncludeCleaner), }; @@ -183,9 +183,9 @@ class Action : public clang::ASTFrontendAction { auto Results = analyze(AST.Roots, PP.MacroReferences, PP.Includes, &PI, getCompilerInstance().getPreprocessor(), HeaderFilter); - if (!Insert) + if (DisableInsert) Results.Missing.clear(); - if (!Remove) + if (DisableRemove) Results.Unused.clear(); std::string Final = fixIncludes(Results, AbsPath, Code, getStyle(AbsPath)); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits