[clang-tidy] modernize-use-using: Fix broken fixit with InjectedClassName
authorMatthias Gehre <gehre.matthias@gmail.com>
Sun, 12 Apr 2020 18:06:31 +0000 (20:06 +0200)
committerMatthias Gehre <gehre.matthias@gmail.com>
Mon, 27 Apr 2020 12:23:23 +0000 (14:23 +0200)
commit145dcef8bdf9da9684c9c4e34a8e6c45baafab74
tree325f944b71731da12de772d42f9e25c1d8bd10cb
parentf181f1b7f73e643fb5d10a6d07832c1a2fb34c0b
[clang-tidy] modernize-use-using: Fix broken fixit with InjectedClassName

Summary:
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).

Reviewers: aaron.ballman, alexfh, hokein, njames93

Subscribers: xazax.hun, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D77979
clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp
clang-tools-extra/test/clang-tidy/checkers/modernize-use-using.cpp
clang/include/clang/AST/PrettyPrinter.h
clang/lib/AST/TypePrinter.cpp