Add a move assignment operator to TempFile. NFC.
llvm-svn: 318122
diff --git a/llvm/include/llvm/Support/FileSystem.h b/llvm/include/llvm/Support/FileSystem.h
index a9b4c98..3066498 100644
--- a/llvm/include/llvm/Support/FileSystem.h
+++ b/llvm/include/llvm/Support/FileSystem.h
@@ -712,6 +712,7 @@
static Expected<TempFile> create(const Twine &Model,
unsigned Mode = all_read | all_write);
TempFile(TempFile &&Other);
+ TempFile &operator=(TempFile &&Other);
// Name of the temporary file.
std::string TmpName;
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 54ea76b..63ea911 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -761,10 +761,12 @@
}
TempFile::TempFile(StringRef Name, int FD) : TmpName(Name), FD(FD) {}
-TempFile::TempFile(TempFile &&Other) {
+TempFile::TempFile(TempFile &&Other) { *this = std::move(Other); }
+TempFile &TempFile::operator=(TempFile &&Other) {
TmpName = std::move(Other.TmpName);
FD = Other.FD;
Other.Done = true;
+ return *this;
}
TempFile::~TempFile() { assert(Done); }