[PATCH] D135405: fix handling of braced-init temporaries for modernize-use-emplace

Peter Wolf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 7 14:56:57 PDT 2022


BigPeet updated this revision to Diff 466197.
BigPeet added a comment.

applying clang-format


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D135405/new/

https://reviews.llvm.org/D135405

Files:
  clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp


Index: clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
===================================================================
--- clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
+++ clang-tools-extra/clang-tidy/modernize/UseEmplaceCheck.cpp
@@ -328,8 +328,8 @@
   auto Diag =
       EmplacyCall
           ? diag(TemporaryExpr ? TemporaryExpr->getBeginLoc()
-                               : CtorCall ? CtorCall->getBeginLoc()
-                                          : MakeCall->getBeginLoc(),
+                 : CtorCall    ? CtorCall->getBeginLoc()
+                               : MakeCall->getBeginLoc(),
                  "unnecessary temporary object created while calling %0")
           : diag(Call->getExprLoc(), "use emplace%select{|_back|_front}0 "
                                      "instead of push%select{|_back|_front}0");
@@ -369,10 +369,9 @@
     return;
 
   // FIXME: Will there ever be a CtorCall, if there is no TemporaryExpr?
-  const SourceLocation ExprBegin =
-      TemporaryExpr
-          ? TemporaryExpr->getExprLoc()
-          : CtorCall ? CtorCall->getExprLoc() : MakeCall->getExprLoc();
+  const SourceLocation ExprBegin = TemporaryExpr ? TemporaryExpr->getExprLoc()
+                                   : CtorCall    ? CtorCall->getExprLoc()
+                                                 : MakeCall->getExprLoc();
 
   // Range for constructor name and opening brace.
   const auto ParamCallSourceRange =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135405.466197.patch
Type: text/x-patch
Size: 1468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221007/577449cb/attachment.bin>


More information about the cfe-commits mailing list