[Lldb-commits] [lldb] [lldb] Use if-with-initializer pattern in SBTarget (NFC) (PR #141284)
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Wed May 28 00:18:20 PDT 2025
================
@@ -2393,62 +2321,53 @@ lldb::addr_t SBTarget::GetStackRedZoneSize() {
bool SBTarget::IsLoaded(const SBModule &module) const {
LLDB_INSTRUMENT_VA(this, module);
- TargetSP target_sp(GetSP());
- if (!target_sp)
- return false;
-
- ModuleSP module_sp(module.GetSP());
- if (!module_sp)
- return false;
-
- return module_sp->IsLoadedInTarget(target_sp.get());
+ if (TargetSP target_sp = GetSP()) {
+ ModuleSP module_sp(module.GetSP());
+ if (module_sp)
----------------
labath wrote:
This is an interesting one, because this pattern comes into conflict with the "early exit" rule. For a small function like this, this is fine, but if it was longer, I'd say that the early exit should win.
https://github.com/llvm/llvm-project/pull/141284
More information about the lldb-commits
mailing list