[PATCH] D32395: [clang-tidy] modernize-use-emplace: remove unnecessary make_pair calls

Piotr Padlewski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 25 13:43:46 PDT 2017


Prazek added inline comments.


================
Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:115
+  const auto *MakePairCall = Result.Nodes.getNodeAs<CallExpr>("make_pair");
+  assert(InnerCtorCall || MakePairCall);
 
----------------
JDevlieghere wrote:
> It's highly recommended to put some kind of error message in the assertion statement, as per the LLVM coding standards.
would it be better to change it to
!innerCtorCall && !MakePairCall && "No .."


================
Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:22
+}
+} // namespace
+
----------------
extend the anonymous namespace to have static strings (and remove static)


================
Comment at: clang-tidy/modernize/UseEmplaceCheck.cpp:90
+  auto makePair = ignoringImplicit(
+      callExpr(callee(expr(ignoringParenImpCasts(
+          declRefExpr(unless(hasExplicitTemplateArgs()),
----------------
Why ignoringParenImpCasts instead of ingnoringImplicit?


https://reviews.llvm.org/D32395





More information about the cfe-commits mailing list