[Lldb-commits] [lldb] r174949 - Made LLDB build with the latest Clang. This meant

Sean Callanan scallanan at apple.com
Tue Feb 12 00:01:13 PST 2013


Author: spyffe
Date: Tue Feb 12 02:01:13 2013
New Revision: 174949

URL: http://llvm.org/viewvc/llvm-project?rev=174949&view=rev
Log:
Made LLDB build with the latest Clang.  This meant
changing the ClangASTSource to return a bool instead
of returning a list of results.  Our testsuite mostly
works with this change, but some minor issues may
remain both on LLDB's side and on Clang's side.

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/AppleObjCTypeVendor.cpp
    lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp

Modified: lldb/trunk/include/lldb/Expression/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Expression/ClangASTSource.h?rev=174949&r1=174948&r2=174949&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Expression/ClangASTSource.h (original)
+++ lldb/trunk/include/lldb/Expression/ClangASTSource.h Tue Feb 12 02:01:13 2013
@@ -98,7 +98,7 @@ public:
     /// @return
     ///     Whatever SetExternalVisibleDeclsForName returns.
     //------------------------------------------------------------------
-    clang::DeclContextLookupResult 
+    bool
     FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
                                     clang::DeclarationName Name);
     
@@ -248,7 +248,7 @@ public:
         {
         }
         
-        clang::DeclContextLookupResult 
+        bool
         FindExternalVisibleDeclsByName (const clang::DeclContext *DC,
                                         clang::DeclarationName Name)
         {

Modified: lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h?rev=174949&r1=174948&r2=174949&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h Tue Feb 12 02:01:13 2013
@@ -113,7 +113,7 @@ public:
         return clang::ELR_Failure;
     }
     
-    virtual clang::DeclContextLookupResult 
+    virtual bool
     FindExternalVisibleDeclsByName (const clang::DeclContext *decl_ctx,
                                     clang::DeclarationName decl_name);
     

Modified: lldb/trunk/source/Expression/ClangASTSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangASTSource.cpp?rev=174949&r1=174948&r2=174949&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangASTSource.cpp (original)
+++ lldb/trunk/source/Expression/ClangASTSource.cpp Tue Feb 12 02:01:13 2013
@@ -56,7 +56,7 @@ ClangASTSource::StartTranslationUnit(AST
 }
 
 // The core lookup interface.
-DeclContext::lookup_result 
+bool
 ClangASTSource::FindExternalVisibleDeclsByName
 (
     const DeclContext *decl_ctx, 
@@ -64,11 +64,17 @@ ClangASTSource::FindExternalVisibleDecls
 ) 
 {
     if (!m_ast_context)
-        return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+    {
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
+    }
     
     if (GetImportInProgress())
-        return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
-        
+    {
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
+    }
+    
     std::string decl_name (clang_decl_name.getAsString());
 
 //    if (m_decl_map.DoingASTImport ())
@@ -83,7 +89,8 @@ ClangASTSource::FindExternalVisibleDecls
             if (!identifier_info ||
                 identifier_info->getBuiltinID() != 0)
             {
-                return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+                SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+                return false;
             }
         }
         break;
@@ -91,12 +98,14 @@ ClangASTSource::FindExternalVisibleDecls
     // Operator names.  Not important for now.
     case DeclarationName::CXXOperatorName:
     case DeclarationName::CXXLiteralOperatorName:
-      return DeclContext::lookup_result();
+      SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+      return false;
             
     // Using directives found in this context.
     // Tell Sema we didn't find any or we'll end up getting asked a *lot*.
     case DeclarationName::CXXUsingDirective:
-      return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+      SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+      return false;
             
     case DeclarationName::ObjCZeroArgSelector:
     case DeclarationName::ObjCOneArgSelector:
@@ -108,13 +117,15 @@ ClangASTSource::FindExternalVisibleDecls
      
       FindObjCMethodDecls(method_search_context);
 
-      return SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, method_decls);
+      SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, method_decls);
+      return (method_decls.size() > 0);
     }
     // These aren't possible in the global context.
     case DeclarationName::CXXConstructorName:
     case DeclarationName::CXXDestructorName:
     case DeclarationName::CXXConversionFunctionName:
-      return DeclContext::lookup_result();
+      SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+      return false;
     }
 
 
@@ -128,7 +139,8 @@ ClangASTSource::FindExternalVisibleDecls
         }
         else
         {               
-            return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+            SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+            return false;
         }
     }
 
@@ -138,7 +150,8 @@ ClangASTSource::FindExternalVisibleDecls
     if (m_active_lookups.find (uniqued_const_decl_name) != m_active_lookups.end())
     {
         // We are currently looking up this name...
-        return DeclContext::lookup_result();
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
     }
     m_active_lookups.insert(uniqued_const_decl_name);
 //  static uint32_t g_depth = 0;
@@ -147,10 +160,10 @@ ClangASTSource::FindExternalVisibleDecls
     llvm::SmallVector<NamedDecl*, 4> name_decls;    
     NameSearchContext name_search_context(*this, name_decls, clang_decl_name, decl_ctx);
     FindExternalVisibleDecls(name_search_context);
-    DeclContext::lookup_result result (SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, name_decls));
+    SetExternalVisibleDeclsForName (decl_ctx, clang_decl_name, name_decls);
 //  --g_depth;
     m_active_lookups.erase (uniqued_const_decl_name);
-    return result;
+    return (name_decls.size() != 0);
 }
 
 void
@@ -1646,9 +1659,14 @@ ClangASTSource::AddNamespace (NameSearch
     
     if (!copied_decl)
         return NULL;
-    
+        
     NamespaceDecl *copied_namespace_decl = dyn_cast<NamespaceDecl>(copied_decl);
     
+    if (!copied_namespace_decl)
+        return NULL;
+    
+    context.m_decls.push_back(copied_namespace_decl);
+    
     m_ast_importer->RegisterNamespaceMap(copied_namespace_decl, namespace_decls);
     
     return dyn_cast<NamespaceDecl>(copied_decl);

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp?rev=174949&r1=174948&r2=174949&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeVendor.cpp Tue Feb 12 02:01:13 2013
@@ -30,7 +30,7 @@ public:
     {
     }
     
-    clang::DeclContextLookupResult
+    bool
     FindExternalVisibleDeclsByName (const clang::DeclContext *decl_ctx,
                                     clang::DeclarationName name)
     {
@@ -60,12 +60,15 @@ public:
 
             if (!m_type_vendor.FinishDecl(non_const_interface_decl))
                 break;
-                        
-            return non_const_interface_decl->lookup(name);
+            
+            clang::DeclContext::lookup_const_result result = non_const_interface_decl->lookup(name);
+            
+            return (result.size() != 0);
         }
         while(0);
         
-        return clang::DeclContextLookupResult();
+        SetNoExternalVisibleDeclsForName(decl_ctx, name);
+        return false;
     }
     
     clang::ExternalLoadResult

Modified: lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp?rev=174949&r1=174948&r2=174949&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp (original)
+++ lldb/trunk/source/Symbol/ClangExternalASTSourceCallbacks.cpp Tue Feb 12 02:01:13 2013
@@ -45,7 +45,7 @@
 using namespace clang;
 using namespace lldb_private;
 
-clang::DeclContextLookupResult 
+bool
 ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName 
 (
     const clang::DeclContext *decl_ctx,
@@ -58,9 +58,9 @@ ClangExternalASTSourceCallbacks::FindExt
         
         m_callback_find_by_name (m_callback_baton, decl_ctx, clang_decl_name, &results);
         
-        DeclContextLookupResult lookup_result (SetExternalVisibleDeclsForName(decl_ctx, clang_decl_name, results));
+        SetExternalVisibleDeclsForName(decl_ctx, clang_decl_name, results);
         
-        return lookup_result;
+        return (results.size() != 0);
     }
         
     std::string decl_name (clang_decl_name.getAsString());
@@ -70,55 +70,61 @@ ClangExternalASTSourceCallbacks::FindExt
     case clang::DeclarationName::Identifier:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"Identifier\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
         if (clang_decl_name.getAsIdentifierInfo()->getBuiltinID() != 0)
-            return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        {
+            SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+            return false;
+        }
         break;
 
     case clang::DeclarationName::ObjCZeroArgSelector:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCZeroArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::ObjCOneArgSelector:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCOneArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::ObjCMultiArgSelector:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"ObjCMultiArgSelector\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXConstructorName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXConstructorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
+
 
     case clang::DeclarationName::CXXDestructorName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXDestructorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXConversionFunctionName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXConversionFunctionName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXOperatorName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXOperatorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXLiteralOperatorName:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXLiteralOperatorName\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return DeclContext::lookup_result();
-        break;
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
 
     case clang::DeclarationName::CXXUsingDirective:
         //printf ("ClangExternalASTSourceCallbacks::FindExternalVisibleDeclsByName(decl_ctx = %p, decl_name = { kind = \"CXXUsingDirective\", name = \"%s\")\n", decl_ctx, decl_name.c_str());
-        return SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+        return false;
     }
 
-    return DeclContext::lookup_result();
+    SetNoExternalVisibleDeclsForName(decl_ctx, clang_decl_name);
+    return false;
 }
 
 void





More information about the lldb-commits mailing list