[PATCH] D52789: [clangd] Dex: FALSE iterator, peephole optimizations, fix AND bug

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 2 10:20:46 PDT 2018


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

The FALSE iterator will be used in a followup patch to fix a logic bug in Dex
(currently, tokens that don't have posting lists in the index are simply dropped
from the query, changing semantics).

It can usually be optimized away, so added the following opmitizations:

- simplify booleans inside AND/OR
- replace effectively-empty AND/OR with booleans
- flatten nested AND/ORs

While working on this, found a bug in the AND iterator: its constructor sync()
assumes that ReachedEnd is set if applicable, but the constructor never sets it.
This crashes if a non-first iterator is nonempty.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D52789

Files:
  clangd/index/dex/Iterator.cpp
  clangd/index/dex/Iterator.h
  unittests/clangd/DexTests.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52789.167972.patch
Type: text/x-patch
Size: 10215 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181002/9611aa64/attachment.bin>


More information about the cfe-commits mailing list