[all-commits] [llvm/llvm-project] 145dce: [clang-tidy] modernize-use-using: Fix broken fixit...

Matthias Gehre via All-commits all-commits at lists.llvm.org
Mon Apr 27 05:23:44 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 145dcef8bdf9da9684c9c4e34a8e6c45baafab74
      https://github.com/llvm/llvm-project/commit/145dcef8bdf9da9684c9c4e34a8e6c45baafab74
  Author: Matthias Gehre <gehre.matthias at gmail.com>
  Date:   2020-04-27 (Mon, 27 Apr 2020)

  Changed paths:
    M clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp
    M clang-tools-extra/test/clang-tidy/checkers/modernize-use-using.cpp
    M clang/include/clang/AST/PrettyPrinter.h
    M clang/lib/AST/TypePrinter.cpp

  Log Message:
  -----------
  [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




More information about the All-commits mailing list