Skip to content

Commit

Permalink
[clangd] Add metric for rename decl kind (#83867)
Browse files Browse the repository at this point in the history
This will give us insight into what users are renaming in practice - for
instance, try to gauge the impact of the ObjC rename support.
  • Loading branch information
DavidGoldman committed Mar 5, 2024
1 parent da63746 commit ec7062d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions clang-tools-extra/clangd/refactor/Rename.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ec7062d

Please sign in to comment.