[PATCH] D123534: [dwarf] Emit a DIGlobalVariable for constant strings.

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 11:10:24 PDT 2022


rnk added a comment.

In D123534#3507891 <https://reviews.llvm.org/D123534#3507891>, @hctim wrote:

> Not sure about PDB. I did run a quick test with `gdb`, and very unscientifically, didn't notice any difference in usability or errors between pre- and post-this patch on a `clang` invocation under gdb.

That's good enough for me. Maybe there will be problems down the road, but the best way to find out is probably to land the change.

> Sorry, I know pretty nothing about PDB. Are you thinking that these DIGlobalVariables should be filtered out by this patch when outputting PDB, or a subsequent patch? I don't even have a Windows machine, so I wouldn't be at all confident in writing such a patch.

That's fine, a Windows machine shouldn't be necessary. This patch has to change the AsmPrinter for DWARF, so it makes sense that it should do the same for CodeView. I think it should be sufficient to continue this loop when a global variable display name is empty:
https://github.com/llvm/llvm-project/blob/main/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp#L3175

It will need a test, and the tests at llvm/test/DebugInfo/COFF/global* should be good templates. Basically, have a file with two globals, one named and unnamed, and use FileCheck to confirm that there is only one GDATA record.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D123534



More information about the cfe-commits mailing list