[PATCH] D52796: [clangd] Simplify Dex query tree logic and fix missing-posting-list bug

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 12:49:54 PDT 2018


sammccall created this revision.
sammccall added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, kadircet, arphaman, jkorous, MaskRay, ioeric.

The bug being fixed: when a posting list doesn't exist in the index, it
was previously just dropped from the query rather than being treated as
empty. Now that we have the FALSE iterator, we can use it instead.

The query tree logic previously had a bunch of special cases to detect whether
subtrees are empty. Now we just naively build the whole tree, and rely
on the query optimizations to drop the trivial parts.

Finally, there was a bug in trigram generation: the empty query would
generate a single trigram "$$$" instead of no trigrams.
This had no effect (there was no posting list, so the other bug
cancelled it out). But we now have to fix this bug too.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52796

Files:
  clangd/index/dex/Dex.cpp
  clangd/index/dex/Dex.h
  clangd/index/dex/Trigram.cpp
  unittests/clangd/DexTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52796.168002.patch
Type: text/x-patch
Size: 7229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181002/29c2caf1/attachment.bin>


More information about the cfe-commits mailing list