1 //===-- ClangDeclVendor.cpp -------------------------------------*- 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 #include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h" 10 11 #include "lldb/Symbol/ClangASTContext.h" 12 #include "lldb/Utility/ConstString.h" 13 14 using namespace lldb_private; 15 16 uint32_t ClangDeclVendor::FindDecls(ConstString name, bool append, 17 uint32_t max_matches, 18 std::vector<clang::NamedDecl *> &decls) { 19 if (!append) 20 decls.clear(); 21 22 std::vector<CompilerDecl> compiler_decls; 23 uint32_t ret = FindDecls(name, /*append*/ false, max_matches, compiler_decls); 24 for (CompilerDecl compiler_decl : compiler_decls) { 25 clang::Decl *d = static_cast<clang::Decl *>(compiler_decl.GetOpaqueDecl()); 26 clang::NamedDecl *nd = llvm::cast<clang::NamedDecl>(d); 27 decls.push_back(nd); 28 } 29 return ret; 30 } 31