[PATCH] D99540: [clangd] Preserve diags between tweak enumeration and execution

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 4 08:24:08 PDT 2021


kadircet added a comment.

> Sorry I've lost my context - did we decide to move forward with this patch?

I don't think we've came to a conclusion, just decided to postpone until needed. I believe the `cases` design is really a good fit for making tweaks expose multiple code actions.

But we've actually missed one thing while discussing this patch. It actually allows data from `clang::Diagnostic` to be stashed into `clangd::Diag` for use later on. Modules can actually stash this info while the AST is being built, later on they can be retrieved directly from the `ParsedAST::getDiagnostics()`. But this creates the N*M problem again, and feels like a hack.
What we can do instead is during `enumerateTweak`, we can group `data` in diagnostics (making sure `data` stored in `diagnostic` is keyed by `tweak::id`) and pass an additional array of json objects in `tweak::prepare`.  This will make the problem N+M again and make the data passing explicit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99540



More information about the cfe-commits mailing list