[lldb][NFC] Cleanup some if conditions in ASTImporterDelegate::Imported

This commit is contained in:
Raphael Isemann 2020-01-24 12:54:06 +01:00
parent 1b996faa15
commit 06ae3748db

View File

@ -1057,10 +1057,8 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
static_cast<void *>(&from->getASTContext())); static_cast<void *>(&from->getASTContext()));
} }
if (clang::NamespaceDecl *to_namespace = if (auto *to_namespace = dyn_cast<clang::NamespaceDecl>(to)) {
dyn_cast<clang::NamespaceDecl>(to)) { auto *from_namespace = cast<clang::NamespaceDecl>(from);
clang::NamespaceDecl *from_namespace =
dyn_cast<clang::NamespaceDecl>(from);
NamespaceMetaMap &namespace_maps = from_context_md->m_namespace_maps; NamespaceMetaMap &namespace_maps = from_context_md->m_namespace_maps;
@ -1081,11 +1079,10 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
static_cast<void *>(&to->getASTContext())); static_cast<void *>(&to->getASTContext()));
} }
if (TagDecl *from_tag_decl = dyn_cast<TagDecl>(from)) { if (auto *to_tag_decl = dyn_cast<TagDecl>(to)) {
TagDecl *to_tag_decl = dyn_cast<TagDecl>(to);
to_tag_decl->setHasExternalLexicalStorage(); to_tag_decl->setHasExternalLexicalStorage();
to_tag_decl->getPrimaryContext()->setMustBuildLookupTable(); to_tag_decl->getPrimaryContext()->setMustBuildLookupTable();
auto from_tag_decl = cast<TagDecl>(from);
LLDB_LOGF( LLDB_LOGF(
log, log,
@ -1096,22 +1093,15 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
(to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete")); (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"));
} }
if (isa<NamespaceDecl>(from)) { if (auto *to_namespace_decl = dyn_cast<NamespaceDecl>(to)) {
NamespaceDecl *to_namespace_decl = dyn_cast<NamespaceDecl>(to);
m_master.BuildNamespaceMap(to_namespace_decl); m_master.BuildNamespaceMap(to_namespace_decl);
to_namespace_decl->setHasExternalVisibleStorage(); to_namespace_decl->setHasExternalVisibleStorage();
} }
if (isa<ObjCContainerDecl>(from)) { if (auto *to_container_decl = dyn_cast<ObjCContainerDecl>(to)) {
ObjCContainerDecl *to_container_decl = dyn_cast<ObjCContainerDecl>(to);
to_container_decl->setHasExternalLexicalStorage(); to_container_decl->setHasExternalLexicalStorage();
to_container_decl->setHasExternalVisibleStorage(); to_container_decl->setHasExternalVisibleStorage();
/*to_interface_decl->setExternallyCompleted();*/
if (log) { if (log) {
if (ObjCInterfaceDecl *to_interface_decl = if (ObjCInterfaceDecl *to_interface_decl =
llvm::dyn_cast<ObjCInterfaceDecl>(to_container_decl)) { llvm::dyn_cast<ObjCInterfaceDecl>(to_container_decl)) {