Go to the documentation of this file.
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOL_H
10 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOL_H
15 #include "clang/Index/IndexSymbol.h"
16 #include "llvm/ADT/BitmaskEnum.h"
17 #include "llvm/ADT/StringRef.h"
18 #include "llvm/Support/StringSaver.h"
97 LLVM_MARK_AS_BITMASK_ENUM(
Import)
157 static_cast<uint8_t
>(
B));
164 llvm::raw_ostream &
operator<<(llvm::raw_ostream &
OS,
const Symbol &S);
178 auto RawCharPointerCB = [&CB](
const char *&P) {
179 llvm::StringRef S(P);
181 assert(!S.data()[S.size()] &&
"Visited StringRef must be null-terminated");
188 CB(Include.IncludeHeader);
195 float quality(
const Symbol &S);
213 bool empty()
const {
return Symbols.empty(); }
216 return sizeof(*this) + Arena.getTotalMemory() +
217 Symbols.capacity() *
sizeof(
Symbol);
235 auto I = Symbols.find(
ID);
236 return I == Symbols.end() ? nullptr : &I->second;
243 llvm::BumpPtrAllocator Arena;
245 llvm::UniqueStringSaver UniqueStrings;
247 llvm::DenseMap<SymbolID, Symbol> Symbols;
251 SymbolSlab(llvm::BumpPtrAllocator Arena, std::vector<Symbol> Symbols)
252 :
Arena(std::move(
Arena)), Symbols(std::move(Symbols)) {}
254 llvm::BumpPtrAllocator Arena;
255 std::vector<Symbol> Symbols;
258 llvm::raw_ostream &
operator<<(llvm::raw_ostream &
OS,
const SymbolSlab &Slab);
263 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOL_H
@ IndexedForCodeCompletion
Whether or not this symbol is meant to be used for the code completion.
const_iterator end() const
@ Import
#import "header.h"
LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE()
SymbolID ID
The ID of the symbol.
void erase(const SymbolID &ID)
Removes the symbol with an ID, if it exists.
const Symbol * find(const SymbolID &ID)
Returns the symbol with an ID, if it exists. Valid until insert/remove.
@ Deprecated
Indicates if the symbol is deprecated.
@ VisibleOutsideFile
Symbol is visible to other files (not e.g. a static helper function).
SymbolSlab build() &&
Consumes the builder to finalize the slab.
unsigned References
The number of translation units that reference this symbol from their main file.
llvm::StringRef ReturnType
Type when this symbol is used in an expression.
SymbolOrigin Origin
Where this symbol came from. Usually an index provides a constant value.
IncludeGraphNode::SourceFlag & operator|=(IncludeGraphNode::SourceFlag &A, IncludeGraphNode::SourceFlag B)
@ ImplementationDetail
Symbol is an implementation detail.
The class presents a C++ symbol, e.g.
const_iterator find(const SymbolID &SymID) const
index::SymbolInfo SymInfo
The symbol information, like symbol kind.
llvm::StringRef Name
The unqualified name of the symbol, e.g. "bar" (for ns::bar).
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
@ Include
#include "header.h"
SymbolLocation CanonicalDeclaration
The location of the preferred declaration of the symbol.
llvm::StringRef CompletionSnippetSuffix
What to insert when completing this symbol, after the symbol name.
llvm::StringRef TemplateSpecializationArgs
Argument list in human-readable format, will be displayed to help disambiguate between different spec...
DeclRelationSet operator|(DeclRelation L, DeclRelation R)
const_iterator begin() const
llvm::StringRef Scope
The containing namespace. e.g. "" (global), "ns::" (top-level namespace).
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::raw_string_ostream OS
llvm::BumpPtrAllocator Arena
clang::find_all_symbols::SymbolInfo SymbolInfo
SymbolLocation Definition
The location of the symbol's definition, if one was found.
llvm::unique_function< void(llvm::Expected< T >)> Callback
A Callback<T> is a void function that accepts Expected<T>.
void visitStrings(Symbol &S, const Callback &CB)
Invokes Callback with each StringRef& contained in the Symbol.
std::vector< Symbol >::const_iterator const_iterator
SymbolSlab::Builder is a mutable container that can 'freeze' to SymbolSlab.
An immutable symbol container that stores a set of symbols.
llvm::StringRef Signature
A brief description of the symbol that can be appended in the completion candidate list.
llvm::StringRef Type
Raw representation of the OpaqueType of the symbol, used for scoring purposes.
llvm::SmallVector< IncludeHeaderWithReferences, 1 > IncludeHeaders
One Symbol can potentially be included via different headers.
llvm::StringRef Documentation
Documentation including comment for the symbol declaration.
float quality(const Symbol &S)
Computes query-independent quality score for a Symbol.
void insert(const Symbol &S)
Adds a symbol, overwriting any existing one with the same ID.