[Lldb-commits] [lldb] r260445 - When importing Objective-C protocols, mark them as having external decls.

Sean Callanan via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 10 14:00:33 PST 2016


Author: spyffe
Date: Wed Feb 10 16:00:32 2016
New Revision: 260445

URL: http://llvm.org/viewvc/llvm-project?rev=260445&view=rev
Log:
When importing Objective-C protocols, mark them as having external decls.

We already do this for Objective-C interfaces, but we never handled protocols
because the DWARF didn't represent them.  Nowadays, though, we can import them
from modules, and we have to mark them properly.

<rdar://problem/24193009>

Modified:
    lldb/trunk/source/Symbol/ClangASTImporter.cpp

Modified: lldb/trunk/source/Symbol/ClangASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTImporter.cpp?rev=260445&r1=260444&r2=260445&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTImporter.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTImporter.cpp Wed Feb 10 16:00:32 2016
@@ -735,10 +735,10 @@ ClangASTImporter::Minion::ExecuteDeportW
             tag_decl->setHasExternalLexicalStorage(false);
             tag_decl->setHasExternalVisibleStorage(false);
         }
-        else if (ObjCInterfaceDecl *interface_decl = dyn_cast<ObjCInterfaceDecl>(decl))
+        else if (ObjCContainerDecl *container_decl = dyn_cast<ObjCContainerDecl>(decl))
         {
-            interface_decl->setHasExternalLexicalStorage(false);
-            interface_decl->setHasExternalVisibleStorage(false);
+            container_decl->setHasExternalLexicalStorage(false);
+            container_decl->setHasExternalVisibleStorage(false);
         }
         
         to_context_md->m_origins.erase(decl);
@@ -949,20 +949,32 @@ ClangASTImporter::Minion::Imported (clan
         to_namespace_decl->setHasExternalVisibleStorage();
     }
 
-    if (isa<ObjCInterfaceDecl>(from))
+    if (isa<ObjCContainerDecl>(from))
     {
-        ObjCInterfaceDecl *to_interface_decl = dyn_cast<ObjCInterfaceDecl>(to);
+        ObjCContainerDecl *to_container_decl = dyn_cast<ObjCContainerDecl>(to);
 
-        to_interface_decl->setHasExternalLexicalStorage();
-        to_interface_decl->setHasExternalVisibleStorage();
+        to_container_decl->setHasExternalLexicalStorage();
+        to_container_decl->setHasExternalVisibleStorage();
 
         /*to_interface_decl->setExternallyCompleted();*/
 
         if (log)
-            log->Printf("    [ClangASTImporter] To is an ObjCInterfaceDecl - attributes %s%s%s",
-                        (to_interface_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
-                        (to_interface_decl->hasExternalVisibleStorage() ? " Visible" : ""),
-                        (to_interface_decl->hasDefinition() ? " HasDefinition" : ""));
+        {
+            if (ObjCInterfaceDecl *to_interface_decl = llvm::dyn_cast<ObjCInterfaceDecl>(to_container_decl))
+            {
+                log->Printf("    [ClangASTImporter] To is an ObjCInterfaceDecl - attributes %s%s%s",
+                            (to_interface_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
+                            (to_interface_decl->hasExternalVisibleStorage() ? " Visible" : ""),
+                            (to_interface_decl->hasDefinition() ? " HasDefinition" : ""));
+            }
+            else
+            {
+                log->Printf("    [ClangASTImporter] To is an %sDecl - attributes %s%s",
+                            ((Decl*)to_container_decl)->getDeclKindName(),
+                            (to_container_decl->hasExternalLexicalStorage() ? " Lexical" : ""),
+                            (to_container_decl->hasExternalVisibleStorage() ? " Visible" : ""));
+            }
+        }
     }
 
     return clang::ASTImporter::Imported(from, to);




More information about the lldb-commits mailing list