8 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOL_COLLECTOR_H
9 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_INDEX_SYMBOL_COLLECTOR_H
15 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/Decl.h"
17 #include "clang/Basic/SourceLocation.h"
18 #include "clang/Basic/SourceManager.h"
19 #include "clang/Index/IndexDataConsumer.h"
20 #include "clang/Index/IndexSymbol.h"
21 #include "clang/Sema/CodeCompleteConsumer.h"
22 #include "llvm/ADT/DenseMap.h"
23 #include "llvm/Support/Regex.h"
87 std::function<bool(
const SourceManager &, FileID)>
FileFilter =
nullptr;
94 const Options &Opts,
bool IsMainFileSymbol);
99 this->PP = std::move(PP);
104 ArrayRef<index::SymbolRelation> Relations,
106 index::IndexDataConsumer::ASTNodeInfo ASTNode)
override;
109 index::SymbolRoleSet Roles,
110 SourceLocation
Loc)
override;
127 bool IsMainFileSymbol);
128 void addDefinition(
const NamedDecl &,
const Symbol &DeclSymbol);
129 void processRelations(
const NamedDecl &ND,
const SymbolID &ID,
130 ArrayRef<index::SymbolRelation> Relations);
132 llvm::Optional<std::string> getIncludeHeader(llvm::StringRef QName, FileID);
133 bool isSelfContainedHeader(FileID);
135 static bool isDontIncludeMeHeader(llvm::StringRef);
141 llvm::DenseMap<SymbolID, FileID> IncludeFiles;
142 void setIncludeLocation(
const Symbol &S, SourceLocation);
144 llvm::DenseSet<const IdentifierInfo *> IndexedMacros;
153 std::shared_ptr<Preprocessor> PP;
154 std::shared_ptr<GlobalCodeCompletionAllocator> CompletionAllocator;
155 std::unique_ptr<CodeCompletionTUInfo> CompletionTUInfo;
157 using SymbolRef = std::pair<SourceLocation, index::SymbolRoleSet>;
159 llvm::DenseSet<const NamedDecl *> ReferencedDecls;
160 llvm::DenseSet<const IdentifierInfo *> ReferencedMacros;
161 llvm::DenseMap<const NamedDecl *, std::vector<SymbolRef>> DeclRefs;
162 llvm::DenseMap<SymbolID, std::vector<SymbolRef>> MacroRefs;
168 llvm::DenseMap<const Decl *, const Decl *> CanonicalDecls;
170 llvm::DenseMap<FileID, bool> FilesToIndexCache;
171 llvm::DenseMap<FileID, bool> HeaderIsSelfContainedCache;