[PATCH] D87501: [clangd] Track tweaks that fail the apply stage

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 02:41:16 PDT 2020


kadircet created this revision.
kadircet added a reviewer: adamcz.
Herald added subscribers: cfe-commits, usaxena95, arphaman, jkorous.
Herald added a project: clang.
kadircet requested review of this revision.
Herald added subscribers: MaskRay, ilya-biryukov.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87501

Files:
  clang-tools-extra/clangd/ClangdServer.cpp


Index: clang-tools-extra/clangd/ClangdServer.cpp
===================================================================
--- clang-tools-extra/clangd/ClangdServer.cpp
+++ clang-tools-extra/clangd/ClangdServer.cpp
@@ -537,9 +537,12 @@
 
 void ClangdServer::applyTweak(PathRef File, Range Sel, StringRef TweakID,
                               Callback<Tweak::Effect> CB) {
-  // Tracks number of times a tweak has been applied.
+  // Tracks number of times a tweak has been attempted.
   static constexpr trace::Metric TweakAttempt(
       "tweak_attempt", trace::Metric::Counter, "tweak_id");
+  // Tracks number of times a tweak has failed to produce edits.
+  static constexpr trace::Metric TweakFailed(
+      "tweak_failed", trace::Metric::Counter, "tweak_id");
   TweakAttempt.record(1, TweakID);
   auto Action = [File = File.str(), Sel, TweakID = TweakID.str(),
                  CB = std::move(CB),
@@ -570,6 +573,8 @@
         if (llvm::Error Err = reformatEdit(E, Style))
           elog("Failed to format {0}: {1}", It.first(), std::move(Err));
       }
+    } else {
+      TweakFailed.record(1, TweakID);
     }
     return CB(std::move(*Effect));
   };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87501.291166.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200911/227793a9/attachment.bin>


More information about the cfe-commits mailing list