Skip to content

Commit 0cc9cf9

Browse files
committed
Add missing nullptr checks
1 parent d425213 commit 0cc9cf9

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
@@ -2487,10 +2487,10 @@ constexpr ExecutionContextScope *g_no_exe_ctx = nullptr;
24872487

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

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

0 commit comments

Comments
 (0)