Skip to content

Commit

Permalink
add debug info for function parameter types
Browse files Browse the repository at this point in the history
  • Loading branch information
rainers committed Dec 16, 2024
1 parent 6158df2 commit e6d3c58
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions gen/dibuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -725,11 +725,12 @@ DISubroutineType DIBuilder::CreateFunctionType(Type *type) {
assert(t);

Type *retType = t->next;

// Create "dummy" subroutine type for the return type
LLMetadata *params = {CreateTypeDescription(retType)};
llvm::SmallVector<LLMetadata *, 8> params;
params.emplace_back(CreateTypeDescription(retType));
if (auto parameters = t->parameterList.parameters)
for (auto &p : *parameters)
params.emplace_back(CreateTypeDescription(p->type));
auto paramsArray = DBuilder.getOrCreateTypeArray(params);

return DBuilder.createSubroutineType(paramsArray, DIFlags::FlagZero, 0);
}

Expand Down Expand Up @@ -809,6 +810,8 @@ DIType DIBuilder::CreateTypeDescription(Type *t, bool voidToUbyte) {
return CreateFunctionType(tf);
if (auto td = t->isTypeDelegate())
return CreateDelegateType(td);
if (auto tt = t->isTypeTuple())
return DBuilder.createUnspecifiedType(processDIName("tuple")); // TODO

// Crash if the type is not supported.
llvm_unreachable("Unsupported type in debug info");
Expand Down

0 comments on commit e6d3c58

Please sign in to comment.