clang-tools
15.0.0git
|
Collect declarations (symbols) from an AST. More...
#include <SymbolCollector.h>
Classes | |
class | HeaderFileURICache |
struct | Options |
Public Member Functions | |
SymbolCollector (Options Opts) | |
~SymbolCollector () | |
void | initialize (ASTContext &Ctx) override |
void | setPreprocessor (std::shared_ptr< Preprocessor > PP) override |
void | setPreprocessor (Preprocessor &PP) |
bool | handleDeclOccurrence (const Decl *D, index::SymbolRoleSet Roles, ArrayRef< index::SymbolRelation > Relations, SourceLocation Loc, index::IndexDataConsumer::ASTNodeInfo ASTNode) override |
bool | handleMacroOccurrence (const IdentifierInfo *Name, const MacroInfo *MI, index::SymbolRoleSet Roles, SourceLocation Loc) override |
void | handleMacros (const MainFileMacros &MacroRefsToIndex) |
SymbolSlab | takeSymbols () |
RefSlab | takeRefs () |
RelationSlab | takeRelations () |
bool | shouldIndexFile (FileID FID) |
Returns true if we are interested in references and declarations from FID . More... | |
void | finish () override |
Static Public Member Functions | |
static bool | shouldCollectSymbol (const NamedDecl &ND, const ASTContext &ASTCtx, const Options &Opts, bool IsMainFileSymbol) |
Returns true is ND should be collected. More... | |
Collect declarations (symbols) from an AST.
It collects most declarations except:
References to main-file symbols are not collected.
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 49 of file SymbolCollector.h.
clang::clangd::SymbolCollector::SymbolCollector | ( | Options | Opts | ) |
Definition at line 454 of file SymbolCollector.cpp.
|
default |
|
override |
Definition at line 815 of file SymbolCollector.cpp.
References clang::clangd::SymbolSlab::Builder::erase(), clang::clangd::SymbolSlab::Builder::find(), ID, clang::clangd::Symbol::IncludeHeaders, clang::clangd::SymbolSlab::Builder::insert(), and References.
|
override |
Definition at line 521 of file SymbolCollector.cpp.
References ns1::ns2::D, and ID.
|
override |
Definition at line 687 of file SymbolCollector.cpp.
void clang::clangd::SymbolCollector::handleMacros | ( | const MainFileMacros & | MacroRefsToIndex | ) |
Definition at line 643 of file SymbolCollector.cpp.
|
override |
Definition at line 457 of file SymbolCollector.cpp.
References Ctx.
|
inline |
Definition at line 111 of file SymbolCollector.h.
|
inlineoverride |
Definition at line 108 of file SymbolCollector.h.
|
static |
Returns true is ND
should be collected.
Definition at line 466 of file SymbolCollector.cpp.
Referenced by clang::clangd::getIndexableLocalDecls().
bool clang::clangd::SymbolCollector::shouldIndexFile | ( | FileID | FID | ) |
Returns true if we are interested in references and declarations from FID
.
If this function return false, bodies of functions inside those files will be skipped to decrease indexing time.
Definition at line 964 of file SymbolCollector.cpp.
|
inline |
Definition at line 126 of file SymbolCollector.h.
|
inline |
Definition at line 127 of file SymbolCollector.h.
|
inline |
Definition at line 125 of file SymbolCollector.h.