[clang-tools-extra] r343801 - [clangd] Dex: FALSE iterator, peephole optimizations, fix AND bug
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 4 10:18:49 PDT 2018
Author: sammccall
Date: Thu Oct 4 10:18:49 2018
New Revision: 343801
URL: http://llvm.org/viewvc/llvm-project?rev=343801&view=rev
Log:
[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
Modified:
clang-tools-extra/trunk/clangd/index/dex/Iterator.h
Modified: clang-tools-extra/trunk/clangd/index/dex/Iterator.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/index/dex/Iterator.h?rev=343801&r1=343800&r2=343801&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/index/dex/Iterator.h (original)
+++ clang-tools-extra/trunk/clangd/index/dex/Iterator.h Thu Oct 4 10:18:49 2018
@@ -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;
};
More information about the cfe-commits
mailing list