clang  6.0.0svn
IndexDataConsumer.h
Go to the documentation of this file.
1 //===--- IndexDataConsumer.h - Abstract index data consumer ---------------===//
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 
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 
28 public:
29  struct ASTNodeInfo {
30  const Expr *OrigE;
31  const Decl *OrigD;
32  const Decl *Parent;
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  FileID FID, unsigned Offset,
46  ASTNodeInfo ASTNode);
47 
48  /// \returns true to continue indexing, or false to abort.
49  virtual bool handleMacroOccurence(const IdentifierInfo *Name,
50  const MacroInfo *MI, SymbolRoleSet Roles,
51  FileID FID, unsigned Offset);
52 
53  /// \returns true to continue indexing, or false to abort.
54  virtual bool handleModuleOccurence(const ImportDecl *ImportD,
55  SymbolRoleSet Roles,
56  FileID FID, unsigned Offset);
57 
58  virtual void finish() {}
59 
60 private:
61  virtual void _anchor();
62 };
63 
64 } // namespace index
65 } // namespace clang
66 
67 #endif
virtual void setPreprocessor(std::shared_ptr< Preprocessor > PP)
virtual bool handleDeclOccurence(const Decl *D, SymbolRoleSet Roles, ArrayRef< SymbolRelation > Relations, FileID FID, unsigned Offset, ASTNodeInfo ASTNode)
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:86
One of these records is kept for each identifier that is lexed.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:149
uint32_t Offset
Definition: CacheTokens.cpp:43
unsigned SymbolRoleSet
Definition: IndexSymbol.h:116
Expr - This represents one expression.
Definition: Expr.h:106
Defines the clang::Preprocessor interface.
virtual bool handleModuleOccurence(const ImportDecl *ImportD, SymbolRoleSet Roles, FileID FID, unsigned Offset)
virtual void initialize(ASTContext &Ctx)
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:3965
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Dataflow Directional Tag Classes.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1252
Encapsulates the data about a macro definition (e.g.
Definition: MacroInfo.h:40
virtual bool handleMacroOccurence(const IdentifierInfo *Name, const MacroInfo *MI, SymbolRoleSet Roles, FileID FID, unsigned Offset)