]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/clang/include/clang/Index/IndexDataConsumer.h
Merge clang 7.0.1 and several follow-up changes
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / clang / include / clang / Index / IndexDataConsumer.h
1 //===--- IndexDataConsumer.h - Abstract index data consumer -----*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_INDEX_INDEXDATACONSUMER_H
11 #define LLVM_CLANG_INDEX_INDEXDATACONSUMER_H
12
13 #include "clang/Index/IndexSymbol.h"
14 #include "clang/Lex/Preprocessor.h"
15
16 namespace clang {
17   class ASTContext;
18   class DeclContext;
19   class Expr;
20   class FileID;
21   class IdentifierInfo;
22   class ImportDecl;
23   class MacroInfo;
24
25 namespace index {
26
27 class IndexDataConsumer {
28 public:
29   struct ASTNodeInfo {
30     const Expr *OrigE;
31     const Decl *OrigD;
32     const Decl *Parent;
33     const DeclContext *ContainerDC;
34   };
35
36   virtual ~IndexDataConsumer() {}
37
38   virtual void initialize(ASTContext &Ctx) {}
39
40   virtual void setPreprocessor(std::shared_ptr<Preprocessor> PP) {}
41
42   /// \returns true to continue indexing, or false to abort.
43   virtual bool handleDeclOccurence(const Decl *D, SymbolRoleSet Roles,
44                                    ArrayRef<SymbolRelation> Relations,
45                                    SourceLocation Loc, ASTNodeInfo ASTNode);
46
47   /// \returns true to continue indexing, or false to abort.
48   virtual bool handleMacroOccurence(const IdentifierInfo *Name,
49                                     const MacroInfo *MI, SymbolRoleSet Roles,
50                                     SourceLocation Loc);
51
52   /// \returns true to continue indexing, or false to abort.
53   virtual bool handleModuleOccurence(const ImportDecl *ImportD,
54                                      SymbolRoleSet Roles, SourceLocation Loc);
55
56   virtual void finish() {}
57 };
58
59 } // namespace index
60 } // namespace clang
61
62 #endif