[PATCH] D96286: [clangd] Change TidyProvider cache to use a linked list approach

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 8 12:37:00 PST 2021


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

I know linked lists are the work of the devil, but it makes sense here.

Change the map in the DotClangTidyTree to store the FileCache as well as a link to its parent FileCache.
By storing a pointer to each items parent in the map, we no longer need to traverse the entire directory tree and populating a vector for each item.
Instead we just grab the tail from the map and (in all but the first run) it will contain links to the whole directory structure we need for querying.
This can save a lot of redundant work if the config file was in the tail directory but there was 15 parent directories above it.

This change should be NFC.

Depends on D96204 <https://reviews.llvm.org/D96204> - Mainly for the test cases added, to ensure this isn't breakign behaviour.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96286

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96286.322193.patch
Type: text/x-patch
Size: 6486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210208/f00d8ef2/attachment.bin>


More information about the cfe-commits mailing list