[clang-tools-extra] 26cf6c1 - [clangd] Add metrics for recovery-expr type propagation.
Haojian Wu via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 13 02:32:06 PDT 2020
Author: Haojian Wu
Date: 2020-07-13T11:26:45+02:00
New Revision: 26cf6c1513f95082cedd4f2acf0881dd9ab56461
URL: https://github.com/llvm/llvm-project/commit/26cf6c1513f95082cedd4f2acf0881dd9ab56461
DIFF: https://github.com/llvm/llvm-project/commit/26cf6c1513f95082cedd4f2acf0881dd9ab56461.diff
LOG: [clangd] Add metrics for recovery-expr type propagation.
Differential Revision: https://reviews.llvm.org/D83657
Added:
Modified:
clang-tools-extra/clangd/Selection.cpp
clang-tools-extra/clangd/unittests/SelectionTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp
index 1db15ba6699a..e94a3ca5a0c3 100644
--- a/clang-tools-extra/clangd/Selection.cpp
+++ b/clang-tools-extra/clangd/Selection.cpp
@@ -41,10 +41,13 @@ using ast_type_traits::DynTypedNode;
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<RecoveryExpr>()) {
+ if (const auto *RE = N->ASTNode.get<RecoveryExpr>()) {
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
index 6f8c10e966a8..051580ba6e49 100644
--- a/clang-tools-extra/clangd/unittests/SelectionTests.cpp
+++ b/clang-tools-extra/clangd/unittests/SelectionTests.cpp
@@ -453,6 +453,8 @@ TEST(SelectionTree, Metrics) {
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
More information about the cfe-commits
mailing list