[PATCH] [clang-tidy] Add a checker that removes deducible arguments from std::make_pair
Alexander Kornienko
alexfh at google.com
Tue Jul 15 02:30:47 PDT 2014
Looks good provided you address the comments.
================
Comment at: clang-tidy/google/ExplicitMakePairCheck.cpp:41
@@ +40,3 @@
+ const Expr *Arg0 = Call->getArg(0)->IgnoreParenImpCasts();
+ const Expr *Arg1 = Call->getArg(1)->IgnoreParenImpCasts();
+
----------------
nit: I'd better not crash here even if someone defines their own ::std::make_pair.
================
Comment at: clang-tidy/google/ExplicitMakePairCheck.cpp:43
@@ +42,3 @@
+
+ // If types don't match we suggest replacing with std::pair and explicit
+ // template arguments. Otherwise just remove the template arguments from
----------------
nit: Missing comma after "match"?
================
Comment at: test/clang-tidy/google-explicit-make-pair.cpp:16
@@ +15,3 @@
+
+void test(int i) {
+ std::make_pair<int, int>(i, i);
----------------
Please add tests with make_pair in template instantiations and in a macro.
http://reviews.llvm.org/D4497
More information about the cfe-commits
mailing list