From 3f9de74ba16f7d0479665c98ef890246e00cb4c1 Mon Sep 17 00:00:00 2001 From: Sean Callanan Date: Wed, 10 Feb 2016 22:00:32 +0000 Subject: [PATCH] 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. llvm-svn: 260445 --- lldb/source/Symbol/ClangASTImporter.cpp | 34 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp index 1419370..6a3ae65 100644 --- a/lldb/source/Symbol/ClangASTImporter.cpp +++ b/lldb/source/Symbol/ClangASTImporter.cpp @@ -735,10 +735,10 @@ ClangASTImporter::Minion::ExecuteDeportWorkQueues () tag_decl->setHasExternalLexicalStorage(false); tag_decl->setHasExternalVisibleStorage(false); } - else if (ObjCInterfaceDecl *interface_decl = dyn_cast(decl)) + else if (ObjCContainerDecl *container_decl = dyn_cast(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 (clang::Decl *from, clang::Decl *to) to_namespace_decl->setHasExternalVisibleStorage(); } - if (isa(from)) + if (isa(from)) { - ObjCInterfaceDecl *to_interface_decl = dyn_cast(to); + ObjCContainerDecl *to_container_decl = dyn_cast(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(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); -- 2.7.4