[PATCH] [Clang Tidy]: Use shrink_to_fit instead of copy and swap trick.
Alexander Kornienko
alexfh at google.com
Thu Jan 22 07:27:34 PST 2015
================
Comment at: clang-tidy/readability/ShrinkToFitCheck.cpp:51
@@ +50,3 @@
+ unaryOperator(
+ has((memberExpr(member(valueDecl().bind("CtorParam")))))),
+ unaryOperator(has((declRefExpr(
----------------
nit: It looks like there's one pair of parentheses more than needed. Also below on lines 57-59.
================
Comment at: test/clang-tidy/readability-shrink-to-fit.cpp:46
@@ +45,3 @@
+ // CHECK-FIXES: {{^ }}v.shrink_to_fit();{{$}}
+}
+
----------------
Can you add one more test?
in g():
...
T v2;
T(v2).swap(v2);
in h():
g<std::vector<int>>();
http://reviews.llvm.org/D7087
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
More information about the cfe-commits
mailing list