clang-tools  14.0.0git
Public Types | Public Member Functions | Friends | List of all members
clang::clangd::dex::Token Class Reference

A Token represents an attribute of a symbol, such as a particular trigram present in the name (used for fuzzy search). More...

#include <Token.h>

Public Types

enum  Kind {
  Kind::Trigram, Kind::Scope, Kind::ProximityURI, Kind::Type,
  Kind::Sentinel
}
 Kind specifies Token type which defines semantics for the internal representation. More...
 

Public Member Functions

 Token (Kind TokenKind, llvm::StringRef Data)
 
bool operator== (const Token &Other) const
 

Friends

llvm::raw_ostream & operator<< (llvm::raw_ostream &OS, const Token &T)
 
llvm::hash_code hash_value (const Token &Token)
 

Detailed Description

A Token represents an attribute of a symbol, such as a particular trigram present in the name (used for fuzzy search).

Tokens can be used to perform more sophisticated search queries by constructing complex iterator trees.

Definition at line 40 of file Token.h.

Member Enumeration Documentation

◆ Kind

Kind specifies Token type which defines semantics for the internal representation.

Each Kind has different representation stored in Data field.

Enumerator
Trigram 

Represents trigram used for fuzzy search of unqualified symbol names.

Data contains 3 bytes with trigram contents. 
Scope 

Scope primitives, e.g.

"symbol belongs to namespace foo::bar".

Data stroes full scope name, e.g. "foo::bar::baz::" or "" (for global
scope). 
ProximityURI 

Path Proximity URI to symbol declaration.

Data stores path URI of symbol declaration file or its parent.

Example: "file:///path/to/clang-tools-extra/clangd/index/SymbolIndex.h"
and some amount of its parents. 
Type 

Type of symbol (see Symbol::Type).

Sentinel 

Internal Token type for invalid/special tokens, e.g.

empty tokens for llvm::DenseMap.

Definition at line 49 of file Token.h.

Constructor & Destructor Documentation

◆ Token()

clang::clangd::dex::Token::Token ( Kind  TokenKind,
llvm::StringRef  Data 
)
inline

Definition at line 73 of file Token.h.

Member Function Documentation

◆ operator==()

bool clang::clangd::dex::Token::operator== ( const Token Other) const
inline

Definition at line 76 of file Token.h.

Friends And Related Function Documentation

◆ hash_value

llvm::hash_code hash_value ( const Token Token)
friend

Definition at line 106 of file Token.h.

◆ operator<<

llvm::raw_ostream& operator<< ( llvm::raw_ostream &  OS,
const Token T 
)
friend

Definition at line 80 of file Token.h.


The documentation for this class was generated from the following file: