This is an archive of the discontinued LLVM Phabricator instance.

[clang][DebugInfo] Add DW_AT_default_value support for template template parameters
ClosedPublic

Authored by Michael137 on Dec 13 2022, 5:53 PM.

Details

Summary

After this patch, in the following snippet:

template <typename T> Foo {};

template <template <typename T> class CT = Foo> Bar {};

Bar<> b;

The debug-info entry for the CT template parameter will have
a DW_AT_default_value (true) attached to it.

Diff Detail

Event Timeline

Michael137 created this revision.Dec 13 2022, 5:53 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 13 2022, 5:53 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
Michael137 requested review of this revision.Dec 13 2022, 5:53 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptDec 13 2022, 5:53 PM
aprantl accepted this revision.Dec 14 2022, 9:24 AM
This revision is now accepted and ready to land.Dec 14 2022, 9:24 AM
dblaikie added inline comments.Dec 14 2022, 11:17 AM
clang/lib/CodeGen/CGDebugInfo.cpp
2091–2093

Could we pull this snipped out and do it before the switch - so we don't have to repeat it for each different kind of template parameter type?

Michael137 added inline comments.Dec 15 2022, 5:40 AM
clang/lib/CodeGen/CGDebugInfo.cpp
2091–2093

yup makes sense!

  • Remove now redundant isSubstitutedDefaultArgument call
Michael137 marked an inline comment as done.Dec 15 2022, 6:23 AM
dblaikie accepted this revision.Dec 15 2022, 12:30 PM

Looks good to me - we'd usually split the LLVM part from the Clang part, but I don't think we have fine grained unit tests for DIBuilder (could you check - if we do, then the LLVM part should go separately, with unit test coverage, then the Clang part can go in that uses it) & /maybe/ it's worth having a default value for the IsDefault argument, so any existing callers aren't broken, but I don't feel strongly about it if it all works, the number of external callers is probably quite small/not a big deal.

(if you do split up the clang/llvm parts into separate commits, no need to send them as separate reviews - you can commit them directly)

  • Split out LLVM changes into separate commit
This revision was landed with ongoing or failed builds.Dec 16 2022, 3:39 AM
This revision was automatically updated to reflect the committed changes.