[clang-tools-extra] ec7062d - [clangd] Add metric for rename decl kind (#83867)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 5 08:11:02 PST 2024
Author: David Goldman
Date: 2024-03-05T11:10:57-05:00
New Revision: ec7062d9d822df42dee6dccada13f42798976f3c
URL: https://github.com/llvm/llvm-project/commit/ec7062d9d822df42dee6dccada13f42798976f3c
DIFF: https://github.com/llvm/llvm-project/commit/ec7062d9d822df42dee6dccada13f42798976f3c.diff
LOG: [clangd] Add metric for rename decl kind (#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.
Added:
Modified:
clang-tools-extra/clangd/refactor/Rename.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index 4e135801f6853d..75b30e66d63761 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -1062,6 +1062,10 @@ llvm::Expected<RenameResult> rename(const RenameInputs &RInputs) {
return makeError(ReasonToReject::AmbiguousSymbol);
const auto &RenameDecl = **DeclsUnderCursor.begin();
+ static constexpr trace::Metric RenameTriggerCounter(
+ "rename_trigger_count", trace::Metric::Counter, "decl_kind");
+ RenameTriggerCounter.record(1, RenameDecl.getDeclKindName());
+
std::string Placeholder = getName(RenameDecl);
auto Invalid = checkName(RenameDecl, RInputs.NewName, Placeholder);
if (Invalid)
More information about the cfe-commits
mailing list