clang-tools
7.0.0
|
Collect declarations (symbols) from an AST. More...
#include <SymbolCollector.h>
Classes | |
struct | Options |
Public Member Functions | |
SymbolCollector (Options Opts) | |
void | initialize (ASTContext &Ctx) override |
void | setPreprocessor (std::shared_ptr< Preprocessor > PP) override |
bool | handleDeclOccurence (const Decl *D, index::SymbolRoleSet Roles, ArrayRef< index::SymbolRelation > Relations, SourceLocation Loc, index::IndexDataConsumer::ASTNodeInfo ASTNode) override |
bool | handleMacroOccurence (const IdentifierInfo *Name, const MacroInfo *MI, index::SymbolRoleSet Roles, SourceLocation Loc) override |
SymbolSlab | takeSymbols () |
void | finish () override |
Static Public Member Functions | |
static bool | shouldCollectSymbol (const NamedDecl &ND, ASTContext &ASTCtx, const Options &Opts) |
Returns true is ND should be collected. More... | |
Collect declarations (symbols) from an AST.
It collects most declarations except:
See also shouldCollectSymbol(...).
Clients (e.g. clangd) can use SymbolCollector together with index::indexTopLevelDecls to retrieve all symbols when the source file is changed.
Definition at line 37 of file SymbolCollector.h.
clang::clangd::SymbolCollector::SymbolCollector | ( | Options | Opts | ) |
Definition at line 229 of file SymbolCollector.cpp.
|
override |
Definition at line 416 of file SymbolCollector.cpp.
References clang::clangd::Symbol::CanonicalDeclaration, clang::clangd::Symbol::CompletionSnippetSuffix, Ctx, clang::clangd::Symbol::Definition, clang::clangd::Symbol::Detail, clang::clangd::Symbol::Details::Documentation, clang::clangd::findNameLoc(), clang::clangd::formatDocumentation(), clang::clangd::getDocComment(), clang::clangd::getReturnType(), clang::clangd::getSignature(), clang::clangd::Symbol::ID, clang::clangd::Symbol::Details::IncludeHeader, clang::clangd::Symbol::IsIndexedForCodeCompletion, clang::clangd::isIndexedForCodeCompletion(), clang::clangd::Symbol::Name, clang::clangd::Symbol::Origin, clang::clangd::printQualifiedName(), clang::clangd::Symbol::References, clang::clangd::Symbol::Details::ReturnType, ReturnType, clang::clangd::Symbol::Scope, clang::clangd::Symbol::Signature, Signature, SnippetSuffix, clang::clangd::splitQualifiedName(), and clang::clangd::Symbol::SymInfo.
Referenced by takeSymbols().
|
override |
Definition at line 285 of file SymbolCollector.cpp.
References shouldCollectSymbol().
Referenced by setPreprocessor().
|
override |
Definition at line 344 of file SymbolCollector.cpp.
Referenced by setPreprocessor().
|
override |
Definition at line 231 of file SymbolCollector.cpp.
References Ctx.
|
inlineoverride |
Definition at line 73 of file SymbolCollector.h.
References handleDeclOccurence(), handleMacroOccurence(), Loc, and Name.
|
static |
Returns true is ND
should be collected.
AST matchers require non-const ASTContext.
Definition at line 238 of file SymbolCollector.cpp.
Referenced by handleDeclOccurence().
|
inline |
Definition at line 87 of file SymbolCollector.h.
References finish().