@@ -537,83 +537,75 @@ uint32_t AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
537537 if (!append)
538538 decls.clear ();
539539
540- uint32_t ret = 0 ;
540+ // See if the type is already in our ASTContext.
541541
542- do {
543- // See if the type is already in our ASTContext.
544-
545- clang::ASTContext &ast_ctx = m_ast_ctx->getASTContext ();
546-
547- clang::IdentifierInfo &identifier_info =
548- ast_ctx.Idents .get (name.GetStringRef ());
549- clang::DeclarationName decl_name =
550- ast_ctx.DeclarationNames .getIdentifier (&identifier_info);
551-
552- clang::DeclContext::lookup_result lookup_result =
553- ast_ctx.getTranslationUnitDecl ()->lookup (decl_name);
554-
555- if (!lookup_result.empty ()) {
556- if (clang::ObjCInterfaceDecl *result_iface_decl =
557- llvm::dyn_cast<clang::ObjCInterfaceDecl>(*lookup_result.begin ())) {
558- if (log) {
559- clang::QualType result_iface_type =
560- ast_ctx.getObjCInterfaceType (result_iface_decl);
561-
562- uint64_t isa_value = LLDB_INVALID_ADDRESS;
563- if (std::optional<ClangASTMetadata> metadata =
564- m_ast_ctx->GetMetadata (result_iface_decl))
565- isa_value = metadata->GetISAPtr ();
566-
567- LLDB_LOGF (log,
568- " AOCTV::FT Found %s (isa 0x%" PRIx64 " ) in the ASTContext" ,
569- result_iface_type.getAsString ().data (), isa_value);
570- }
542+ clang::ASTContext &ast_ctx = m_ast_ctx->getASTContext ();
571543
572- decls.push_back (m_ast_ctx->GetCompilerDecl (result_iface_decl));
573- ret++;
574- break ;
575- } else {
576- LLDB_LOGF (log, " AOCTV::FT There's something in the ASTContext, but "
577- " it's not something we know about" );
578- break ;
544+ clang::IdentifierInfo &identifier_info =
545+ ast_ctx.Idents .get (name.GetStringRef ());
546+ clang::DeclarationName decl_name =
547+ ast_ctx.DeclarationNames .getIdentifier (&identifier_info);
548+
549+ clang::DeclContext::lookup_result lookup_result =
550+ ast_ctx.getTranslationUnitDecl ()->lookup (decl_name);
551+
552+ if (!lookup_result.empty ()) {
553+ if (clang::ObjCInterfaceDecl *result_iface_decl =
554+ llvm::dyn_cast<clang::ObjCInterfaceDecl>(*lookup_result.begin ())) {
555+ if (log) {
556+ clang::QualType result_iface_type =
557+ ast_ctx.getObjCInterfaceType (result_iface_decl);
558+
559+ uint64_t isa_value = LLDB_INVALID_ADDRESS;
560+ if (std::optional<ClangASTMetadata> metadata =
561+ m_ast_ctx->GetMetadata (result_iface_decl))
562+ isa_value = metadata->GetISAPtr ();
563+
564+ LLDB_LOGF (log,
565+ " AOCTV::FT Found %s (isa 0x%" PRIx64 " ) in the ASTContext" ,
566+ result_iface_type.getAsString ().data (), isa_value);
579567 }
580- } else if (log) {
581- LLDB_LOGF (log, " AOCTV::FT Couldn't find %s in the ASTContext " ,
582- name. AsCString ()) ;
568+
569+ decls. push_back (m_ast_ctx-> GetCompilerDecl (result_iface_decl));
570+ return 1 ;
583571 }
584572
585- // It's not. If it exists, we have to put it into our ASTContext.
573+ LLDB_LOGF (log, " AOCTV::FT There's something in the ASTContext, but "
574+ " it's not something we know about" );
575+ return 0 ;
576+ }
586577
587- ObjCLanguageRuntime::ObjCISA isa = m_runtime.GetISA (name);
578+ LLDB_LOGF (log, " AOCTV::FT Couldn't find %s in the ASTContext" ,
579+ name.AsCString ());
588580
589- if (!isa) {
590- LLDB_LOGF (log, " AOCTV::FT Couldn't find the isa" );
581+ // It's not. If it exists, we have to put it into our ASTContext.
591582
592- break ;
593- }
583+ ObjCLanguageRuntime::ObjCISA isa = m_runtime.GetISA (name);
594584
595- clang::ObjCInterfaceDecl *iface_decl = GetDeclForISA (isa);
585+ if (!isa) {
586+ LLDB_LOGF (log, " AOCTV::FT Couldn't find the isa" );
596587
597- if (!iface_decl) {
598- LLDB_LOGF (log,
599- " AOCTV::FT Couldn't get the Objective-C interface for "
600- " isa 0x%" PRIx64,
601- (uint64_t )isa);
588+ return 0 ;
589+ }
602590
603- break ;
604- }
591+ clang::ObjCInterfaceDecl *iface_decl = GetDeclForISA (isa);
605592
606- if (log) {
607- clang::QualType new_iface_type = ast_ctx.getObjCInterfaceType (iface_decl);
593+ if (!iface_decl) {
594+ LLDB_LOGF (log,
595+ " AOCTV::FT Couldn't get the Objective-C interface for "
596+ " isa 0x%" PRIx64,
597+ (uint64_t )isa);
608598
609- LLDB_LOG (log, " AOCTV::FT Created {0} (isa 0x{1:x})" ,
610- new_iface_type.getAsString (), (uint64_t )isa);
611- }
599+ return 0 ;
600+ }
612601
613- decls.push_back (m_ast_ctx->GetCompilerDecl (iface_decl));
614- ret++;
615- break ;
616- } while (false );
602+ if (log) {
603+ clang::QualType new_iface_type = ast_ctx.getObjCInterfaceType (iface_decl);
604+
605+ LLDB_LOG (log, " AOCTV::FT Created {0} (isa 0x{1:x})" ,
606+ new_iface_type.getAsString (), (uint64_t )isa);
607+ }
617608
618- return ret;
609+ decls.push_back (m_ast_ctx->GetCompilerDecl (iface_decl));
610+ return 1 ;
619611}
0 commit comments