diff --git a/clang-tools-extra/clangd/Config.h b/clang-tools-extra/clangd/Config.h --- a/clang-tools-extra/clangd/Config.h +++ b/clang-tools-extra/clangd/Config.h @@ -92,9 +92,6 @@ /// Diagnose missing and unused includes. Strict, None, - /// The same as Strict, but using the include-cleaner library for - /// unused includes. - Experiment, }; /// Controls warnings and errors when parsing code. struct { diff --git a/clang-tools-extra/clangd/ConfigCompile.cpp b/clang-tools-extra/clangd/ConfigCompile.cpp --- a/clang-tools-extra/clangd/ConfigCompile.cpp +++ b/clang-tools-extra/clangd/ConfigCompile.cpp @@ -434,7 +434,9 @@ if (auto Val = compileEnum("UnusedIncludes", **F.UnusedIncludes) .map("Strict", Config::IncludesPolicy::Strict) - .map("Experiment", Config::IncludesPolicy::Experiment) + .map("Experiment", + Config::IncludesPolicy::Strict) // for backward + // compatibility .map("None", Config::IncludesPolicy::None) .value()) Out.Apply.push_back([Val](const Params &, Config &C) { diff --git a/clang-tools-extra/clangd/ConfigFragment.h b/clang-tools-extra/clangd/ConfigFragment.h --- a/clang-tools-extra/clangd/ConfigFragment.h +++ b/clang-tools-extra/clangd/ConfigFragment.h @@ -232,7 +232,6 @@ /// /// Valid values are: /// - Strict - /// - Experiment /// - None std::optional> UnusedIncludes; diff --git a/clang-tools-extra/clangd/IncludeCleaner.cpp b/clang-tools-extra/clangd/IncludeCleaner.cpp --- a/clang-tools-extra/clangd/IncludeCleaner.cpp +++ b/clang-tools-extra/clangd/IncludeCleaner.cpp @@ -758,17 +758,13 @@ const Config &Cfg = Config::current(); IncludeCleanerFindings Findings; if (Cfg.Diagnostics.MissingIncludes == Config::IncludesPolicy::Strict || - Cfg.Diagnostics.UnusedIncludes == Config::IncludesPolicy::Experiment) { + Cfg.Diagnostics.UnusedIncludes == Config::IncludesPolicy::Strict) { // will need include-cleaner results, call it once Findings = computeIncludeCleanerFindings(AST); } std::vector Result = generateUnusedIncludeDiagnostics( - AST.tuPath(), - Cfg.Diagnostics.UnusedIncludes == Config::IncludesPolicy::Strict - ? computeUnusedIncludes(AST) - : Findings.UnusedIncludes, - Code); + AST.tuPath(), Findings.UnusedIncludes, Code); llvm::move( generateMissingIncludeDiagnostics(AST, Findings.MissingIncludes, Code), std::back_inserter(Result)); diff --git a/clang-tools-extra/clangd/Preamble.cpp b/clang-tools-extra/clangd/Preamble.cpp --- a/clang-tools-extra/clangd/Preamble.cpp +++ b/clang-tools-extra/clangd/Preamble.cpp @@ -128,7 +128,7 @@ SourceMgr = &CI.getSourceManager(); Includes.collect(CI); if (Config::current().Diagnostics.UnusedIncludes == - Config::IncludesPolicy::Experiment || + Config::IncludesPolicy::Strict || Config::current().Diagnostics.MissingIncludes == Config::IncludesPolicy::Strict) Pragmas.record(CI); diff --git a/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp b/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp --- a/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp +++ b/clang-tools-extra/clangd/unittests/IncludeCleanerTests.cpp @@ -697,7 +697,7 @@ void foo() {} )cpp"); Config Cfg; - Cfg.Diagnostics.UnusedIncludes = Config::IncludesPolicy::Experiment; + Cfg.Diagnostics.UnusedIncludes = Config::IncludesPolicy::Strict; WithContextValue Ctx(Config::Key, std::move(Cfg)); ParsedAST AST = TU.build();