aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ExpressionParser
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser')
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt1
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp32
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp31
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h43
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp10
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp2
-rw-r--r--lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h5
7 files changed, 25 insertions, 99 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt b/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
index 2aae7d1..01d588f 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
+++ b/lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
@@ -5,7 +5,6 @@ add_lldb_library(lldbPluginExpressionParserClang
ClangASTImporter.cpp
ClangASTMetadata.cpp
ClangASTSource.cpp
- ClangDeclVendor.cpp
ClangExpressionDeclMap.cpp
ClangExpressionHelper.cpp
ClangExpressionParser.cpp
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index ebe7be4..0efeb2e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -8,7 +8,6 @@
#include "ClangASTSource.h"
-#include "ClangDeclVendor.h"
#include "ClangModulesDeclVendor.h"
#include "lldb/Core/Module.h"
@@ -799,7 +798,7 @@ void ClangASTSource::FindDeclInModules(NameSearchContext &context,
bool append = false;
uint32_t max_matches = 1;
- std::vector<clang::NamedDecl *> decls;
+ std::vector<CompilerDecl> decls;
if (!modules_decl_vendor->FindDecls(name, append, max_matches, decls))
return;
@@ -807,7 +806,8 @@ void ClangASTSource::FindDeclInModules(NameSearchContext &context,
LLDB_LOG(log, " CAS::FEVD Matching entity found for \"{0}\" in the modules",
name);
- clang::NamedDecl *const decl_from_modules = decls[0];
+ auto *const decl_from_modules =
+ llvm::cast<NamedDecl>(ClangUtil::GetDecl(decls[0]));
if (llvm::isa<clang::TypeDecl>(decl_from_modules) ||
llvm::isa<clang::ObjCContainerDecl>(decl_from_modules) ||
@@ -849,16 +849,16 @@ void ClangASTSource::FindDeclInObjCRuntime(NameSearchContext &context,
bool append = false;
uint32_t max_matches = 1;
- std::vector<clang::NamedDecl *> decls;
+ std::vector<CompilerDecl> decls;
- auto *clang_decl_vendor = llvm::cast<ClangDeclVendor>(decl_vendor);
+ auto *clang_decl_vendor = llvm::cast<DeclVendor>(decl_vendor);
if (!clang_decl_vendor->FindDecls(name, append, max_matches, decls))
return;
LLDB_LOG(log, " CAS::FEVD Matching type found for \"{0}\" in the runtime",
name);
- clang::Decl *copied_decl = CopyDecl(decls[0]);
+ clang::Decl *copied_decl = CopyDecl(ClangUtil::GetDecl(decls[0]));
clang::NamedDecl *copied_named_decl =
copied_decl ? dyn_cast<clang::NamedDecl>(copied_decl) : nullptr;
@@ -1081,14 +1081,14 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
ConstString interface_name(interface_decl->getNameAsString().c_str());
bool append = false;
uint32_t max_matches = 1;
- std::vector<clang::NamedDecl *> decls;
+ std::vector<CompilerDecl> decls;
if (!modules_decl_vendor->FindDecls(interface_name, append, max_matches,
decls))
break;
ObjCInterfaceDecl *interface_decl_from_modules =
- dyn_cast<ObjCInterfaceDecl>(decls[0]);
+ dyn_cast<ObjCInterfaceDecl>(ClangUtil::GetDecl(decls[0]));
if (!interface_decl_from_modules)
break;
@@ -1121,15 +1121,15 @@ void ClangASTSource::FindObjCMethodDecls(NameSearchContext &context) {
ConstString interface_name(interface_decl->getNameAsString().c_str());
bool append = false;
uint32_t max_matches = 1;
- std::vector<clang::NamedDecl *> decls;
+ std::vector<CompilerDecl> decls;
- auto *clang_decl_vendor = llvm::cast<ClangDeclVendor>(decl_vendor);
+ auto *clang_decl_vendor = llvm::cast<DeclVendor>(decl_vendor);
if (!clang_decl_vendor->FindDecls(interface_name, append, max_matches,
decls))
break;
ObjCInterfaceDecl *runtime_interface_decl =
- dyn_cast<ObjCInterfaceDecl>(decls[0]);
+ dyn_cast<ObjCInterfaceDecl>(ClangUtil::GetDecl(decls[0]));
if (!runtime_interface_decl)
break;
@@ -1254,13 +1254,13 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
bool append = false;
uint32_t max_matches = 1;
- std::vector<clang::NamedDecl *> decls;
+ std::vector<CompilerDecl> decls;
if (!modules_decl_vendor->FindDecls(class_name, append, max_matches, decls))
break;
DeclFromUser<const ObjCInterfaceDecl> interface_decl_from_modules(
- dyn_cast<ObjCInterfaceDecl>(decls[0]));
+ dyn_cast<ObjCInterfaceDecl>(ClangUtil::GetDecl(decls[0])));
if (!interface_decl_from_modules.IsValid())
break;
@@ -1297,14 +1297,14 @@ void ClangASTSource::FindObjCPropertyAndIvarDecls(NameSearchContext &context) {
bool append = false;
uint32_t max_matches = 1;
- std::vector<clang::NamedDecl *> decls;
+ std::vector<CompilerDecl> decls;
- auto *clang_decl_vendor = llvm::cast<ClangDeclVendor>(decl_vendor);
+ auto *clang_decl_vendor = llvm::cast<DeclVendor>(decl_vendor);
if (!clang_decl_vendor->FindDecls(class_name, append, max_matches, decls))
break;
DeclFromUser<const ObjCInterfaceDecl> interface_decl_from_runtime(
- dyn_cast<ObjCInterfaceDecl>(decls[0]));
+ dyn_cast<ObjCInterfaceDecl>(ClangUtil::GetDecl(decls[0])));
if (!interface_decl_from_runtime.IsValid())
break;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
deleted file mode 100644
index 867d4ff..0000000
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-//===-- ClangDeclVendor.cpp -----------------------------------------------===//
-//
-// 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
-//
-//===----------------------------------------------------------------------===//
-
-#include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h"
-#include "Plugins/ExpressionParser/Clang/ClangUtil.h"
-#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
-
-#include "lldb/Utility/ConstString.h"
-
-using namespace lldb_private;
-
-uint32_t ClangDeclVendor::FindDecls(ConstString name, bool append,
- uint32_t max_matches,
- std::vector<clang::NamedDecl *> &decls) {
- if (!append)
- decls.clear();
-
- std::vector<CompilerDecl> compiler_decls;
- uint32_t ret = FindDecls(name, /*append*/ false, max_matches, compiler_decls);
- for (CompilerDecl compiler_decl : compiler_decls) {
- clang::Decl *d = ClangUtil::GetDecl(compiler_decl);
- clang::NamedDecl *nd = llvm::cast<clang::NamedDecl>(d);
- decls.push_back(nd);
- }
- return ret;
-}
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
deleted file mode 100644
index a9b2d41..0000000
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h
+++ /dev/null
@@ -1,43 +0,0 @@
-//===-- ClangDeclVendor.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 LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDECLVENDOR_H
-#define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGDECLVENDOR_H
-
-#include "lldb/Symbol/DeclVendor.h"
-
-namespace clang {
-class NamedDecl;
-}
-
-namespace lldb_private {
-
-// A clang specialized extension to DeclVendor.
-class ClangDeclVendor : public DeclVendor {
-public:
- ClangDeclVendor(DeclVendorKind kind) : DeclVendor(kind) {}
-
- ~ClangDeclVendor() override = default;
-
- using DeclVendor::FindDecls;
-
- uint32_t FindDecls(ConstString name, bool append, uint32_t max_matches,
- std::vector<clang::NamedDecl *> &decls);
-
- static bool classof(const DeclVendor *vendor) {
- return vendor->GetKind() >= eClangDeclVendor &&
- vendor->GetKind() < eLastClangDeclVendor;
- }
-
-private:
- ClangDeclVendor(const ClangDeclVendor &) = delete;
- const ClangDeclVendor &operator=(const ClangDeclVendor &) = delete;
-};
-} // namespace lldb_private
-
-#endif
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 833bc3b..9cb8f7a 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1023,13 +1023,14 @@ void ClangExpressionDeclMap::LookupInModulesDeclVendor(
bool append = false;
uint32_t max_matches = 1;
- std::vector<clang::NamedDecl *> decls;
+ std::vector<CompilerDecl> decls;
if (!modules_decl_vendor->FindDecls(name, append, max_matches, decls))
return;
assert(!decls.empty() && "FindDecls returned true but no decls?");
- clang::NamedDecl *const decl_from_modules = decls[0];
+ auto *const decl_from_modules =
+ llvm::cast<NamedDecl>(ClangUtil::GetDecl(decls[0]));
LLDB_LOG(log,
" CAS::FEVD Matching decl found for "
@@ -1223,7 +1224,7 @@ bool ClangExpressionDeclMap::LookupFunction(
Target *target = m_parser_vars->m_exe_ctx.GetTargetPtr();
- std::vector<clang::NamedDecl *> decls_from_modules;
+ std::vector<CompilerDecl> decls_from_modules;
if (target) {
if (std::shared_ptr<ClangModulesDeclVendor> decl_vendor =
@@ -1314,7 +1315,8 @@ bool ClangExpressionDeclMap::LookupFunction(
}
if (!found_function_with_type_info) {
- for (clang::NamedDecl *decl : decls_from_modules) {
+ for (const CompilerDecl &compiler_decl : decls_from_modules) {
+ clang::Decl *decl = ClangUtil::GetDecl(compiler_decl);
if (llvm::isa<clang::FunctionDecl>(decl)) {
clang::NamedDecl *copied_decl =
llvm::cast_or_null<FunctionDecl>(CopyDecl(decl));
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
index 67984c5..b77e269 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp
@@ -226,7 +226,7 @@ void StoringDiagnosticConsumer::SetCurrentModuleProgress(
}
ClangModulesDeclVendor::ClangModulesDeclVendor()
- : ClangDeclVendor(eClangModuleDeclVendor) {}
+ : DeclVendor(eClangModuleDeclVendor) {}
ClangModulesDeclVendor::~ClangModulesDeclVendor() = default;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
index d820552..ad4d060 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h
@@ -9,17 +9,16 @@
#ifndef LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGMODULESDECLVENDOR_H
#define LLDB_SOURCE_PLUGINS_EXPRESSIONPARSER_CLANG_CLANGMODULESDECLVENDOR_H
+#include "lldb/Symbol/DeclVendor.h"
#include "lldb/Symbol/SourceModule.h"
#include "lldb/Target/Platform.h"
-#include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h"
-
#include <set>
#include <vector>
namespace lldb_private {
-class ClangModulesDeclVendor : public ClangDeclVendor {
+class ClangModulesDeclVendor : public DeclVendor {
public:
// Constructors and Destructors
ClangModulesDeclVendor();