diff --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp --- a/clang-tools-extra/clangd/Selection.cpp +++ b/clang-tools-extra/clangd/Selection.cpp @@ -41,10 +41,13 @@ void recordMetrics(const SelectionTree &S) { static constexpr trace::Metric SelectionUsedRecovery( "selection_recovery", trace::Metric::Distribution); + static constexpr trace::Metric RecoveryType("selection_recovery_type", + trace::Metric::Distribution); const auto *Common = S.commonAncestor(); for (const auto *N = Common; N; N = N->Parent) { - if (N->ASTNode.get()) { + if (const auto *RE = N->ASTNode.get()) { SelectionUsedRecovery.record(1); // used recovery ast. + RecoveryType.record(RE->isTypeDependent() ? 0 : 1); return; } } diff --git a/clang-tools-extra/clangd/unittests/SelectionTests.cpp b/clang-tools-extra/clangd/unittests/SelectionTests.cpp --- a/clang-tools-extra/clangd/unittests/SelectionTests.cpp +++ b/clang-tools-extra/clangd/unittests/SelectionTests.cpp @@ -453,6 +453,8 @@ auto T = makeSelectionTree(Code, AST); EXPECT_THAT(Tracer.takeMetric("selection_recovery"), testing::ElementsAreArray({1})); + EXPECT_THAT(Tracer.takeMetric("selection_recovery_type"), + testing::ElementsAreArray({1})); } // FIXME: Doesn't select the binary operator node in