aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/FileCheck/FileCheck.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@amd.com>2025-01-23 13:28:59 +0000
committerGitHub <noreply@github.com>2025-01-23 13:28:59 +0000
commitd3d605b7cdee132929d32f8b71b01641eb1d6d37 (patch)
tree63dac1c3a6335dc6ca29b29a449e7cdb2b661690 /llvm/lib/FileCheck/FileCheck.cpp
parent590e5e20b12f9fd956d0ba7de83aa2ab44c9faeb (diff)
downloadllvm-d3d605b7cdee132929d32f8b71b01641eb1d6d37.zip
llvm-d3d605b7cdee132929d32f8b71b01641eb1d6d37.tar.gz
llvm-d3d605b7cdee132929d32f8b71b01641eb1d6d37.tar.bz2
[FileCheck] Use move semantics instead of std::swap. NFC. (#123304)
This code was using a pre-move-semantics trick of using std::swap to avoid expensive vector copies.
Diffstat (limited to 'llvm/lib/FileCheck/FileCheck.cpp')
-rw-r--r--llvm/lib/FileCheck/FileCheck.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/FileCheck/FileCheck.cpp b/llvm/lib/FileCheck/FileCheck.cpp
index a6df967..5706afc 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;