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/StringRef.h" 17 #include "llvm/Support/StringSaver.h" 92 : IncludeHeader(IncludeHeader), References(References) {}
104 unsigned References = 0;
135 static_cast<uint8_t>(B));
156 auto RawCharPointerCB = [&CB](
const char *&P) {
157 llvm::StringRef S(P);
159 assert(!S.data()[S.size()] &&
"Visited StringRef must be null-terminated");
166 CB(Include.IncludeHeader);
193 return sizeof(*this) +
Arena.getTotalMemory() +
205 void insert(
const Symbol &S);
213 return I ==
Symbols.end() ? nullptr : &I->second;
220 llvm::BumpPtrAllocator
Arena;
222 llvm::UniqueStringSaver UniqueStrings;
224 llvm::DenseMap<SymbolID, Symbol>
Symbols;
229 :
Arena(std::move(Arena)),
Symbols(std::move(Symbols)) {}
231 llvm::BumpPtrAllocator
Arena;
238 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOL_H
An immutable symbol container that stores a set of symbols.
const Symbol * find(const SymbolID &ID)
Returns the symbol with an ID, if it exists. Valid until insert/remove.
std::vector< Symbol >::const_iterator const_iterator
Symbol is visible to other files (not e.g. a static helper function).
llvm::unique_function< void(llvm::Expected< T >)> Callback
A Callback<T> is a void function that accepts Expected<T>.
llvm::StringRef Scope
The containing namespace. e.g. "" (global), "ns::" (top-level namespace).
Documents should not be synced at all.
void erase(const SymbolID &ID)
Removes the symbol with an ID, if it exists.
unsigned References
The number of translation units that reference this symbol from their main file.
SymbolSlab::Builder is a mutable container that can 'freeze' to SymbolSlab.
SymbolID ID
The ID of the symbol.
index::SymbolInfo SymInfo
The symbol information, like symbol kind.
llvm::BumpPtrAllocator Arena
Symbol is an implementation detail.
SymbolLocation Definition
The location of the symbol's definition, if one was found.
DeclRelationSet operator|(DeclRelation L, DeclRelation R)
clang::find_all_symbols::SymbolInfo SymbolInfo
Whether or not this symbol is meant to be used for the code completion.
llvm::SmallVector< IncludeHeaderWithReferences, 1 > IncludeHeaders
One Symbol can potentially be incuded via different headers.
llvm::StringRef Signature
A brief description of the symbol that can be appended in the completion candidate list...
llvm::StringRef Documentation
Documentation including comment for the symbol declaration.
SymbolLocation CanonicalDeclaration
The location of the preferred declaration of the symbol.
The class presents a C++ symbol, e.g.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
llvm::StringRef Name
The unqualified name of the symbol, e.g. "bar" (for ns::bar).
const_iterator begin() const
llvm::StringRef CompletionSnippetSuffix
What to insert when completing this symbol, after the symbol name.
const_iterator end() const
Indicates if the symbol is deprecated.
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, const CodeCompletion &C)
llvm::StringRef Type
Raw representation of the OpaqueType of the symbol, used for scoring purposes.
SymbolOrigin Origin
Where this symbol came from. Usually an index provides a constant value.
llvm::StringRef TemplateSpecializationArgs
Argument list in human-readable format, will be displayed to help disambiguate between different spec...
llvm::StringRef ReturnType
Type when this symbol is used in an expression.
void visitStrings(Symbol &S, const Callback &CB)
Invokes Callback with each StringRef& contained in the Symbol.
float quality(const Symbol &S)
Computes query-independent quality score for a Symbol.
IncludeGraphNode::SourceFlag & operator|=(IncludeGraphNode::SourceFlag &A, IncludeGraphNode::SourceFlag B)