Page MenuHomePhabricator

Preserve typedef names in debug info for template type parameters
AbandonedPublic

Authored by probinson on Jul 20 2017, 6:36 PM.

Details

Summary

If a template instantiation uses a typedef'd name as a template parameter, this is usually resolved
to its underlying type when we generate the name of the instance in the debug info.
PS4 prefers to see the original parameter as in the source. Define an option that makes that happen,
and have the default for the option depend on debugger tuning.

This also provides some motivation for D14358.

Diff Detail

Event Timeline

probinson created this revision.Jul 20 2017, 6:36 PM
aprantl added inline comments.Jul 20 2017, 6:46 PM
include/clang/AST/PrettyPrinter.h
205

\brief is no longer necessary and just makes the source code harder to read.

include/clang/Basic/LangOptions.def
266

Perhaps PreserveSugarInTemplateTypes since it appears to also affect qualifiers?

dblaikie added inline comments.Jul 21 2017, 9:20 AM
include/clang/AST/TemplateBase.h
109–111

I'd like Richard Smith (currently on vacation) to take a look at the changes to the AST like this.

(maybe it should be preserving the type as written, including decltype, typeof, etc - and those can be stripped out later by debug info emission? Maybe there's a way this is useful for clang diagnostics as well - or could leverage/reuse techniques already used there)

include/clang/Basic/LangOptions.def
266

Which qualifiers did you have in mind? (normally qualifiers would have to be preserved, right? (eg: a template type parameter of 'const int' is distinct from a template type parameter of 'int', etc))

Though I tend to agree Sugar's probably a better/broader/more general term here - but would love to have concrete examples of what does end up being preserved here.

(also having 'debug' or similar (dwarf, etc) in the name of this option might be useful - not sure if there's prior art to draw from in terms of other debug related langopts)

This might be a silly question but why not do this by default?

probinson abandoned this revision.Sep 29 2017, 3:58 PM

Abandoning. This change is irrelevant to the SCE debugger, and while I believe it could be made more complete and better reflect the original source (which is what the DWARF spec says names should be), I do not have time to pursue it.

If somebody else feels moved to take it up, go ahead.