This patch adds a new field to DIComposite metadata that
holds the type of the preferred name for a structure.
This will be used to encode the [[clang::preferred_name]]
attribute into DWARF.
Paths
| Differential D145076
[llvm][DebugInfo] Introduce new DW_AT_LLVM_preferred_name attribute AcceptedPublic Authored by Michael137 on Mar 1 2023, 8:53 AM.
Details
Diff Detail
Event TimelineMichael137 added a child revision: D145077: [clang][DebugInfo] Support DW_AT_LLVM_preferred_name attribute.Mar 1 2023, 8:55 AM Comment Actions Looks pretty good, some nitpicks inside.
This revision now requires changes to proceed.Mar 1 2023, 11:17 AM Michael137 marked an inline comment as done. Michael137 added inline comments.
Comment Actions (FWIW, reckon this is simple/easy enough to add to DWARF/worth filing DWARF standard issue for - at least once the current DWARF committee turmoil settles out. Not sure if there's been any discussion with the GNU side of the world about them implementing/adopting/using a source attribute like this. But, equally, pretty cheap to give this a while & see how it plays out/if it's as valuable/convenient as we hope it is before standardizing. No great cost to getting more implementation experience) Comment Actions
That's a good idea. I'll file one once this lands. This revision is now accepted and ready to land.Mar 3 2023, 8:25 AM Comment Actions
We were considering this. It does fit the use-case nicely by the sound of it. But for LLDB it was much more convenient for the preferred name to be encoded as a reference to the DIE, not a raw string (I haven't actually tried implementing it purely based on the name of the type. We'd have to do a lookup into the accelerator tables by name at the very least I guess)
Revision Contents
Diff 502082 llvm/include/llvm/BinaryFormat/Dwarf.def
llvm/include/llvm/IR/DebugInfoMetadata.h
llvm/lib/AsmParser/LLParser.cpp
llvm/lib/Bitcode/Reader/MetadataLoader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.h
llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp
llvm/lib/IR/AsmWriter.cpp
llvm/lib/IR/DebugInfoMetadata.cpp
llvm/lib/IR/LLVMContextImpl.h
llvm/test/Assembler/dicomposite-attr-preferred_name.ll
llvm/test/DebugInfo/attr-preferred_name.ll
|
This should be an LLVM attribute. There's no reason why it wouldn't work on FreeBSD which also uses clang+lldb, right?
Can you document this attribute in LangRef.rst or SourceLevelDebugging.rst?