[PATCH] D145773: [clangd] UnusedIncludes: Strict config now uses the include-cleaner-library implementation.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 10 01:50:22 PST 2023


kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/ConfigCompile.cpp:438
+                         .map("Experiment",
+                              Config::IncludesPolicy::Strict) // for backward
+                                                              // compatibility
----------------
i think we should at least be emitting a diagnostics to encourage people for moving back to strict, so what about something like:
```
if (F.UnusuedIncludes) {
  auto Val = compileEnum....; // only for Strict and None
  if (!Val && **F.UnusedIncludes == "Experiment") {
       diag(Warning, "Experiment is deprecated for UnusedIncludes, use Strict instead.", F.UnusedIncludes.Range);
       Val = Config::IncludesPolicy::Strict;
  }
}
```


================
Comment at: clang-tools-extra/clangd/IncludeCleaner.cpp:769
-      Cfg.Diagnostics.UnusedIncludes == Config::IncludesPolicy::Strict
-          ? computeUnusedIncludes(AST)
-          : Findings.UnusedIncludes,
----------------
can you also delete `computeUnusedIncludes` and its friends (also from the tests)?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D145773/new/

https://reviews.llvm.org/D145773



More information about the cfe-commits mailing list