diff options
author | Matthias Gehre <gehre.matthias@gmail.com> | 2020-04-12 20:06:31 +0200 |
---|---|---|
committer | Matthias Gehre <gehre.matthias@gmail.com> | 2020-04-27 14:23:23 +0200 |
commit | 145dcef8bdf9da9684c9c4e34a8e6c45baafab74 (patch) | |
tree | 325f944b71731da12de772d42f9e25c1d8bd10cb /clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp | |
parent | f181f1b7f73e643fb5d10a6d07832c1a2fb34c0b (diff) | |
download | llvm-145dcef8bdf9da9684c9c4e34a8e6c45baafab74.zip llvm-145dcef8bdf9da9684c9c4e34a8e6c45baafab74.tar.gz llvm-145dcef8bdf9da9684c9c4e34a8e6c45baafab74.tar.bz2 |
[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
Diffstat (limited to 'clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp')
-rw-r--r-- | clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp index f352374..f6dc5c0 100644 --- a/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp +++ b/clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp @@ -58,6 +58,7 @@ void UseUsingCheck::check(const MatchFinder::MatchResult &Result) { printPolicy.SuppressScope = true; printPolicy.ConstantArraySizeAsWritten = true; printPolicy.UseVoidForZeroParams = false; + printPolicy.PrintInjectedClassNameWithArguments = false; std::string Type = MatchedDecl->getUnderlyingType().getAsString(printPolicy); std::string Name = MatchedDecl->getNameAsString(); |