23#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_TRIGRAM_H
24#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_DEX_TRIGRAM_H
27#include "llvm/ADT/bit.h"
39 std::array<char, 4> Data;
41 enum class Sentinel { Tombstone = 4,
Empty = 5 };
42 Trigram(Sentinel S) : Data{0, 0, 0,
static_cast<char>(S)} {}
43 uint32_t id()
const {
return llvm::bit_cast<uint32_t>(Data); }
48 Trigram(
char A,
char B) : Data{A, B, 0, 2} {}
49 Trigram(
char A,
char B,
char C) : Data{A, B,
C, 3} {}
50 std::string
str()
const {
return std::string(Data.data(), Data[3]); }
51 friend struct ::llvm::DenseMapInfo<Trigram>;
73 std::vector<Trigram> &
Out);
91template <>
struct DenseMapInfo<
clang::clangd::dex::Trigram> {
94 return Trigram(Trigram::Sentinel::Empty);
97 return Trigram(Trigram::Sentinel::Tombstone);
103 X *= uint32_t{0x85ebca6b};
105 X *= uint32_t{0xc2b2ae35};
CompiledFragmentImpl & Out
Token objects represent a characteristic of a symbol, which can be used to perform efficient search.
friend bool operator==(Trigram L, Trigram R)
friend bool operator<(Trigram L, Trigram R)
Trigram(char A, char B, char C)
void generateIdentifierTrigrams(llvm::StringRef Identifier, std::vector< Trigram > &Result)
Produces list of unique fuzzy-search trigrams from unqualified symbol.
std::vector< Token > generateQueryTrigrams(llvm::StringRef Query)
Returns list of unique fuzzy-search trigrams given a query.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Some operations such as code completion produce a set of candidates.
static unsigned getHashValue(Trigram V)
static Trigram getEmptyKey()
static bool isEqual(const Trigram &LHS, const Trigram &RHS)
static Trigram getTombstoneKey()