Skip to content

[Cherry-pick into swift/release/6.1] Add missing nullptr checks #9639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions lldb/source/Plugins/TypeSystem/Swift/TypeSystemSwiftTypeRef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2487,10 +2487,10 @@ constexpr ExecutionContextScope *g_no_exe_ctx = nullptr;

#define FORWARD_TO_EXPRAST_ONLY(FUNC, ARGS, DEFAULT_RETVAL) \
do { \
auto target_sp = GetTargetWP().lock(); \
if (auto *swift_ast_ctx = GetSwiftASTContext( \
SymbolContext(target_sp, target_sp->GetExecutableModule()))) \
return swift_ast_ctx->FUNC ARGS; \
if (auto target_sp = GetTargetWP().lock()) \
if (auto *swift_ast_ctx = GetSwiftASTContext( \
SymbolContext(target_sp, target_sp->GetExecutableModule()))) \
return swift_ast_ctx->FUNC ARGS; \
return DEFAULT_RETVAL; \
} while (0)

Expand Down Expand Up @@ -2899,16 +2899,14 @@ uint32_t TypeSystemSwiftTypeRef::GetTypeInfo(
NodePointer node = dem.demangleSymbol(AsMangledName(type));
bool unresolved_typealias = false;
uint32_t flags = CollectTypeInfo(dem, node, unresolved_typealias);
if (unresolved_typealias) {
auto target_sp = GetTargetWP().lock();
if (auto *swift_ast_ctx = GetSwiftASTContext(
SymbolContext(target_sp, target_sp->GetExecutableModule()))) {
// If this is a typealias defined in the expression evaluator,
// then we don't have debug info to resolve it from.
return swift_ast_ctx->GetTypeInfo(ReconstructType(type),
pointee_or_element_clang_type);
}
}
if (unresolved_typealias)
if (auto target_sp = GetTargetWP().lock())
if (auto *swift_ast_ctx = GetSwiftASTContext(
SymbolContext(target_sp, target_sp->GetExecutableModule())))
// If this is a typealias defined in the expression evaluator,
// then we don't have debug info to resolve it from.
return swift_ast_ctx->GetTypeInfo(ReconstructType(type),
pointee_or_element_clang_type);
return flags;
};

Expand Down