diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-11-14 00:31:28 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-11-14 00:31:28 +0000 |
| commit | e41151965f04bf631923343566a91c4904f100a6 (patch) | |
| tree | e2a3b9df7954e82cbbb2917a1f4b3d934edf8f45 /llvm | |
| parent | e66d232c05fdd4bab1b54e5983cee32f0b8ed555 (diff) | |
Add a move assignment operator to TempFile. NFC.
llvm-svn: 318122
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Support/FileSystem.h | 1 | ||||
| -rw-r--r-- | llvm/lib/Support/Path.cpp | 4 |
2 files changed, 4 insertions, 1 deletions
diff --git a/llvm/include/llvm/Support/FileSystem.h b/llvm/include/llvm/Support/FileSystem.h index a9b4c987e116..30664984efc9 100644 --- a/llvm/include/llvm/Support/FileSystem.h +++ b/llvm/include/llvm/Support/FileSystem.h @@ -712,6 +712,7 @@ public: 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 54ea76b0f92f..63ea9119fab5 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -761,10 +761,12 @@ std::error_code createUniqueFile(const Twine &Model, } 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); } |
