#include "SymbolCollector.h"
#include "AST.h"
#include "CodeComplete.h"
#include "CodeCompletionStrings.h"
#include "ExpectedTypes.h"
#include "SourceCode.h"
#include "URI.h"
#include "clang-include-cleaner/Analysis.h"
#include "clang-include-cleaner/IncludeSpeller.h"
#include "clang-include-cleaner/Record.h"
#include "clang-include-cleaner/Types.h"
#include "index/CanonicalIncludes.h"
#include "index/Relation.h"
#include "index/Symbol.h"
#include "index/SymbolID.h"
#include "index/SymbolLocation.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/DeclarationName.h"
#include "clang/AST/Expr.h"
#include "clang/Basic/FileEntry.h"
#include "clang/Basic/LangOptions.h"
#include "clang/Basic/SourceLocation.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Index/IndexSymbol.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Lex/Token.h"
#include "clang/Tooling/Inclusions/HeaderAnalysis.h"
#include "clang/Tooling/Inclusions/StandardLibrary.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include <cassert>
#include <memory>
#include <optional>
#include <string>
#include <utility>
namespace clang {
namespace clangd {
namespace {
const NamedDecl &getTemplateOrThis(const NamedDecl &ND) { … }
bool isPrivateProtoDecl(const NamedDecl &ND) { … }
Symbol::IncludeDirective shouldCollectIncludePath(index::SymbolKind Kind) { … }
std::pair<SymbolLocation::Position, SymbolLocation::Position>
getTokenRange(SourceLocation TokLoc, const SourceManager &SM,
const LangOptions &LangOpts) { … }
bool isPreferredDeclaration(const NamedDecl &ND, index::SymbolRoleSet Roles) { … }
RefKind toRefKind(index::SymbolRoleSet Roles, bool Spelled = false) { … }
std::optional<RelationKind> indexableRelation(const index::SymbolRelation &R) { … }
bool isSpelled(SourceLocation Loc, const NamedDecl &ND) { … }
}
class SymbolCollector::HeaderFileURICache { … };
std::optional<SymbolLocation>
SymbolCollector::getTokenLocation(SourceLocation TokLoc) { … }
SymbolCollector::SymbolCollector(Options Opts) : … { … }
SymbolCollector::~SymbolCollector() = default;
void SymbolCollector::initialize(ASTContext &Ctx) { … }
bool SymbolCollector::shouldCollectSymbol(const NamedDecl &ND,
const ASTContext &ASTCtx,
const Options &Opts,
bool IsMainFileOnly) { … }
const Decl *
SymbolCollector::getRefContainer(const Decl *Enclosing,
const SymbolCollector::Options &Opts) { … }
bool SymbolCollector::handleDeclOccurrence(
const Decl *D, index::SymbolRoleSet Roles,
llvm::ArrayRef<index::SymbolRelation> Relations, SourceLocation Loc,
index::IndexDataConsumer::ASTNodeInfo ASTNode) { … }
void SymbolCollector::handleMacros(const MainFileMacros &MacroRefsToIndex) { … }
bool SymbolCollector::handleMacroOccurrence(const IdentifierInfo *Name,
const MacroInfo *MI,
index::SymbolRoleSet Roles,
SourceLocation Loc) { … }
void SymbolCollector::processRelations(
const NamedDecl &ND, const SymbolID &ID,
ArrayRef<index::SymbolRelation> Relations) { … }
void SymbolCollector::setIncludeLocation(const Symbol &S, SourceLocation DefLoc,
const include_cleaner::Symbol &Sym) { … }
llvm::StringRef getStdHeader(const Symbol *S, const LangOptions &LangOpts) { … }
void SymbolCollector::finish() { … }
const Symbol *SymbolCollector::addDeclaration(const NamedDecl &ND, SymbolID ID,
bool IsMainFileOnly) { … }
void SymbolCollector::addDefinition(const NamedDecl &ND,
const Symbol &DeclSym) { … }
bool SymbolCollector::shouldIndexFile(FileID FID) { … }
void SymbolCollector::addRef(SymbolID ID, const SymbolRef &SR) { … }
SymbolID SymbolCollector::getSymbolIDCached(const Decl *D) { … }
SymbolID SymbolCollector::getSymbolIDCached(const llvm::StringRef MacroName,
const MacroInfo *MI,
const SourceManager &SM) { … }
}
}