mirror of
https://github.com/intel/llvm.git
synced 2026-01-15 12:25:46 +08:00
Change DeclContextFindDeclByName to return a vector of CompilerDecl objects. Opaque pointers should only be used for the decl context object. Also made a default implementation so that GoASTContext doesn't need to override DeclContextFindDeclByName.
llvm-svn: 255038
This commit is contained in:
@@ -564,7 +564,7 @@ public:
|
||||
// CompilerDeclContext override functions
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
std::vector<void *>
|
||||
std::vector<CompilerDecl>
|
||||
DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) override;
|
||||
|
||||
bool
|
||||
|
||||
@@ -100,12 +100,6 @@ class GoASTContext : public TypeSystem
|
||||
// CompilerDeclContext functions
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
std::vector<void *>
|
||||
DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) override
|
||||
{
|
||||
return std::vector<void *>();
|
||||
}
|
||||
|
||||
bool
|
||||
DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "lldb/Core/PluginInterface.h"
|
||||
#include "lldb/Expression/Expression.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
#include "lldb/Symbol/CompilerDecl.h"
|
||||
#include "lldb/Symbol/CompilerDeclContext.h"
|
||||
|
||||
class DWARFDIE;
|
||||
@@ -141,8 +142,8 @@ public:
|
||||
// CompilerDeclContext functions
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
virtual std::vector<void *>
|
||||
DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) = 0;
|
||||
virtual std::vector<CompilerDecl>
|
||||
DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name);
|
||||
|
||||
virtual bool
|
||||
DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) = 0;
|
||||
|
||||
@@ -9627,10 +9627,10 @@ ClangASTContext::DeclGetFunctionArgumentType (void *opaque_decl, size_t idx)
|
||||
// CompilerDeclContext functions
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
std::vector<void *>
|
||||
std::vector<CompilerDecl>
|
||||
ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name)
|
||||
{
|
||||
std::vector<void *> found_decls;
|
||||
std::vector<CompilerDecl> found_decls;
|
||||
if (opaque_decl_ctx)
|
||||
{
|
||||
DeclContext *root_decl_ctx = (DeclContext *)opaque_decl_ctx;
|
||||
@@ -9665,7 +9665,7 @@ ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString na
|
||||
{
|
||||
IdentifierInfo *ii = nd->getIdentifier();
|
||||
if (ii != nullptr && ii->getName().equals(name.AsCString(nullptr)))
|
||||
found_decls.push_back(nd);
|
||||
found_decls.push_back(CompilerDecl(this, nd));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9673,7 +9673,7 @@ ClangASTContext::DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString na
|
||||
{
|
||||
IdentifierInfo *ii = nd->getIdentifier();
|
||||
if (ii != nullptr && ii->getName().equals(name.AsCString(nullptr)))
|
||||
found_decls.push_back(nd);
|
||||
found_decls.push_back(CompilerDecl(this, nd));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,14 +17,10 @@ using namespace lldb_private;
|
||||
std::vector<CompilerDecl>
|
||||
CompilerDeclContext::FindDeclByName (ConstString name)
|
||||
{
|
||||
std::vector<CompilerDecl> found_decls;
|
||||
if (IsValid())
|
||||
{
|
||||
std::vector<void *> found_opaque_decls = m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name);
|
||||
for (void *opaque_decl : found_opaque_decls)
|
||||
found_decls.push_back(CompilerDecl(m_type_system, opaque_decl));
|
||||
}
|
||||
return found_decls;
|
||||
return m_type_system->DeclContextFindDeclByName(m_opaque_decl_ctx, name);
|
||||
else
|
||||
return std::vector<CompilerDecl>();
|
||||
}
|
||||
|
||||
bool
|
||||
|
||||
@@ -151,6 +151,14 @@ TypeSystem::DeclGetFunctionArgumentType (void *opaque_decl, size_t arg_idx)
|
||||
return CompilerType();
|
||||
}
|
||||
|
||||
|
||||
std::vector<CompilerDecl>
|
||||
TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name)
|
||||
{
|
||||
return std::vector<CompilerDecl>();
|
||||
}
|
||||
|
||||
|
||||
#pragma mark TypeSystemMap
|
||||
|
||||
TypeSystemMap::TypeSystemMap() :
|
||||
|
||||
Reference in New Issue
Block a user