[clang-tools-extra] [clang-tidy][misc-include-cleaner]Avoid to insert same include header multiple times (PR #65431)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 6 00:27:49 PDT 2023


================
@@ -199,6 +200,9 @@ void IncludeCleanerCheck::check(const MatchFinder::MatchResult &Result) {
 
   tooling::HeaderIncludes HeaderIncludes(getCurrentMainFile(), Code,
                                          FileStyle->IncludeStyle);
+  // `tooling::HeaderIncludes::insert` will not modify `ExistingIncludes`. We
+  // should handle repeat include here
----------------
kadircet wrote:

```suggestion
  // Deduplicate insertions when running in bulk fix mode.
```

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


More information about the cfe-commits mailing list