[clang-tools-extra] [clangd] Add metric for rename decl kind (PR #83867)
David Goldman via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 4 08:38:08 PST 2024
https://github.com/DavidGoldman created https://github.com/llvm/llvm-project/pull/83867
This will give us insight into what users are renaming in practice - for instance, try to gauge the impact of the ObjC rename support.
>From 42dddf4a5fbd862bf2f122a6c6216fe0dbd34e54 Mon Sep 17 00:00:00 2001
From: David Goldman <davg at google.com>
Date: Mon, 4 Mar 2024 11:35:46 -0500
Subject: [PATCH] [clangd] Add metric for rename decl kind
This will give us insight into what users are
renaming in practice.
---
clang-tools-extra/clangd/refactor/Rename.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index 4e135801f6853d..0cc7eecd6212be 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -1072,6 +1072,10 @@ llvm::Expected<RenameResult> rename(const RenameInputs &RInputs) {
if (Reject)
return makeError(*Reject);
+ static constexpr trace::Metric RenameTriggerCounter(
+ "rename_trigger_count", trace::Metric::Counter, "decl_kind");
+ RenameTriggerCounter.record(1, RenameDecl.getDeclKindName());
+
// We have two implementations of the rename:
// - AST-based rename: used for renaming local symbols, e.g. variables
// defined in a function body;
More information about the cfe-commits
mailing list