[PATCH] D20964: [clang-tidy] Add modernize-use-emplace
Piotr Padlewski via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 3 08:19:22 PDT 2016
Prazek updated this revision to Diff 59561.
Prazek marked an inline comment as done.
Prazek added a comment.
Fixed stuff
http://reviews.llvm.org/D20964
Files:
clang-tidy/modernize/UseEmplaceCheck.cpp
docs/ReleaseNotes.rst
docs/clang-tidy/checks/modernize-use-emplace.rst
Index: docs/clang-tidy/checks/modernize-use-emplace.rst
===================================================================
--- docs/clang-tidy/checks/modernize-use-emplace.rst
+++ docs/clang-tidy/checks/modernize-use-emplace.rst
@@ -3,9 +3,8 @@
modernize-use-emplace
=====================
-This check would look for cases when inserting new element into an STL
-container, but the element is constructed temporarily or is constructed just
-to be moved. It would also work with std::pair.
+This check look for cases when inserting new element into an STL
+container, but the element is constructed temporarily.
Before:
Index: docs/ReleaseNotes.rst
===================================================================
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -209,7 +209,7 @@
- New `modernize-use-emplace
<http://clang.llvm.org/extra/clang-tidy/checks/modernize-use-emplace.html>`_ check
- Finds calls that could be change to emplace.
+ Finds calls that could be changed to emplace.
- New `performance-faster-string-find
<http://clang.llvm.org/extra/clang-tidy/checks/performance-faster-string-find.html>`_ check
Index: clang-tidy/modernize/UseEmplaceCheck.cpp
===================================================================
--- clang-tidy/modernize/UseEmplaceCheck.cpp
+++ clang-tidy/modernize/UseEmplaceCheck.cpp
@@ -54,16 +54,16 @@
const auto *PushBackExpr = Result.Nodes.getNodeAs<MemberExpr>("push_back");
const auto *InnerCtorCall = Result.Nodes.getNodeAs<CXXConstructExpr>("ctor");
- auto functionNameSourceRange = CharSourceRange::getCharRange(
+ auto FunctionNameSourceRange = CharSourceRange::getCharRange(
PushBackExpr->getExprLoc(), Call->getArg(0)->getExprLoc());
auto Diag =
diag(PushBackExpr->getExprLoc(), "use emplace_back instead of push_back");
- if (functionNameSourceRange.getBegin().isMacroID())
+ if (FunctionNameSourceRange.getBegin().isMacroID())
return;
- Diag << FixItHint::CreateReplacement(functionNameSourceRange,
+ Diag << FixItHint::CreateReplacement(FunctionNameSourceRange,
"emplace_back(");
auto CallParensRange = InnerCtorCall->getParenOrBraceRange();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20964.59561.patch
Type: text/x-patch
Size: 2214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160603/7b2d4f41/attachment.bin>
More information about the cfe-commits
mailing list