[Lldb-commits] [lldb] [lldb][ClangASTImporter][NFC] Remove redundant do-while loop (PR #77596)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 10 04:40:27 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Michael Buch (Michael137)
<details>
<summary>Changes</summary>
This seems to have always been a redundant do-while since its introduction in `2e93a2ad2148d19337bf5f9885e46e3c00e8ab82`.
---
Full diff: https://github.com/llvm/llvm-project/pull/77596.diff
1 Files Affected:
- (modified) lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp (+25-27)
``````````diff
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
index 5d109feb3d39fa..d1e276f38506e7 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp
@@ -943,44 +943,42 @@ 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)));
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/77596
More information about the lldb-commits
mailing list