[clang-tools-extra] 59e4a67 - [clangd] Move IncludeCleaner tracer to the actual computation

Kirill Bobyrev via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 25 04:20:03 PST 2021


Author: Kirill Bobyrev
Date: 2021-11-25T13:19:01+01:00
New Revision: 59e4a6708152b42a55653bd8a44a6e0781fd4caf

URL: https://github.com/llvm/llvm-project/commit/59e4a6708152b42a55653bd8a44a6e0781fd4caf
DIFF: https://github.com/llvm/llvm-project/commit/59e4a6708152b42a55653bd8a44a6e0781fd4caf.diff

LOG: [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.

Added: 
    

Modified: 
    clang-tools-extra/clangd/IncludeCleaner.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/IncludeCleaner.cpp b/clang-tools-extra/clangd/IncludeCleaner.cpp
index b9267ff71120..a0b9e303e3bf 100644
--- a/clang-tools-extra/clangd/IncludeCleaner.cpp
+++ b/clang-tools-extra/clangd/IncludeCleaner.cpp
@@ -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()


        


More information about the cfe-commits mailing list