This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] readability-avoid-const-params-in-decls template instantiation bugfix
ClosedPublic

Authored by malcolm.parsons on Sep 16 2016, 3:11 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

malcolm.parsons retitled this revision from to [clang-tidy] readability-avoid-const-params-in-decls template instantiation bugfix.
malcolm.parsons updated this object.
malcolm.parsons added a subscriber: cfe-commits.

Probably it also makes sense to reflect both lambda and template instantiation parts in documentation, since I find current wording totally confusing at the moment.

clang-tidy/readability/AvoidConstParamsInDecls.cpp
41 ↗(On Diff #71606)

ast_matchers:: is redundant here.

clang-tidy/readability/AvoidConstParamsInDecls.cpp
41 ↗(On Diff #71606)

You'd think so, but it didn't compile.

omtcyfz added inline comments.Sep 16 2016, 5:07 AM
clang-tidy/readability/AvoidConstParamsInDecls.cpp
41 ↗(On Diff #71606)

Ah, I see.

Also, please provide more info next time:

it didn't compile

doesn't give anything.

For the others: the actual problem is that llvm/tools/clang/include/clang/Basic/Specifiers.h has inline bool isTemplateInstantiation(TemplateSpecializationKind Kind) function. It might make sense to change name of the AST Matcher to something else in order to prevent collision. Thoughts, suggestions?

However, this, of course, is not in scope of the current patch.

alexfh requested changes to this revision.Sep 23 2016, 7:47 PM
alexfh edited edge metadata.
alexfh added inline comments.
clang-tidy/readability/AvoidConstParamsInDecls.cpp
39 ↗(On Diff #71606)

Would be helpful to expand on why we're ignoring only member function of class instantiations (and not instantiations of member or free standing functions, for example).

This revision now requires changes to proceed.Sep 23 2016, 7:47 PM
malcolm.parsons edited edge metadata.

Expand code comment

clang-tidy/readability/AvoidConstParamsInDecls.cpp
39 ↗(On Diff #71606)

AFAICT, template instantiations of member and free standing functions are definitions when the template is a definition.

alexfh accepted this revision.Sep 26 2016, 7:31 AM
alexfh edited edge metadata.

LG

This revision is now accepted and ready to land.Sep 26 2016, 7:31 AM
This revision was automatically updated to reflect the committed changes.