[llvm] [Coroutines] Fix debug info scoping for nested structs in coroutine frames (PR #147622)

Adrian Vogelsgesang via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 8 19:10:55 PDT 2025


================
@@ -639,10 +639,10 @@ static DIType *solveDIType(DIBuilder &Builder, Type *Ty,
     SmallVector<Metadata *, 16> Elements;
     for (unsigned I = 0; I < StructTy->getNumElements(); I++) {
       DIType *DITy = solveDIType(Builder, StructTy->getElementType(I), Layout,
-                                 Scope, LineNum, DITypeCache);
+                                 DIStruct, LineNum, DITypeCache);
       assert(DITy);
       Elements.push_back(Builder.createMemberType(
-          Scope, DITy->getName(), Scope->getFile(), LineNum,
+          DIStruct, DITy->getName(), DIStruct->getFile(), LineNum,
----------------
vogelsgesang wrote:

afaict, the second change in `createMemberType` is the actually important one, correct? The change for the recursive call of `solveDIType` should be unnecessary to fix the crash?

Afaict, the parameter to `solveDIType` should only influence if the structs are modeled as "nested structs" or "sibling structs" in the DWARF debug info. Not sure which one we prefer here?

I guess sibling structs would feel more natural, since LLVM has no concept of nested structs, and `solveDIType` tries to mirror an LLVM struct hierarchy into debug info? If so, we should leave the parameters to `solveDIType` as they are

https://github.com/llvm/llvm-project/pull/147622


More information about the llvm-commits mailing list