[Lldb-commits] [lldb] r244194 - Update lldb's ExternalASTSources to match Clang r244161.

Richard Smith richard-llvm at metafoo.co.uk
Wed Aug 5 22:13:41 PDT 2015


Author: rsmith
Date: Thu Aug  6 00:13:41 2015
New Revision: 244194

URL: http://llvm.org/viewvc/llvm-project?rev=244194&view=rev
Log:
Update lldb's ExternalASTSources to match Clang r244161.

Modified:
    lldb/trunk/include/lldb/Expression/ClangASTSource.h
    lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
    lldb/trunk/source/Expression/ClangASTSource.cpp
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp

Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=244194&r1=244193&r2=244194&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Thu Aug  6 00:13:41 2015
@@ -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

Modified: lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h?rev=244194&r1=244193&r2=244194&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h Thu Aug  6 00:13:41 2015
@@ -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;

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=244194&r1=244193&r2=244194&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Thu Aug  6 00:13:41 2015
@@ -419,9 +419,9 @@ ClangASTSource::GetCompleteObjCInterface
     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 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
     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 *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
     {
         Decl *decl = *iter;
 
-        if (!predicate || predicate(decl->getKind()))
+        if (predicate(decl->getKind()))
         {
             if (log)
             {
@@ -532,8 +529,6 @@ ClangASTSource::FindExternalLexicalDecls
                 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
         }
     }
 
-    return ELR_AlreadyLoaded;
+    return;
 }
 
 void

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp?rev=244194&r1=244193&r2=244194&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp Thu Aug  6 00:13:41 2015
@@ -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
     {




More information about the lldb-commits mailing list