9#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOLID_H
10#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOLID_H
12#include "llvm/ADT/Hashing.h"
13#include "llvm/ADT/StringRef.h"
14#include "llvm/Support/Error.h"
15#include "llvm/Support/raw_ostream.h"
38 return HashValue == Sym.HashValue;
43 return llvm::bit_cast<IntTy>(HashValue) <
44 llvm::bit_cast<IntTy>(Sym.HashValue);
50 llvm::StringRef
raw()
const;
54 std::string
str()
const;
55 static llvm::Expected<SymbolID>
fromStr(llvm::StringRef);
58 explicit operator bool()
const {
return !
isNull(); }
61 using IntTy = uint64_t;
62 static_assert(
sizeof(IntTy) ==
RawSize);
63 std::array<uint8_t, RawSize> HashValue{};
69 "size_t longer than SHA1!");
71 memcpy(&Result,
ID.raw().data(),
sizeof(
size_t));
72 return llvm::hash_code(Result);
76llvm::raw_ostream &
operator<<(llvm::raw_ostream &
OS,
const SymbolID &
ID);
83template <>
struct DenseMapInfo<
clang::clangd::SymbolID> {
93 return hash_value(Sym);
llvm::raw_string_ostream OS
static constexpr size_t RawSize
static llvm::Expected< SymbolID > fromStr(llvm::StringRef)
bool operator==(const SymbolID &Sym) const
static SymbolID fromRaw(llvm::StringRef)
llvm::StringRef raw() const
bool operator<(const SymbolID &Sym) const
bool operator!=(const SymbolID &Sym) const
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
llvm::hash_code hash_value(const SymbolID &ID)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Some operations such as code completion produce a set of candidates.
static unsigned getHashValue(const clang::clangd::SymbolID &Sym)
static clang::clangd::SymbolID getTombstoneKey()
static bool isEqual(const clang::clangd::SymbolID &LHS, const clang::clangd::SymbolID &RHS)
static clang::clangd::SymbolID getEmptyKey()