[PATCH] D52885: [clangd] Remove one-segment-skipping from Dex trigrams.
Sam McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 4 07:09:56 PDT 2018
This revision was automatically updated to reflect the committed changes.
sammccall marked an inline comment as done.
Closed by commit rCTE343777: [clangd] Remove one-segment-skipping from Dex trigrams. (authored by sammccall, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D52885?vs=168282&id=168285#toc
Repository:
rCTE Clang Tools Extra
https://reviews.llvm.org/D52885
Files:
clangd/index/dex/Trigram.cpp
clangd/index/dex/Trigram.h
unittests/clangd/DexTests.cpp
Index: unittests/clangd/DexTests.cpp
===================================================================
--- unittests/clangd/DexTests.cpp
+++ unittests/clangd/DexTests.cpp
@@ -381,8 +381,7 @@
"cde", "def"}));
EXPECT_THAT(generateIdentifierTrigrams("a_b_c_d_e_"),
- trigramsAre({"a", "a_", "ab", "abc", "abd", "acd", "ace", "bcd",
- "bce", "bde", "cde"}));
+ trigramsAre({"a", "a_", "ab", "abc", "bcd", "cde"}));
EXPECT_THAT(generateIdentifierTrigrams("unique_ptr"),
trigramsAre({"u", "un", "up", "uni", "unp", "upt", "niq", "nip",
@@ -396,14 +395,11 @@
EXPECT_THAT(generateIdentifierTrigrams("IsOK"),
trigramsAre({"i", "is", "io", "iso", "iok", "sok"}));
- auto X = generateIdentifierTrigrams("abc_defGhij__klm");
EXPECT_THAT(
generateIdentifierTrigrams("abc_defGhij__klm"),
- trigramsAre({"a", "ab", "ad", "abc", "abd", "abg", "ade", "adg",
- "adk", "agh", "agk", "bcd", "bcg", "bde", "bdg", "bdk",
- "bgh", "bgk", "cde", "cdg", "cdk", "cgh", "cgk", "def",
- "deg", "dek", "dgh", "dgk", "dkl", "efg", "efk", "egh",
- "egk", "ekl", "fgh", "fgk", "fkl", "ghi", "ghk", "gkl",
+ trigramsAre({"a", "ab", "ad", "abc", "abd", "ade", "adg", "bcd",
+ "bde", "bdg", "cde", "cdg", "def", "deg", "dgh", "dgk",
+ "efg", "egh", "egk", "fgh", "fgk", "ghi", "ghk", "gkl",
"hij", "hik", "hkl", "ijk", "ikl", "jkl", "klm"}));
}
Index: clangd/index/dex/Trigram.cpp
===================================================================
--- clangd/index/dex/Trigram.cpp
+++ clangd/index/dex/Trigram.cpp
@@ -36,17 +36,15 @@
//
// * Next Tail - next character from the same segment
// * Next Head - front character of the next segment
- // * Skip-1-Next Head - front character of the skip-1-next segment
//
// Next stores tuples of three indices in the presented order, if a variant is
// not available then 0 is stored.
std::vector<std::array<unsigned, 3>> Next(LowercaseIdentifier.size());
- unsigned NextTail = 0, NextHead = 0, NextNextHead = 0;
+ unsigned NextTail = 0, NextHead = 0;
for (int I = LowercaseIdentifier.size() - 1; I >= 0; --I) {
- Next[I] = {{NextTail, NextHead, NextNextHead}};
+ Next[I] = {{NextTail, NextHead}};
NextTail = Roles[I] == Tail ? I : 0;
if (Roles[I] == Head) {
- NextNextHead = NextHead;
NextHead = I;
}
}
Index: clangd/index/dex/Trigram.h
===================================================================
--- clangd/index/dex/Trigram.h
+++ clangd/index/dex/Trigram.h
@@ -37,7 +37,7 @@
///
/// The symbol's name is broken into segments, e.g. "FooBar" has two segments.
/// Trigrams can start at any character in the input. Then we can choose to move
-/// to the next character, move to the start of the next segment, or stop.
+/// to the next character or to the start of the next segment.
///
/// Short trigrams (length 1-2) are used for short queries. These are:
/// - prefixes of the identifier, of length 1 and 2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52885.168285.patch
Type: text/x-patch
Size: 3185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181004/44de0367/attachment.bin>
More information about the cfe-commits
mailing list