r238673 - [Format] Move UnwrappedLines instead of copying.

Benjamin Kramer benny.kra at googlemail.com
Sun May 31 04:18:05 PDT 2015


Author: d0k
Date: Sun May 31 06:18:05 2015
New Revision: 238673

URL: http://llvm.org/viewvc/llvm-project?rev=238673&view=rev
Log:
[Format] Move UnwrappedLines instead of copying.

No functional change intended.

Modified:
    cfe/trunk/lib/Format/UnwrappedLineParser.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=238673&r1=238672&r2=238673&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Sun May 31 06:18:05 2015
@@ -1762,15 +1762,12 @@ void UnwrappedLineParser::addUnwrappedLi
     if (CurrentLines == &Lines)
       printDebugInfo(*Line);
   });
-  CurrentLines->push_back(*Line);
+  CurrentLines->push_back(std::move(*Line));
   Line->Tokens.clear();
   if (CurrentLines == &Lines && !PreprocessorDirectives.empty()) {
-    for (SmallVectorImpl<UnwrappedLine>::iterator
-             I = PreprocessorDirectives.begin(),
-             E = PreprocessorDirectives.end();
-         I != E; ++I) {
-      CurrentLines->push_back(*I);
-    }
+    CurrentLines->append(
+        std::make_move_iterator(PreprocessorDirectives.begin()),
+        std::make_move_iterator(PreprocessorDirectives.end()));
     PreprocessorDirectives.clear();
   }
 }





More information about the cfe-commits mailing list