[PATCH] D25049: Add missing std::move in Replacements::add
Alexander Shaposhnikov via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 28 15:08:57 PDT 2016
alexshap created this revision.
alexshap added reviewers: djasper, klimek, ioeric.
alexshap added a subscriber: cfe-commits.
alexshap set the repository for this revision to rL LLVM.
alexshap changed the visibility of this Differential Revision from "Public (No Login Required)" to "All Users".
Herald added a subscriber: klimek.
This diff adds std::move to avoid copying of the Replacement NewR in the method
Replacements::add.
The class Replacement has a move constructor:
clang-query> set output print
clang-query> match cxxConstructorDecl(ofClass(hasName("Replacement")), isMoveConstructor(), isDefinition()).bind("id")
Match #1:
Binding for "id":
inline Replacement(clang::tooling::Replacement &&) noexcept : FilePath(static_cast<clang::tooling::Replacement &&>().FilePath), ReplacementRange(static_cast<clang::tooling::Replacement &&>().ReplacementRange), ReplacementText(static_cast<clang::tooling::Replacement &&>().ReplacementText) {
}
Test plan: make -j8 check-all
Repository:
rL LLVM
https://reviews.llvm.org/D25049
Files:
lib/Tooling/Core/Replacement.cpp
Index: lib/Tooling/Core/Replacement.cpp
===================================================================
--- lib/Tooling/Core/Replacement.cpp
+++ lib/Tooling/Core/Replacement.cpp
@@ -245,7 +245,7 @@
R.getFilePath(), R.getOffset(), 0,
(R.getReplacementText() + I->getReplacementText()).str());
Replaces.erase(I);
- Replaces.insert(NewR);
+ Replaces.insert(std::move(NewR));
return llvm::Error::success();
}
// Insertion `R` is adjacent to a non-insertion replacement `I`, so they
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25049.72902.patch
Type: text/x-patch
Size: 538 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160928/02ba0b31/attachment.bin>
More information about the cfe-commits
mailing list