Author: Sam McCall Date: 2021-11-10T08:22:48+01:00 New Revision: 63667c1896e11a4b2c389c681a2413e2d5a6b594
URL: https://github.com/llvm/llvm-project/commit/63667c1896e11a4b2c389c681a2413e2d5a6b594 DIFF: https://github.com/llvm/llvm-project/commit/63667c1896e11a4b2c389c681a2413e2d5a6b594.diff LOG: [clangd] Trace per-token time in clangd --check Added: Modified: clang-tools-extra/clangd/tool/Check.cpp Removed: ################################################################################ diff --git a/clang-tools-extra/clangd/tool/Check.cpp b/clang-tools-extra/clangd/tool/Check.cpp index 6672b7d968de..65638dc88a60 100644 --- a/clang-tools-extra/clangd/tool/Check.cpp +++ b/clang-tools-extra/clangd/tool/Check.cpp @@ -37,6 +37,7 @@ #include "index/FileIndex.h" #include "refactor/Tweak.h" #include "support/ThreadsafeFS.h" +#include "support/Trace.h" #include "clang/AST/ASTContext.h" #include "clang/Basic/DiagnosticIDs.h" #include "clang/Format/Format.h" @@ -195,6 +196,7 @@ class Checker { void testLocationFeatures( llvm::function_ref<bool(const Position &)> ShouldCheckLine, const bool EnableCodeCompletion) { + trace::Span Trace("testLocationFeatures"); log("Testing features at each token (may be slow in large files)"); auto &SM = AST->getSourceManager(); auto SpelledTokens = AST->getTokens().spelledTokens(SM.getMainFileID()); @@ -210,6 +212,10 @@ class Checker { if (!ShouldCheckLine(Pos)) continue; + trace::Span Trace("Token"); + SPAN_ATTACH(Trace, "pos", Pos); + SPAN_ATTACH(Trace, "text", Tok.text(AST->getSourceManager())); + // FIXME: dumping the tokens may leak sensitive code into bug reports. // Add an option to turn this off, once we decide how options work. vlog(" {0} {1}", Pos, Tok.text(AST->getSourceManager())); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits