From 4cb29abcdbffd3e3df7c9ef7ba4a87fa713d0160 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 6 Aug 2015 05:13:41 +0000 Subject: [PATCH] Update lldb's ExternalASTSources to match Clang r244161. llvm-svn: 244194 --- lldb/include/lldb/Expression/ClangASTSource.h | 15 +++++----- .../lldb/Symbol/ClangExternalASTSourceCallbacks.h | 9 ------ lldb/source/Expression/ClangASTSource.cpp | 33 +++++++++------------- .../ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp | 7 ----- 4 files changed, 22 insertions(+), 42 deletions(-) diff --git a/lldb/include/lldb/Expression/ClangASTSource.h b/lldb/include/lldb/Expression/ClangASTSource.h index 46140d2..e47cf6f 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 &Decls) override; + void FindExternalLexicalDecls( + const clang::DeclContext *DC, llvm::function_ref IsKindWeWant, + llvm::SmallVectorImpl &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 IsKindWeWant, llvm::SmallVectorImpl &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 41bb235..cbc56fe 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 &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 3988cd6..32fbb88 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 predicate, llvm::SmallVectorImpl &decls) { ClangASTMetrics::RegisterLexicalQuery(); @@ -431,11 +431,11 @@ ClangASTSource::FindExternalLexicalDecls (const DeclContext *decl_context, const Decl *context_decl = dyn_cast(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(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(m_ast_context), context_named_decl->getNameAsString().c_str(), context_decl->getDeclKindName(), - static_cast(context_decl), - (predicate ? "non-null" : "null")); + static_cast(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(m_ast_context), context_decl->getDeclKindName(), - static_cast(context_decl), - (predicate ? "non-null" : "null")); + static_cast(context_decl)); else - log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in a NULL context with %s predicate", - current_id, static_cast(m_ast_context), - (predicate ? "non-null" : "null")); + log->Printf("FindExternalLexicalDecls[%u] on (ASTContext*)%p in a NULL context", + current_id, static_cast(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(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(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 9b4fe4f..088df76 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 &Decls) override - { - return clang::ELR_Success; - } - void CompleteType(clang::TagDecl *tag_decl) override { -- 2.7.4