[clangd] Move IncludeCleaner tracer to the actual computation

This way we won't get results with 0 ms for all the users with disabled
IncludeCleaner.
This commit is contained in:
Kirill Bobyrev 2021-11-25 13:19:01 +01:00
parent c2fe2b5a63
commit 59e4a67081
No known key found for this signature in database
GPG Key ID: 2307C055C8384FA0
1 changed files with 1 additions and 1 deletions

View File

@ -317,12 +317,12 @@ std::vector<const Inclusion *> computeUnusedIncludes(ParsedAST &AST) {
std::vector<Diag> issueUnusedIncludesDiagnostics(ParsedAST &AST,
llvm::StringRef Code) {
trace::Span Tracer("IncludeCleaner::issueUnusedIncludesDiagnostics");
const Config &Cfg = Config::current();
if (Cfg.Diagnostics.UnusedIncludes != Config::UnusedIncludesPolicy::Strict ||
Cfg.Diagnostics.SuppressAll ||
Cfg.Diagnostics.Suppress.contains("unused-includes"))
return {};
trace::Span Tracer("IncludeCleaner::issueUnusedIncludesDiagnostics");
std::vector<Diag> Result;
std::string FileName =
AST.getSourceManager()