Coverage Report

Created: 2023-11-11 10:31

/Users/buildslave/jenkins/workspace/coverage/llvm-project/clang/include/clang/Index/IndexDataConsumer.h
Line
Count
Source (jump to first uncovered line)
1
//===--- IndexDataConsumer.h - Abstract index data consumer -----*- C++ -*-===//
2
//
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
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLVM_CLANG_INDEX_INDEXDATACONSUMER_H
10
#define LLVM_CLANG_INDEX_INDEXDATACONSUMER_H
11
12
#include "clang/Index/IndexSymbol.h"
13
#include "clang/Lex/Preprocessor.h"
14
15
namespace clang {
16
  class ASTContext;
17
  class DeclContext;
18
  class Expr;
19
  class FileID;
20
  class IdentifierInfo;
21
  class ImportDecl;
22
  class MacroInfo;
23
24
namespace index {
25
26
class IndexDataConsumer {
27
public:
28
  struct ASTNodeInfo {
29
    const Expr *OrigE;
30
    const Decl *OrigD;
31
    const Decl *Parent;
32
    const DeclContext *ContainerDC;
33
  };
34
35
97
  virtual ~IndexDataConsumer() = default;
36
37
73
  virtual void initialize(ASTContext &Ctx) {}
38
39
0
  virtual void setPreprocessor(std::shared_ptr<Preprocessor> PP) {}
40
41
  /// \returns true to continue indexing, or false to abort.
42
  virtual bool handleDeclOccurrence(const Decl *D, SymbolRoleSet Roles,
43
                                    ArrayRef<SymbolRelation> Relations,
44
0
                                    SourceLocation Loc, ASTNodeInfo ASTNode) {
45
0
    return true;
46
0
  }
47
48
  /// \returns true to continue indexing, or false to abort.
49
  virtual bool handleMacroOccurrence(const IdentifierInfo *Name,
50
                                     const MacroInfo *MI, SymbolRoleSet Roles,
51
17.7k
                                     SourceLocation Loc) {
52
17.7k
    return true;
53
17.7k
  }
54
55
  /// \returns true to continue indexing, or false to abort.
56
  ///
57
  /// This will be called for each module reference in an import decl.
58
  /// For "@import MyMod.SubMod", there will be a call for 'MyMod' with the
59
  /// 'reference' role, and a call for 'SubMod' with the 'declaration' role.
60
  virtual bool handleModuleOccurrence(const ImportDecl *ImportD,
61
                                      const Module *Mod, SymbolRoleSet Roles,
62
0
                                      SourceLocation Loc) {
63
0
    return true;
64
0
  }
65
66
48
  virtual void finish() {}
67
};
68
69
} // namespace index
70
} // namespace clang
71
72
#endif