[PATCH] [clang-tidy] Add a checker that removes deducible arguments from std::make_pair

Alexander Kornienko alexfh at google.com
Tue Jul 15 06:11:57 PDT 2014


================
Comment at: clang-tools-extra/trunk/test/clang-tidy/google-explicit-make-pair.cpp:18
@@ +17,3 @@
+void templ(T a, T b) {
+  std::make_pair<T, unsigned>(a, b);
+}
----------------
Benjamin Kramer wrote:
> Alexander Kornienko wrote:
> > I assume the check should suggest replacements in cases where there are no dependent types, but could you add a test? And one more instantiation, so that we actually test a case where something can go wrong due to templates.
> We completely ignore code in template instantiations at the moment. It would be nice to check for code in templates that does not contain any dependencies on the template arguments but it's not tricky to match (or do we have an ASTMatcher for it?)
Yes, we ignore code in template _instantiations_. However, template _definitions_ are handled as usual. See a test for this in test/clang-tidy/avoid-c-style-casts.cpp:78

http://reviews.llvm.org/D4497






More information about the cfe-commits mailing list