[PATCH] D145803: [clang][DebugInfo] Emit DW_AT_type of preferred name if available
Michael Buch via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 10 13:59:18 PST 2023
Michael137 created this revision.
Michael137 added a reviewer: aprantl.
Herald added a project: All.
Michael137 added a comment.
Michael137 updated this revision to Diff 504274.
Michael137 updated this revision to Diff 504276.
Michael137 edited the summary of this revision.
Michael137 added a reviewer: dblaikie.
Michael137 published this revision for review.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Yet another alternative for emitting preferred_names.
Makes the attribute introduced in https://reviews.llvm.org/D145077 redundant. Also doesn't require any changes to LLDB (making https://reviews.llvm.org/D145078 redundant, which got a bit hairy)
aprantl added a comment.
This seems to be a much simpler implementation that just automatically works. I think I'd prefer that over adding new DWARF attributes.
Michael137 added a comment.
- Add test
Michael137 added a comment.
- Update commit message
[clang][DebugInfo] Emit DW_AT_type of preferred name if available
With this patch, whenever we emit a `DW_AT_type` for some declaration
and the type is a template class with a `clang::PreferredNameAttr`, we
will emit the typedef that the attribute refers to instead. I.e.,
0x123 DW_TAG_variable
DW_AT_name "var"
DW_AT_type (0x123 "basic_string<char>")
0x124 DW_TAG_structure_type
DW_AT_name "basic_string<char>"
...becomes
0x123 DW_TAG_variable
DW_AT_name "var"
DW_AT_type (0x124 "std::string")
0x124 DW_TAG_structure_type
DW_AT_name "basic_string<char>"
0x125 DW_TAG_typedef
DW_AT_name "std::string"
DW_AT_type (0x124 "basic_string<char>")
For now we keep this behind LLDB tuning.
**Testing**
- Added clang unit-test
- `check-llvm`, `check-clang` pass
- Confirmed that this change correctly repoints
`basic_string` references in some of my test programs.
- Will add follow-up LLDB API tests
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D145803
Files:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/CodeGen/CGDebugInfo.h
clang/test/CodeGen/preferred_name.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145803.504276.patch
Type: text/x-patch
Size: 7738 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230310/a447394c/attachment.bin>
More information about the cfe-commits
mailing list