-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[cross-project-tests][DebugInfo] Make simplified-template-names test runnable on Darwin #168725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[cross-project-tests][DebugInfo] Make simplified-template-names test runnable on Darwin #168725
Conversation
…runnable on Darwin
|
Ah, I see the preferred name thing in more detail https://godbolt.org/z/Tjhrx5x6n Yeah, so we should plumb through the preferred name into the type rendering (presumably it's already plumbed through as an option - the whole point is for it to be used in type printing in diagnostics, so we probably just have to set the right printing policy from (aside: I think someone filed this bug recently, or I saw it going around, so you're probably already aware of it - but that preferred type |
Yea I looked into it briefly here: #164730 (comment) Looks like it falls out of how we walk the AST and canonicalize/create types in CGDebugInfo. But I forget the details. Yea would be good to fix. I guess we'd have to force creation of the alias before we unwrap it (or something like that) |
…econstructing DIE names (#168734) Depends on: * #168725 When compiling with `-glldb`, we repoint the `DW_AT_type` of a DIE to be a typedef that refers to the `preferred_name`. I.e.,: ``` template <typename T> structure t7; using t7i = t7<int>; template <typename T> struct __attribute__((__preferred_name__(t7i))) t7 {}; template <typename... Ts> void f1() int main() { f1<t7i>(); } ``` would produce following (minified) DWARF: ``` DW_TAG_subprogram DW_AT_name ("_STN|f1|<t7<int> >") DW_TAG_template_type_parameter DW_AT_type (0x0000299c "t7i") ... DW_TAG_typedef DW_AT_type (0x000029a7 "t7<int>") DW_AT_name ("t7i") ``` Note how the `DW_AT_type` of the template parameter is a typedef itself (instead of the canonical type). The `DWARFTypePrinter` would take the `DW_AT_name` of this typedef when reconstructing the name of `f1`, so we would end up with a verifier failure: ``` error: Simplified template DW_AT_name could not be reconstituted: original: f1<t7<int> > reconstituted: f1<t7i> ``` Fixing this allows us to un-XFAIL the `simplified-template-names.cpp` test in `cross-project-tests`. Unfortunately this is only tested on Darwin, where LLDB tuning is the default. AFAIK, there is no other case where the template parameter type wouldn't be canonical.
…defs when reconstructing DIE names (#168734) Depends on: * llvm/llvm-project#168725 When compiling with `-glldb`, we repoint the `DW_AT_type` of a DIE to be a typedef that refers to the `preferred_name`. I.e.,: ``` template <typename T> structure t7; using t7i = t7<int>; template <typename T> struct __attribute__((__preferred_name__(t7i))) t7 {}; template <typename... Ts> void f1() int main() { f1<t7i>(); } ``` would produce following (minified) DWARF: ``` DW_TAG_subprogram DW_AT_name ("_STN|f1|<t7<int> >") DW_TAG_template_type_parameter DW_AT_type (0x0000299c "t7i") ... DW_TAG_typedef DW_AT_type (0x000029a7 "t7<int>") DW_AT_name ("t7i") ``` Note how the `DW_AT_type` of the template parameter is a typedef itself (instead of the canonical type). The `DWARFTypePrinter` would take the `DW_AT_name` of this typedef when reconstructing the name of `f1`, so we would end up with a verifier failure: ``` error: Simplified template DW_AT_name could not be reconstituted: original: f1<t7<int> > reconstituted: f1<t7i> ``` Fixing this allows us to un-XFAIL the `simplified-template-names.cpp` test in `cross-project-tests`. Unfortunately this is only tested on Darwin, where LLDB tuning is the default. AFAIK, there is no other case where the template parameter type wouldn't be canonical.
The test was failing on Darwin for two reasons:
-fdebug-type-sectionsis not a recognized flag on DarwinThis patch addresses (1) by splitting the
-fdebug-type-sectionstests into a separate file (and only mark that oneUNSUPPORTED). Which means we can at least XFAIL the non-type-sections tests on Darwin.To fix (2) we might need to make the
DWARFTypePrinteraware of non-canonicalDW_AT_types of template parameters.