Add missing std::move in Replacements::add
authorAlexander Shaposhnikov <shal1t712@gmail.com>
Fri, 30 Sep 2016 21:05:45 +0000 (21:05 +0000)
committerAlexander Shaposhnikov <shal1t712@gmail.com>
Fri, 30 Sep 2016 21:05:45 +0000 (21:05 +0000)
This diff adds std::move to avoid copying of
the Replacement NewR in the method Replacements::add.

Test plan: make -j8 check-all

Differential revision: https://reviews.llvm.org/D25049

llvm-svn: 282949

clang/lib/Tooling/Core/Replacement.cpp

index 7a5fb85..bdca474 100644 (file)
@@ -245,7 +245,7 @@ llvm::Error Replacements::add(const Replacement &R) {
           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