[Lldb-commits] [lldb] 06ae374 - [lldb][NFC] Cleanup some if conditions in ASTImporterDelegate::Imported

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 24 04:49:47 PST 2020


Author: Raphael Isemann
Date: 2020-01-24T13:49:25+01:00
New Revision: 06ae3748db8a23568f2f238a9534ea9052725ea3

URL: https://github.com/llvm/llvm-project/commit/06ae3748db8a23568f2f238a9534ea9052725ea3
DIFF: https://github.com/llvm/llvm-project/commit/06ae3748db8a23568f2f238a9534ea9052725ea3.diff

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

Added: 
    

Modified: 
    lldb/source/Symbol/ClangASTImporter.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Symbol/ClangASTImporter.cpp b/lldb/source/Symbol/ClangASTImporter.cpp
index a8a6f02fdb1f..518157dc1c15 100644
--- a/lldb/source/Symbol/ClangASTImporter.cpp
+++ b/lldb/source/Symbol/ClangASTImporter.cpp
@@ -1057,10 +1057,8 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
                 static_cast<void *>(&from->getASTContext()));
     }
 
-    if (clang::NamespaceDecl *to_namespace =
-            dyn_cast<clang::NamespaceDecl>(to)) {
-      clang::NamespaceDecl *from_namespace =
-          dyn_cast<clang::NamespaceDecl>(from);
+    if (auto *to_namespace = dyn_cast<clang::NamespaceDecl>(to)) {
+      auto *from_namespace = cast<clang::NamespaceDecl>(from);
 
       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()));
   }
 
-  if (TagDecl *from_tag_decl = dyn_cast<TagDecl>(from)) {
-    TagDecl *to_tag_decl = dyn_cast<TagDecl>(to);
-
+  if (auto *to_tag_decl = dyn_cast<TagDecl>(to)) {
     to_tag_decl->setHasExternalLexicalStorage();
     to_tag_decl->getPrimaryContext()->setMustBuildLookupTable();
+    auto from_tag_decl = cast<TagDecl>(from);
 
     LLDB_LOGF(
         log,
@@ -1096,22 +1093,15 @@ void ClangASTImporter::ASTImporterDelegate::Imported(clang::Decl *from,
         (to_tag_decl->isCompleteDefinition() ? "complete" : "incomplete"));
   }
 
-  if (isa<NamespaceDecl>(from)) {
-    NamespaceDecl *to_namespace_decl = dyn_cast<NamespaceDecl>(to);
-
+  if (auto *to_namespace_decl = dyn_cast<NamespaceDecl>(to)) {
     m_master.BuildNamespaceMap(to_namespace_decl);
-
     to_namespace_decl->setHasExternalVisibleStorage();
   }
 
-  if (isa<ObjCContainerDecl>(from)) {
-    ObjCContainerDecl *to_container_decl = dyn_cast<ObjCContainerDecl>(to);
-
+  if (auto *to_container_decl = dyn_cast<ObjCContainerDecl>(to)) {
     to_container_decl->setHasExternalLexicalStorage();
     to_container_decl->setHasExternalVisibleStorage();
 
-    /*to_interface_decl->setExternallyCompleted();*/
-
     if (log) {
       if (ObjCInterfaceDecl *to_interface_decl =
               llvm::dyn_cast<ObjCInterfaceDecl>(to_container_decl)) {


        


More information about the lldb-commits mailing list