summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Expression/ClangASTSource.h15
-rw-r--r--lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h9
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp33
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp7
4 files changed, 22 insertions, 42 deletions
diff --git a/lldb/include/lldb/Expression/ClangASTSource.h b/lldb/include/lldb/Expression/ClangASTSource.h
index 46140d2f2e6..e47cf6feecf 100644
--- a/lldb/include/lldb/Expression/ClangASTSource.h
+++ b/lldb/include/lldb/Expression/ClangASTSource.h
@@ -111,15 +111,15 @@ public:
/// The DeclContext being searched.
///
/// @param[in] isKindWeWant
- /// If non-NULL, a callback function that returns true given the
+ /// A callback function that returns true given the
/// DeclKinds of desired Decls, and false otherwise.
///
/// @param[in] Decls
/// A vector that is filled in with matching Decls.
//------------------------------------------------------------------
- clang::ExternalLoadResult FindExternalLexicalDecls(const clang::DeclContext *DC,
- bool (*isKindWeWant)(clang::Decl::Kind),
- llvm::SmallVectorImpl<clang::Decl *> &Decls) override;
+ void FindExternalLexicalDecls(
+ const clang::DeclContext *DC, llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
+ llvm::SmallVectorImpl<clang::Decl *> &Decls) override;
//------------------------------------------------------------------
/// Specify the layout of the contents of a RecordDecl.
@@ -249,11 +249,12 @@ public:
return m_original.FindExternalVisibleDeclsByName(DC, Name);
}
- clang::ExternalLoadResult
- FindExternalLexicalDecls(const clang::DeclContext *DC, bool (*isKindWeWant)(clang::Decl::Kind),
+ void
+ FindExternalLexicalDecls(const clang::DeclContext *DC,
+ llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
llvm::SmallVectorImpl<clang::Decl *> &Decls) override
{
- return m_original.FindExternalLexicalDecls(DC, isKindWeWant, Decls);
+ return m_original.FindExternalLexicalDecls(DC, IsKindWeWant, Decls);
}
void
diff --git a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
index 41bb235636f..cbc56fe6cc6 100644
--- a/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
+++ b/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
@@ -100,15 +100,6 @@ public:
return;
}
- clang::ExternalLoadResult
- FindExternalLexicalDecls(const clang::DeclContext *decl_ctx, bool (*isKindWeWant)(clang::Decl::Kind),
- llvm::SmallVectorImpl<clang::Decl *> &decls) override
- {
- // This is used to support iterating through an entire lexical context,
- // which isn't something the debugger should ever need to do.
- return clang::ELR_Failure;
- }
-
bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName decl_name) override;
void CompleteType(clang::TagDecl *tag_decl) override;
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 3988cd674af..32fbb88d8c5 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -419,9 +419,9 @@ ClangASTSource::GetCompleteObjCInterface (clang::ObjCInterfaceDecl *interface_de
return complete_iface_decl;
}
-clang::ExternalLoadResult
+void
ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
- bool (*predicate)(Decl::Kind),
+ llvm::function_ref<bool(Decl::Kind)> predicate,
llvm::SmallVectorImpl<Decl*> &decls)
{
ClangASTMetrics::RegisterLexicalQuery();
@@ -431,11 +431,11 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
const Decl *context_decl = dyn_cast<Decl>(decl_context);
if (!context_decl)
- return ELR_Failure;
+ return;
auto iter = m_active_lexical_decls.find(context_decl);
if (iter != m_active_lexical_decls.end())
- return ELR_Failure;
+ return;
m_active_lexical_decls.insert(context_decl);
ScopedLexicalDeclEraser eraser(m_active_lexical_decls, context_decl);
@@ -445,29 +445,26 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
if (log)
{
if (const NamedDecl *context_named_decl = dyn_cast<NamedDecl>(context_decl))
- log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in '%s' (%sDecl*)%p with %s predicate",
+ log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in '%s' (%sDecl*)%p",
current_id, static_cast<void*>(m_ast_context),
context_named_decl->getNameAsString().c_str(),
context_decl->getDeclKindName(),
- static_cast<const void*>(context_decl),
- (predicate ? "non-null" : "null"));
+ static_cast<const void*>(context_decl));
else if(context_decl)
- log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in (%sDecl*)%p with %s predicate",
+ log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in (%sDecl*)%p",
current_id, static_cast<void*>(m_ast_context),
context_decl->getDeclKindName(),
- static_cast<const void*>(context_decl),
- (predicate ? "non-null" : "null"));
+ static_cast<const void*>(context_decl));
else
- log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in a NULL context with %s predicate",
- current_id, static_cast<const void*>(m_ast_context),
- (predicate ? "non-null" : "null"));
+ log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in a NULL context",
+ current_id, static_cast<const void*>(m_ast_context));
}
Decl *original_decl = NULL;
ASTContext *original_ctx = NULL;
if (!m_ast_importer->ResolveDeclOrigin(context_decl, &original_decl, &original_ctx))
- return ELR_Failure;
+ return;
if (log)
{
@@ -501,7 +498,7 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
const DeclContext *original_decl_context = dyn_cast<DeclContext>(original_decl);
if (!original_decl_context)
- return ELR_Failure;
+ return;
for (TagDecl::decl_iterator iter = original_decl_context->decls_begin();
iter != original_decl_context->decls_end();
@@ -509,7 +506,7 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
{
Decl *decl = *iter;
- if (!predicate || predicate(decl->getKind()))
+ if (predicate(decl->getKind()))
{
if (log)
{
@@ -532,8 +529,6 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
m_ast_importer->RequireCompleteType(copied_field_type);
}
- decls.push_back(copied_decl);
-
DeclContext *decl_context_non_const = const_cast<DeclContext *>(decl_context);
if (copied_decl->getDeclContext() != decl_context)
@@ -548,7 +543,7 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context,
}
}
- return ELR_AlreadyLoaded;
+ return;
}
void
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
index 9b4fe4f2689..088df76281a 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -69,13 +69,6 @@ public:
return false;
}
- clang::ExternalLoadResult
- FindExternalLexicalDecls(const clang::DeclContext *DC, bool (*isKindWeWant)(clang::Decl::Kind),
- llvm::SmallVectorImpl<clang::Decl *> &Decls) override
- {
- return clang::ELR_Success;
- }
-
void
CompleteType(clang::TagDecl *tag_decl) override
{
OpenPOWER on IntegriCloud