Skip to content

Commit 5a4f813

Browse files
committed
[lldb] Fix crash in SymbolFileCTF::ParseFunctions
Make SymbolFileCTF::ParseFunctions resilient against not being able to resolve the argument or return type of a function. ResolveTypeUID can fail for a variety of reasons so we should always check its result.
1 parent ef59069 commit 5a4f813

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lldb/source/Plugins/SymbolFile/CTF/SymbolFileCTF.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,8 @@ size_t SymbolFileCTF::ParseFunctions(CompileUnit &cu) {
802802
}
803803

804804
Type *arg_type = ResolveTypeUID(arg_uid);
805-
arg_types.push_back(arg_type->GetFullCompilerType());
805+
arg_types.push_back(arg_type ? arg_type->GetFullCompilerType()
806+
: CompilerType());
806807
}
807808

808809
if (symbol) {
@@ -813,8 +814,9 @@ size_t SymbolFileCTF::ParseFunctions(CompileUnit &cu) {
813814

814815
// Create function type.
815816
CompilerType func_type = m_ast->CreateFunctionType(
816-
ret_type->GetFullCompilerType(), arg_types.data(), arg_types.size(),
817-
is_variadic, 0, clang::CallingConv::CC_C);
817+
ret_type ? ret_type->GetFullCompilerType() : CompilerType(),
818+
arg_types.data(), arg_types.size(), is_variadic, 0,
819+
clang::CallingConv::CC_C);
818820
lldb::user_id_t function_type_uid = m_types.size() + 1;
819821
TypeSP type_sp =
820822
MakeType(function_type_uid, symbol->GetName(), 0, nullptr,

0 commit comments

Comments
 (0)