This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] modernize-use-using: Fix broken fixit with 'template' keyword
ClosedPublic

Authored by mgehre on Apr 14 2020, 12:02 PM.

Details

Summary

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

template <typename a> class TemplateKeyword {
  typedef typename a::template b<> d;
  typedef typename a::template b<>::c d2;
};

into

template <typename a> class TemplateKeyword {
  using d = typename a::b<>;
  using d2 = typename a::template a::b<>::c;
};

The first one is missing the template keyword,
the second one has an extra a:: scope. Both result
in compilation errors.

Diff Detail

Event Timeline

mgehre created this revision.Apr 14 2020, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2020, 12:02 PM
Herald added a subscriber: xazax.hun. · View Herald Transcript
mgehre edited the summary of this revision. (Show Details)Apr 14 2020, 1:44 PM
njames93 added inline comments.Apr 15 2020, 3:49 AM
clang/lib/AST/NestedNameSpecifier.cpp
314

Can this be renamed as it shadows the SpecType variable from line 305, maybe DepSpecType.

clang/lib/AST/TypePrinter.cpp
1391–1392

This can be merged to one statement.

mgehre updated this revision to Diff 257774.Apr 15 2020, 11:22 AM
mgehre marked an inline comment as done.

Implement review comments (Thanks!)

mgehre marked an inline comment as done.Apr 15 2020, 11:22 AM
hokein accepted this revision.Apr 16 2020, 3:55 AM

thanks for fixing this.

This revision is now accepted and ready to land.Apr 16 2020, 3:55 AM
This revision was automatically updated to reflect the committed changes.