[PATCH] D27166: [clang-tidy] Enhance modernize-use-auto to templated function casts

Alexander Kornienko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 02:31:42 PST 2016


alexfh added inline comments.


================
Comment at: clang-tidy/modernize/UseAutoCheck.cpp:173-177
+/// Matches the type that was substituted for the template parameter.
+AST_MATCHER_P(SubstTemplateTypeParmType, hasReplacementType,
+              ast_matchers::internal::Matcher<QualType>, InnerMatcher) {
+  return InnerMatcher.matches(Node.getReplacementType(), Finder, Builder);
+}
----------------
Ideally, this should go to ASTMatchers.h (with a proper test and documentation).


================
Comment at: clang-tidy/modernize/UseAutoCheck.cpp:256
+StatementMatcher makeDeclWithTemplateCastMatcher() {
+  auto ST = substTemplateTypeParmType(hasReplacementType(equalsBoundNode("a")));
+
----------------
It might make sense to use a more specific identifier than "a" to avoid collisions.


https://reviews.llvm.org/D27166





More information about the cfe-commits mailing list