summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam McCall <sam.mccall@gmail.com>2018-10-04 17:18:49 +0000
committerSam McCall <sam.mccall@gmail.com>2018-10-04 17:18:49 +0000
commited3581644cae9c5b0c71273fb49f18f1ab237aa4 (patch)
tree034985f848766c13d7f75ac9c548391e00b788e5
parente937c156f2f56ca8aa4d231a23a37073aecb125e (diff)
[clangd] Dex: FALSE iterator, peephole optimizations, fix AND bug
Summary: 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. Reviewers: ilya-biryukov Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits Differential Revision: https://reviews.llvm.org/D52789
-rw-r--r--clang-tools-extra/clangd/index/dex/Iterator.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/clang-tools-extra/clangd/index/dex/Iterator.h b/clang-tools-extra/clangd/index/dex/Iterator.h
index 149fd43adb8..25922fba9fd 100644
--- a/clang-tools-extra/clangd/index/dex/Iterator.h
+++ b/clang-tools-extra/clangd/index/dex/Iterator.h
@@ -106,6 +106,7 @@ protected:
Iterator(Kind MyKind = Kind::Other) : MyKind(MyKind) {}
private:
+ Kind MyKind;
virtual llvm::raw_ostream &dump(llvm::raw_ostream &OS) const = 0;
Kind MyKind;
};