aboutsummaryrefslogtreecommitdiffstats
path: root/include/lldb/Symbol/DeclVendor.h
blob: 9c10fe1177fba13642c5bee67f8e7cea0cf2772a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//===-- DeclVendor.h --------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_DeclVendor_h_
#define liblldb_DeclVendor_h_

#include "lldb/Core/ClangForward.h"
#include "lldb/lldb-defines.h"

#include "clang/AST/ExternalASTMerger.h"

#include <vector>

namespace lldb_private {

// The Decl vendor class is intended as a generic interface to search for named
// declarations that are not necessarily backed by a specific symbol file.
class DeclVendor {
public:
  // Constructors and Destructors
  DeclVendor() {}

  virtual ~DeclVendor() {}

  /// Look up the set of Decls that the DeclVendor currently knows about
  /// matching a given name.
  ///
  /// \param[in] name
  ///     The name to look for.
  ///
  /// \param[in] append
  ///     If true, FindDecls will clear "decls" when it starts.
  ///
  /// \param[in] max_matches
  ///     The maximum number of Decls to return.  UINT32_MAX means "as
  ///     many as possible."
  ///
  /// \return
  ///     The number of Decls added to decls; will not exceed
  ///     max_matches.
  virtual uint32_t FindDecls(ConstString name, bool append,
                             uint32_t max_matches,
                             std::vector<clang::NamedDecl *> &decls) = 0;

  /// Look up the types that the DeclVendor currently knows about matching a
  /// given name.
  ///
  /// \param[in] name
  ///     The name to look for.
  ///
  /// \param[in] max_matches
  //      The maximum number of matches. UINT32_MAX means "as many as possible".
  ///
  /// \return
  ///     The vector of CompilerTypes that was found.
  std::vector<CompilerType> FindTypes(ConstString name, uint32_t max_matches);

  /// Interface for ExternalASTMerger.  Returns an ImporterSource 
  /// allowing type completion.
  ///
  /// \return
  ///     An ImporterSource for this DeclVendor.
  virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;

private:
  // For DeclVendor only
  DISALLOW_COPY_AND_ASSIGN(DeclVendor);
};

} // namespace lldb_private

#endif