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

Mitch Phillips via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 19:55:43 PDT 2022


hctim added a comment.

In D123534#3509667 <https://reviews.llvm.org/D123534#3509667>, @rnk wrote:

> 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.

Thanks for the pointer to the test. That was very helpful in figuring out how to invoke clang to produce CodeView/COFF. Funnily enough, it found a bug where I didn't realise I had to relax the invariant that a `DIGlobalVariable` needs a name in the LL parser.

I wonder whether it's feasible to re-use `FunctionLineTable` to encode `line:col` for data symbols. A hack for sure, and left as an exercise for the reader.


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