[PATCH] D155173: [clangd] Refine the workflow for diagnostic Fixits.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 18 07:09:28 PDT 2023


kadircet accepted this revision.
kadircet added a comment.
This revision is now accepted and ready to land.

thanks!



================
Comment at: clang-tools-extra/clangd/ClangdLSPServer.cpp:1063
+      OnlyFix->isPreferred = true;
+      if (LSPDiags.size() == 1 && LSPDiags.front().range == Selection)
+        OnlyFix->diagnostics = {LSPDiags.front()};
----------------
no need for `LSPDiags` anymore, you can just use `ToLSPDiags.begin()`


================
Comment at: clang-tools-extra/clangd/ClangdServer.cpp:671
+    if (KindAllowed(CodeAction::QUICKFIX_KIND)) {
+      auto FindMatched = [&InpAST](const DiagRef &DR) -> const clangd::Diag * {
+        for (const auto &Diag : InpAST->AST.getDiagnostics())
----------------
nit: you can return an `llvm::ArrayRef<Fix>` here and get rid of one extra layer of nesting down below


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D155173



More information about the cfe-commits mailing list