[clang-tools-extra] [include-cleaner] rename enabled flags to `disable-*` (PR #132991)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 25 13:58:57 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Mohamed Emad (hulxv)
<details>
<summary>Changes</summary>
Closes #<!-- -->132983
---
Full diff: https://github.com/llvm/llvm-project/pull/132991.diff
2 Files Affected:
- (modified) clang-tools-extra/include-cleaner/test/tool.cpp (+2-2)
- (modified) clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp (+10-10)
``````````diff
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));
``````````
</details>
https://github.com/llvm/llvm-project/pull/132991
More information about the cfe-commits
mailing list