[Format] Move UnwrappedLines instead of copying.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 31 May 2015 11:18:05 +0000 (11:18 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 31 May 2015 11:18:05 +0000 (11:18 +0000)
No functional change intended.

llvm-svn: 238673

clang/lib/Format/UnwrappedLineParser.cpp

index 662606c..83cbe76 100644 (file)
@@ -1762,15 +1762,12 @@ void UnwrappedLineParser::addUnwrappedLine() {
     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();
   }
 }