[clang-tools-extra] [include-cleaner] Add --fail-on-changes option (PR #140123)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 15 12:11:26 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
index 47e1400d8..601e66b8a 100644
--- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -116,9 +116,9 @@ cl::opt<bool> DisableRemove{
     cl::cat(IncludeCleaner),
 };
 cl::opt<bool> FailOnChanges{
-   "fail-on-changes",
-   cl::desc("Exit with a non-zero exit code if changes are suggested"),
-   cl::cat(IncludeCleaner),
+    "fail-on-changes",
+    cl::desc("Exit with a non-zero exit code if changes are suggested"),
+    cl::cat(IncludeCleaner),
 };
 
 std::atomic<unsigned> Errors = ATOMIC_VAR_INIT(0);
@@ -415,5 +415,6 @@ int main(int argc, const char **argv) {
       }
     }
   }
-  return ErrorCode || Errors != 0 || (FailOnChanges && Factory.editedFiles().size() != 0);
+  return ErrorCode || Errors != 0 ||
+         (FailOnChanges && Factory.editedFiles().size() != 0);
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/140123


More information about the cfe-commits mailing list