llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-tools-extra

Author: Daan De Meyer (DaanDeMeyer)

<details>
<summary>Changes</summary>

When integrating clang-include-cleaner into a test suite, it's useful to have 
it exit with a nonzero exit status when there are suggested changes to includes 
so let's add --fail-on-changes to make that possible.

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


1 Files Affected:

- (modified) clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp (+6-1) 


``````````diff
diff --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp 
b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
index 372ab5fa2706e..47e1400d8ccb2 100644
--- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -115,6 +115,11 @@ cl::opt<bool> DisableRemove{
     cl::init(false),
     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),
+};
 
 std::atomic<unsigned> Errors = ATOMIC_VAR_INIT(0);
 
@@ -410,5 +415,5 @@ int main(int argc, const char **argv) {
       }
     }
   }
-  return ErrorCode || Errors != 0;
+  return ErrorCode || Errors != 0 || (FailOnChanges && 
Factory.editedFiles().size() != 0);
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/140123
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to