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