Skip to content

Commit cc4af7f

Browse files
Merge pull request #9639 from adrian-prantl/cherry-pick-swift-release-6.1-Add-missing-nullptr-checks
[Cherry-pick into swift/release/6.1] Add missing nullptr checks
2 parents 4aaf969 + 3018ee4 commit cc4af7f

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,10 +2486,10 @@ constexpr ExecutionContextScope *g_no_exe_ctx = nullptr;
24862486

24872487
#define FORWARD_TO_EXPRAST_ONLY(FUNC, ARGS, DEFAULT_RETVAL) \
24882488
do { \
2489-
auto target_sp = GetTargetWP().lock(); \
2490-
if (auto *swift_ast_ctx = GetSwiftASTContext( \
2491-
SymbolContext(target_sp, target_sp->GetExecutableModule()))) \
2492-
return swift_ast_ctx->FUNC ARGS; \
2489+
if (auto target_sp = GetTargetWP().lock()) \
2490+
if (auto *swift_ast_ctx = GetSwiftASTContext( \
2491+
SymbolContext(target_sp, target_sp->GetExecutableModule()))) \
2492+
return swift_ast_ctx->FUNC ARGS; \
24932493
return DEFAULT_RETVAL; \
24942494
} while (0)
24952495

@@ -2898,16 +2898,14 @@ uint32_t TypeSystemSwiftTypeRef::GetTypeInfo(
28982898
NodePointer node = dem.demangleSymbol(AsMangledName(type));
28992899
bool unresolved_typealias = false;
29002900
uint32_t flags = CollectTypeInfo(dem, node, unresolved_typealias);
2901-
if (unresolved_typealias) {
2902-
auto target_sp = GetTargetWP().lock();
2903-
if (auto *swift_ast_ctx = GetSwiftASTContext(
2904-
SymbolContext(target_sp, target_sp->GetExecutableModule()))) {
2905-
// If this is a typealias defined in the expression evaluator,
2906-
// then we don't have debug info to resolve it from.
2907-
return swift_ast_ctx->GetTypeInfo(ReconstructType(type),
2908-
pointee_or_element_clang_type);
2909-
}
2910-
}
2901+
if (unresolved_typealias)
2902+
if (auto target_sp = GetTargetWP().lock())
2903+
if (auto *swift_ast_ctx = GetSwiftASTContext(
2904+
SymbolContext(target_sp, target_sp->GetExecutableModule())))
2905+
// If this is a typealias defined in the expression evaluator,
2906+
// then we don't have debug info to resolve it from.
2907+
return swift_ast_ctx->GetTypeInfo(ReconstructType(type),
2908+
pointee_or_element_clang_type);
29112909
return flags;
29122910
};
29132911

0 commit comments

Comments
 (0)