[PATCH] D58239: [clangd] Cache include fixes for diagnostics caused by the same unresolved name or incomplete type.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 18 02:41:37 PST 2019


ioeric added inline comments.


================
Comment at: clangd/IncludeFixer.h:85
+  // name or incomplete type in one parse, especially when code is
+  // copy-and-pasted without #includes. As fixes are purely dependent on index
+  // requests and index results at this point, we can cache fixes by index
----------------
sammccall wrote:
> This seems pretty messy (the assumption that Fix depends only on the index lookup).
> It saves some code now at the expense of being magic. If we want to e.g. insert qualifiers too, I worry it's going to (stop us || return incorrect cached results || lead to unneccesary cache misses) depending on what we do.
> 
> What would we need to store to calculate Fix?
> Maybe a struct ResolvedSymbol with {scope, name, inserted header}? (or even the edit to insert the header)
> If it's not hugely complicated, that seems both cleaner and more extensible - wdyt?
Yeah, surely this was too hacky ;)

Instead of a new struct, how about simply storing `SymbolSlab`s?  We are already building symbol slabs for fuzzy find results. And there are some helpers that take only `Symbol`. WDYT?


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D58239





More information about the cfe-commits mailing list