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 @@ -36,7 +36,6 @@ #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/GenericUniformityImpl.h" #include "llvm/ADT/STLExtras.h" -#include "llvm/ADT/STLFunctionalExtras.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" @@ -55,10 +54,6 @@ #include namespace clang::clangd { - -static bool AnalyzeStdlib = false; -void setIncludeCleanerAnalyzesStdlib(bool B) { AnalyzeStdlib = B; } - namespace { bool isIgnored(llvm::StringRef HeaderPath, HeaderFilter IgnoreHeaders) { @@ -78,11 +73,8 @@ // FIXME(kirillbobyrev): We currently do not support the umbrella headers. // System headers are likely to be standard library headers. // Until we have good support for umbrella headers, don't warn about them. - if (Inc.Written.front() == '<') { - if (AnalyzeStdlib && tooling::stdlib::Header::named(Inc.Written)) - return true; - return false; - } + if (Inc.Written.front() == '<') + return tooling::stdlib::Header::named(Inc.Written).has_value(); assert(Inc.HeaderID); auto HID = static_cast(*Inc.HeaderID); auto FE = AST.getSourceManager().getFileManager().getFileRef( diff --git a/clang-tools-extra/clangd/tool/ClangdMain.cpp b/clang-tools-extra/clangd/tool/ClangdMain.cpp --- a/clang-tools-extra/clangd/tool/ClangdMain.cpp +++ b/clang-tools-extra/clangd/tool/ClangdMain.cpp @@ -273,15 +273,6 @@ init(CodeCompleteOptions().ImportInsertions), }; -opt IncludeCleanerStdlib{ - "include-cleaner-stdlib", - cat(Features), - desc("Apply include-cleaner analysis to standard library headers " - "(immature!)"), - init(false), - Hidden, -}; - opt HeaderInsertionDecorators{ "header-insertion-decorators", cat(Features), @@ -317,7 +308,7 @@ RetiredFlag ClangTidyChecks("clang-tidy-checks"); RetiredFlag InlayHints("inlay-hints"); RetiredFlag FoldingRanges("folding-ranges"); - +RetiredFlag IncludeCleanerStdlib("include-cleaner-stdlib"); opt LimitResults{ "limit-results", @@ -968,7 +959,6 @@ }; if (ForceOffsetEncoding != OffsetEncoding::UnsupportedEncoding) Opts.Encoding = ForceOffsetEncoding; - setIncludeCleanerAnalyzesStdlib(IncludeCleanerStdlib); if (CheckFile.getNumOccurrences()) { llvm::SmallString<256> Path; 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 @@ -73,10 +73,6 @@ } TEST(IncludeCleaner, StdlibUnused) { - setIncludeCleanerAnalyzesStdlib(true); - auto Cleanup = - llvm::make_scope_exit([] { setIncludeCleanerAnalyzesStdlib(false); }); - auto TU = TestTU::withCode(R"cpp( #include #include