[clang-tools-extra] [clangd] Add metric for rename decl kind (PR #83867)

via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 08:38:40 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clangd

Author: David Goldman (DavidGoldman)

<details>
<summary>Changes</summary>

This will give us insight into what users are renaming in practice - for instance, try to gauge the impact of the ObjC rename support.

---
Full diff: https://github.com/llvm/llvm-project/pull/83867.diff


1 Files Affected:

- (modified) clang-tools-extra/clangd/refactor/Rename.cpp (+4) 


``````````diff
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;

``````````

</details>


https://github.com/llvm/llvm-project/pull/83867


More information about the cfe-commits mailing list