[PATCH] D20964: [clang-tidy] Add modernize-use-emplace

Stanisław Barzowski via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 08:13:30 PDT 2016


sbarzowski added inline comments.

================
Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:28
@@ +27,3 @@
+
+  auto callPushBack =
+      cxxMemberCallExpr(hasDeclaration(functionDecl(hasName(PushBackName))),
----------------
Shouldn't it start with an uppercase letter?

================
Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:37
@@ +36,3 @@
+  // (and destructed) as in push_back case.
+  auto isCtorOfSmartPtr = hasDeclaration(cxxConstructorDecl(
+      ofClass(hasAnyName("std::shared_ptr", "std::unique_ptr", "std::auto_ptr",
----------------
Same

================
Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:41
@@ +40,3 @@
+
+  auto hasConstructExpr = has(ignoringParenImpCasts(
+      cxxConstructExpr(unless(isCtorOfSmartPtr)).bind("ctor")));
----------------
Same

================
Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:44
@@ +43,3 @@
+
+  auto ctorAsArgument = materializeTemporaryExpr(
+      anyOf(hasConstructExpr, has(cxxFunctionalCastExpr(hasConstructExpr))));
----------------
same


http://reviews.llvm.org/D20964





More information about the cfe-commits mailing list