Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:36:56

0001 //===--- IndexDataConsumer.h - Abstract index data consumer -----*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_INDEX_INDEXDATACONSUMER_H
0010 #define LLVM_CLANG_INDEX_INDEXDATACONSUMER_H
0011 
0012 #include "clang/Index/IndexSymbol.h"
0013 #include "clang/Lex/Preprocessor.h"
0014 
0015 namespace clang {
0016   class ASTContext;
0017   class DeclContext;
0018   class Expr;
0019   class FileID;
0020   class IdentifierInfo;
0021   class ImportDecl;
0022   class MacroInfo;
0023 
0024 namespace index {
0025 
0026 class IndexDataConsumer {
0027 public:
0028   struct ASTNodeInfo {
0029     const Expr *OrigE;
0030     const Decl *OrigD;
0031     const Decl *Parent;
0032     const DeclContext *ContainerDC;
0033   };
0034 
0035   virtual ~IndexDataConsumer() = default;
0036 
0037   virtual void initialize(ASTContext &Ctx) {}
0038 
0039   virtual void setPreprocessor(std::shared_ptr<Preprocessor> PP) {}
0040 
0041   /// \returns true to continue indexing, or false to abort.
0042   virtual bool handleDeclOccurrence(const Decl *D, SymbolRoleSet Roles,
0043                                     ArrayRef<SymbolRelation> Relations,
0044                                     SourceLocation Loc, ASTNodeInfo ASTNode) {
0045     return true;
0046   }
0047 
0048   /// \returns true to continue indexing, or false to abort.
0049   virtual bool handleMacroOccurrence(const IdentifierInfo *Name,
0050                                      const MacroInfo *MI, SymbolRoleSet Roles,
0051                                      SourceLocation Loc) {
0052     return true;
0053   }
0054 
0055   /// \returns true to continue indexing, or false to abort.
0056   ///
0057   /// This will be called for each module reference in an import decl.
0058   /// For "@import MyMod.SubMod", there will be a call for 'MyMod' with the
0059   /// 'reference' role, and a call for 'SubMod' with the 'declaration' role.
0060   virtual bool handleModuleOccurrence(const ImportDecl *ImportD,
0061                                       const Module *Mod, SymbolRoleSet Roles,
0062                                       SourceLocation Loc) {
0063     return true;
0064   }
0065 
0066   virtual void finish() {}
0067 };
0068 
0069 } // namespace index
0070 } // namespace clang
0071 
0072 #endif