[clang-tools-extra] [clang-tidy] Fix bug in modernize-use-emplace (PR #66169)

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 17 10:53:00 PDT 2023


================
@@ -207,11 +211,13 @@ void UseEmplaceCheck::registerMatchers(MatchFinder *Finder) {
   auto HasConstructExpr = has(ignoringImplicit(SoughtConstructExpr));
 
   // allow for T{} to be replaced, even if no CTOR is declared
-  auto HasConstructInitListExpr = has(initListExpr(anyOf(
-      allOf(has(SoughtConstructExpr),
-            has(cxxConstructExpr(argumentCountIs(0)))),
-      has(cxxBindTemporaryExpr(has(SoughtConstructExpr),
-                               has(cxxConstructExpr(argumentCountIs(0))))))));
+  auto HasConstructInitListExpr =
+      has(initListExpr(anyOf(initCountIs(0), initCountIs(1)),
----------------
carlosgalvezp wrote:

Would it make sense to briefly document this choice of init list of exactly 0 or 1 arguments in the line above?

https://github.com/llvm/llvm-project/pull/66169


More information about the cfe-commits mailing list