Skip to content

Commit 5c0b3a0

Browse files
authored
[lldb][ClangASTImporter][NFC] Remove redundant do-while loop (#77596)
This seems to have always been a redundant do-while since its introduction in `2e93a2ad2148d19337bf5f9885e46e3c00e8ab82`.
1 parent 60bb5c5 commit 5c0b3a0

File tree

1 file changed

+24
-27
lines changed

1 file changed

+24
-27
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -943,44 +943,41 @@ void ClangASTImporter::ASTImporterDelegate::ImportDefinitionTo(
943943
// the class was originally sourced from symbols.
944944

945945
if (ObjCInterfaceDecl *to_objc_interface = dyn_cast<ObjCInterfaceDecl>(to)) {
946-
do {
947-
ObjCInterfaceDecl *to_superclass = to_objc_interface->getSuperClass();
946+
ObjCInterfaceDecl *to_superclass = to_objc_interface->getSuperClass();
948947

949-
if (to_superclass)
950-
break; // we're not going to override it if it's set
948+
if (to_superclass)
949+
return; // we're not going to override it if it's set
951950

952-
ObjCInterfaceDecl *from_objc_interface =
953-
dyn_cast<ObjCInterfaceDecl>(from);
951+
ObjCInterfaceDecl *from_objc_interface = dyn_cast<ObjCInterfaceDecl>(from);
954952

955-
if (!from_objc_interface)
956-
break;
953+
if (!from_objc_interface)
954+
return;
957955

958-
ObjCInterfaceDecl *from_superclass = from_objc_interface->getSuperClass();
956+
ObjCInterfaceDecl *from_superclass = from_objc_interface->getSuperClass();
959957

960-
if (!from_superclass)
961-
break;
958+
if (!from_superclass)
959+
return;
962960

963-
llvm::Expected<Decl *> imported_from_superclass_decl =
964-
Import(from_superclass);
961+
llvm::Expected<Decl *> imported_from_superclass_decl =
962+
Import(from_superclass);
965963

966-
if (!imported_from_superclass_decl) {
967-
LLDB_LOG_ERROR(log, imported_from_superclass_decl.takeError(),
968-
"Couldn't import decl: {0}");
969-
break;
970-
}
964+
if (!imported_from_superclass_decl) {
965+
LLDB_LOG_ERROR(log, imported_from_superclass_decl.takeError(),
966+
"Couldn't import decl: {0}");
967+
return;
968+
}
971969

972-
ObjCInterfaceDecl *imported_from_superclass =
973-
dyn_cast<ObjCInterfaceDecl>(*imported_from_superclass_decl);
970+
ObjCInterfaceDecl *imported_from_superclass =
971+
dyn_cast<ObjCInterfaceDecl>(*imported_from_superclass_decl);
974972

975-
if (!imported_from_superclass)
976-
break;
973+
if (!imported_from_superclass)
974+
return;
977975

978-
if (!to_objc_interface->hasDefinition())
979-
to_objc_interface->startDefinition();
976+
if (!to_objc_interface->hasDefinition())
977+
to_objc_interface->startDefinition();
980978

981-
to_objc_interface->setSuperClass(m_source_ctx->getTrivialTypeSourceInfo(
982-
m_source_ctx->getObjCInterfaceType(imported_from_superclass)));
983-
} while (false);
979+
to_objc_interface->setSuperClass(m_source_ctx->getTrivialTypeSourceInfo(
980+
m_source_ctx->getObjCInterfaceType(imported_from_superclass)));
984981
}
985982
}
986983

0 commit comments

Comments
 (0)