Page MenuHomePhabricator

[clang-tidy] modernize-use-using: Fix broken fixit with InjectedClassName

Authored by mgehre on Apr 12 2020, 11:57 AM.



Before this PR, modernize-use-using would transform the typedef in

template <int A>
struct InjectedClassName {
  typedef InjectedClassName b;

into using b = InjectedClassName<A>; and

template <int>
struct InjectedClassNameWithUnnamedArgument {
  typedef InjectedClassNameWithUnnamedArgument b;

into using b = InjectedClassNameWithUnnamedArgument<>;.
The first fixit is surprising because its different than the code
before, but the second fixit doesn't even compile.

This PR adds an option to the TypePrinter to print InjectedClassNameType without
template parameters (i.e. as written).

Diff Detail

Event Timeline

mgehre created this revision.Apr 12 2020, 11:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 12 2020, 11:57 AM
Herald added a subscriber: xazax.hun. · View Herald Transcript
aaron.ballman accepted this revision.Apr 24 2020, 11:54 AM

LGTM aside from a commenting nit.


When a template arguments are... -> When a template argument is unnamed, printing it results in invalid C++ code.

This revision is now accepted and ready to land.Apr 24 2020, 11:54 AM
This revision was automatically updated to reflect the committed changes.