[PATCH] D70537: [clang] CGDebugInfo asserts `!DT.isNull()` when compiling with debug symbols

Vedant Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 22 11:20:30 PST 2019


vsk requested changes to this revision.
vsk added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang/lib/CodeGen/CGDebugInfo.cpp:1437
+        if (isa<VarTemplateSpecializationDecl>(V))
+          continue;
+
----------------
I see that we don't attempt to handle `VarTemplateSpecializationDecl` when emitting CodeView. But it looks like we generally do handle these when emitting DWARF. I think the problem you're trying to address has more to do with clang not being able to describe globals with undeduced types in debug info.

E.g. if I replace `auto` with `int` in your test case, I get (https://godbolt.org/z/gRpRws):

```
!17 = distinct !DIGlobalVariable(name: "value", linkageName: "_ZN6TypeId5valueIJiEEE", scope: !2, file: !8, line: 7, type: !14, isLocal: false, isDefinition: true, declaration: !13, templateParams: !18)
!18 = !{!19}
!19 = !DITemplateValueParameter(tag: DW_TAG_GNU_template_parameter_pack, name: "Args", value: !20)
```

Could you limit the scope of this patch to just ignore VarTemplateSpecializationDecl's with undeduced types? I think there's an example of how to do this in `CGDebugInfo::EmitUsingDecl`, you could factor that out and reuse it here.

Please also add a test case for the `s/auto/int/` example, to make sure that doesn't regress.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70537/new/

https://reviews.llvm.org/D70537





More information about the cfe-commits mailing list