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