[Lldb-commits] [lldb] r255038 - 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.
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Tue Dec 8 10:39:50 PST 2015
Author: gclayton
Date: Tue Dec 8 12:39:50 2015
New Revision: 255038
URL: http://llvm.org/viewvc/llvm-project?rev=255038&view=rev
Log:
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.
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/include/lldb/Symbol/GoASTContext.h
lldb/trunk/include/lldb/Symbol/TypeSystem.h
lldb/trunk/source/Symbol/ClangASTContext.cpp
lldb/trunk/source/Symbol/CompilerDeclContext.cpp
lldb/trunk/source/Symbol/TypeSystem.cpp
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=255038&r1=255037&r2=255038&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Dec 8 12:39:50 2015
@@ -564,7 +564,7 @@ public:
// CompilerDeclContext override functions
//----------------------------------------------------------------------
- std::vector<void *>
+ std::vector<CompilerDecl>
DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) override;
bool
Modified: lldb/trunk/include/lldb/Symbol/GoASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/GoASTContext.h?rev=255038&r1=255037&r2=255038&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/GoASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/GoASTContext.h Tue Dec 8 12:39:50 2015
@@ -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
{
Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=255038&r1=255037&r2=255038&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Tue Dec 8 12:39:50 2015
@@ -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;
Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=255038&r1=255037&r2=255038&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Dec 8 12:39:50 2015
@@ -9627,10 +9627,10 @@ ClangASTContext::DeclGetFunctionArgument
// 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::DeclContextFindDeclByNa
{
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::DeclContextFindDeclByNa
{
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));
}
}
}
Modified: lldb/trunk/source/Symbol/CompilerDeclContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/CompilerDeclContext.cpp?rev=255038&r1=255037&r2=255038&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/CompilerDeclContext.cpp (original)
+++ lldb/trunk/source/Symbol/CompilerDeclContext.cpp Tue Dec 8 12:39:50 2015
@@ -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
Modified: lldb/trunk/source/Symbol/TypeSystem.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/TypeSystem.cpp?rev=255038&r1=255037&r2=255038&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/TypeSystem.cpp (original)
+++ lldb/trunk/source/Symbol/TypeSystem.cpp Tue Dec 8 12:39:50 2015
@@ -151,6 +151,14 @@ TypeSystem::DeclGetFunctionArgumentType
return CompilerType();
}
+
+std::vector<CompilerDecl>
+TypeSystem::DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name)
+{
+ return std::vector<CompilerDecl>();
+}
+
+
#pragma mark TypeSystemMap
TypeSystemMap::TypeSystemMap() :
More information about the lldb-commits
mailing list