[lldb][ClangASTImporter][NFC] Remove redundant do-while loop (#77596)

This seems to have always been a redundant do-while since its
introduction in `2e93a2ad2148d19337bf5f9885e46e3c00e8ab82`.
This commit is contained in:
Michael Buch 2024-01-10 13:08:11 +00:00 committed by GitHub
parent 60bb5c54f6
commit 5c0b3a0cb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -943,44 +943,41 @@ void ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo(
// the class was originally sourced from symbols.
if (ObjCInterfaceDecl *to_objc_interface = dyn_cast<ObjCInterfaceDecl>(to)) {
do {
ObjCInterfaceDecl *to_superclass = to_objc_interface->getSuperClass();
ObjCInterfaceDecl *to_superclass = to_objc_interface->getSuperClass();
if (to_superclass)
break; // we're not going to override it if it's set
if (to_superclass)
return; // we're not going to override it if it's set
ObjCInterfaceDecl *from_objc_interface =
dyn_cast<ObjCInterfaceDecl>(from);
ObjCInterfaceDecl *from_objc_interface = dyn_cast<ObjCInterfaceDecl>(from);
if (!from_objc_interface)
break;
if (!from_objc_interface)
return;
ObjCInterfaceDecl *from_superclass = from_objc_interface->getSuperClass();
ObjCInterfaceDecl *from_superclass = from_objc_interface->getSuperClass();
if (!from_superclass)
break;
if (!from_superclass)
return;
llvm::Expected<Decl *> imported_from_superclass_decl =
Import(from_superclass);
llvm::Expected<Decl *> imported_from_superclass_decl =
Import(from_superclass);
if (!imported_from_superclass_decl) {
LLDB_LOG_ERROR(log, imported_from_superclass_decl.takeError(),
"Couldn't import decl: {0}");
break;
}
if (!imported_from_superclass_decl) {
LLDB_LOG_ERROR(log, imported_from_superclass_decl.takeError(),
"Couldn't import decl: {0}");
return;
}
ObjCInterfaceDecl *imported_from_superclass =
dyn_cast<ObjCInterfaceDecl>(*imported_from_superclass_decl);
ObjCInterfaceDecl *imported_from_superclass =
dyn_cast<ObjCInterfaceDecl>(*imported_from_superclass_decl);
if (!imported_from_superclass)
break;
if (!imported_from_superclass)
return;
if (!to_objc_interface->hasDefinition())
to_objc_interface->startDefinition();
if (!to_objc_interface->hasDefinition())
to_objc_interface->startDefinition();
to_objc_interface->setSuperClass(m_source_ctx->getTrivialTypeSourceInfo(
m_source_ctx->getObjCInterfaceType(imported_from_superclass)));
} while (false);
to_objc_interface->setSuperClass(m_source_ctx->getTrivialTypeSourceInfo(
m_source_ctx->getObjCInterfaceType(imported_from_superclass)));
}
}