1 //===--- IndexDataConsumer.h - Abstract index data consumer -----*- C++ -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_INDEX_INDEXDATACONSUMER_H
10 #define LLVM_CLANG_INDEX_INDEXDATACONSUMER_H
12 #include "clang/Index/IndexSymbol.h"
13 #include "clang/Lex/Preprocessor.h"
26 class IndexDataConsumer {
32 const DeclContext *ContainerDC;
35 virtual ~IndexDataConsumer() {}
37 virtual void initialize(ASTContext &Ctx) {}
39 virtual void setPreprocessor(std::shared_ptr<Preprocessor> PP) {}
41 /// \returns true to continue indexing, or false to abort.
42 virtual bool handleDeclOccurence(const Decl *D, SymbolRoleSet Roles,
43 ArrayRef<SymbolRelation> Relations,
44 SourceLocation Loc, ASTNodeInfo ASTNode);
46 /// \returns true to continue indexing, or false to abort.
47 virtual bool handleMacroOccurence(const IdentifierInfo *Name,
48 const MacroInfo *MI, SymbolRoleSet Roles,
51 /// \returns true to continue indexing, or false to abort.
53 /// This will be called for each module reference in an import decl.
54 /// For "@import MyMod.SubMod", there will be a call for 'MyMod' with the
55 /// 'reference' role, and a call for 'SubMod' with the 'declaration' role.
56 virtual bool handleModuleOccurence(const ImportDecl *ImportD,
58 SymbolRoleSet Roles, SourceLocation Loc);
60 virtual void finish() {}