[PATCH] D92157: [clangd] Add language metrics for recovery AST usage.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 26 06:20:24 PST 2020


hokein marked 2 inline comments as done.
hokein added inline comments.


================
Comment at: clang-tools-extra/clangd/Selection.cpp:40
 
+std::string getLanguage(const clang::LangOptions &Lang) {
+  if (Lang.C99 || Lang.C11 || Lang.C17 || Lang.C2x)
----------------
njames93 wrote:
> Nit: any reason to use std::string here instead StringRef. 
changed to `const char *`


================
Comment at: clang-tools-extra/clangd/Selection.cpp:51
 // Measure the fraction of selections that were enabled by recovery AST.
-void recordMetrics(const SelectionTree &S) {
+void recordMetrics(const SelectionTree &S, const ASTContext &AST) {
   static constexpr trace::Metric SelectionUsedRecovery(
----------------
kadircet wrote:
> nit: it might be nice to bail out early if no tracer is attached with `trace::enabled`
good catch, thanks! (I didn't know there is such a thing).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92157/new/

https://reviews.llvm.org/D92157



More information about the cfe-commits mailing list