r282949 - Add missing std::move in Replacements::add

Alexander Shaposhnikov via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 30 14:05:46 PDT 2016


Author: alexshap
Date: Fri Sep 30 16:05:45 2016
New Revision: 282949

URL: http://llvm.org/viewvc/llvm-project?rev=282949&view=rev
Log:
Add missing std::move in Replacements::add

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

Modified:
    cfe/trunk/lib/Tooling/Core/Replacement.cpp

Modified: cfe/trunk/lib/Tooling/Core/Replacement.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Core/Replacement.cpp?rev=282949&r1=282948&r2=282949&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/Core/Replacement.cpp (original)
+++ cfe/trunk/lib/Tooling/Core/Replacement.cpp Fri Sep 30 16:05:45 2016
@@ -245,7 +245,7 @@ llvm::Error Replacements::add(const Repl
           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




More information about the cfe-commits mailing list