]> granicus.if.org Git - clang/commitdiff
[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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@238673 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/UnwrappedLineParser.cpp

index 662606cf4ccd8d494b6dd14725f5747c9258ae33..83cbe7642cb7037f875436ca586e24871288fe25 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();
   }
 }