DeclVendor.h revision 355940
1//===-- DeclVendor.h --------------------------------------------*- 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 liblldb_DeclVendor_h_
10#define liblldb_DeclVendor_h_
11
12#include "lldb/Core/ClangForward.h"
13#include "lldb/lldb-defines.h"
14
15#include "clang/AST/ExternalASTMerger.h"
16
17#include <vector>
18
19namespace lldb_private {
20
21// The Decl vendor class is intended as a generic interface to search for named
22// declarations that are not necessarily backed by a specific symbol file.
23class DeclVendor {
24public:
25  // Constructors and Destructors
26  DeclVendor() {}
27
28  virtual ~DeclVendor() {}
29
30  /// Look up the set of Decls that the DeclVendor currently knows about
31  /// matching a given name.
32  ///
33  /// \param[in] name
34  ///     The name to look for.
35  ///
36  /// \param[in] append
37  ///     If true, FindDecls will clear "decls" when it starts.
38  ///
39  /// \param[in] max_matches
40  ///     The maximum number of Decls to return.  UINT32_MAX means "as
41  ///     many as possible."
42  ///
43  /// \return
44  ///     The number of Decls added to decls; will not exceed
45  ///     max_matches.
46  virtual uint32_t FindDecls(ConstString name, bool append,
47                             uint32_t max_matches,
48                             std::vector<clang::NamedDecl *> &decls) = 0;
49
50  /// Look up the types that the DeclVendor currently knows about matching a
51  /// given name.
52  ///
53  /// \param[in] name
54  ///     The name to look for.
55  ///
56  /// \param[in] max_matches
57  //      The maximum number of matches. UINT32_MAX means "as many as possible".
58  ///
59  /// \return
60  ///     The vector of CompilerTypes that was found.
61  std::vector<CompilerType> FindTypes(ConstString name, uint32_t max_matches);
62
63  /// Interface for ExternalASTMerger.  Returns an ImporterSource
64  /// allowing type completion.
65  ///
66  /// \return
67  ///     An ImporterSource for this DeclVendor.
68  virtual clang::ExternalASTMerger::ImporterSource GetImporterSource() = 0;
69
70private:
71  // For DeclVendor only
72  DISALLOW_COPY_AND_ASSIGN(DeclVendor);
73};
74
75} // namespace lldb_private
76
77#endif
78