diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp index a6df9672f8100..5706afc357fbd 100644 --- a/llvm/lib/FileCheck/FileCheck.cpp +++ b/llvm/lib/FileCheck/FileCheck.cpp @@ -1933,8 +1933,8 @@ bool FileCheck::readCheckFile( } // Okay, add the string we captured to the output vector and move on. - CheckStrings.emplace_back(P, UsedPrefix, PatternLoc); - std::swap(DagNotMatches, CheckStrings.back().DagNotStrings); + CheckStrings.emplace_back(std::move(P), UsedPrefix, PatternLoc, + std::move(DagNotMatches)); DagNotMatches = ImplicitNegativeChecks; } @@ -1963,8 +1963,8 @@ bool FileCheck::readCheckFile( if (!DagNotMatches.empty()) { CheckStrings.emplace_back( Pattern(Check::CheckEOF, PatternContext.get(), LineNumber + 1), - *Req.CheckPrefixes.begin(), SMLoc::getFromPointer(Buffer.data())); - std::swap(DagNotMatches, CheckStrings.back().DagNotStrings); + *Req.CheckPrefixes.begin(), SMLoc::getFromPointer(Buffer.data()), + std::move(DagNotMatches)); } return false; diff --git a/llvm/lib/FileCheck/FileCheckImpl.h b/llvm/lib/FileCheck/FileCheckImpl.h index c772eddd8ecd5..4715fa9c64b61 100644 --- a/llvm/lib/FileCheck/FileCheckImpl.h +++ b/llvm/lib/FileCheck/FileCheckImpl.h @@ -837,8 +837,9 @@ struct FileCheckString { /// Hold the DAG/NOT strings occurring in the input file. std::vector DagNotStrings; - FileCheckString(const Pattern &P, StringRef S, SMLoc L) - : Pat(P), Prefix(S), Loc(L) {} + FileCheckString(Pattern &&P, StringRef S, SMLoc L, + std::vector &&D) + : Pat(std::move(P)), Prefix(S), Loc(L), DagNotStrings(std::move(D)) {} /// Matches check string and its "not strings" and/or "dag strings". size_t Check(const SourceMgr &SM, StringRef Buffer, bool IsLabelScanMode,