disallow move/copy of `ScopedFile` (#4723)
This commit is contained in:
parent
cfba046408
commit
b53bb36798
|
@ -81,6 +81,12 @@ public:
|
|||
{
|
||||
return mFullPath;
|
||||
}
|
||||
|
||||
ScopedFile(const ScopedFile&) = delete;
|
||||
ScopedFile(ScopedFile&&) = delete;
|
||||
ScopedFile& operator=(const ScopedFile&) = delete;
|
||||
ScopedFile& operator=(ScopedFile&&) = delete;
|
||||
|
||||
private:
|
||||
const std::string mName;
|
||||
const std::string mPath;
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -56,10 +57,10 @@ private:
|
|||
settings.jobs = jobs;
|
||||
settings.showtime = showtime;
|
||||
ProcessExecutor executor(filemap, settings, *this);
|
||||
std::vector<ScopedFile> scopedfiles;
|
||||
std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
|
||||
scopedfiles.reserve(filemap.size());
|
||||
for (std::map<std::string, std::size_t>::const_iterator i = filemap.cbegin(); i != filemap.cend(); ++i)
|
||||
scopedfiles.emplace_back(i->first, data);
|
||||
scopedfiles.emplace_back(new ScopedFile(i->first, data));
|
||||
|
||||
ASSERT_EQUALS(result, executor.check());
|
||||
}
|
||||
|
|
|
@ -226,10 +226,10 @@ private:
|
|||
EXPECT_EQ("", settings.nomsg.addSuppressionLine(suppression));
|
||||
}
|
||||
ThreadExecutor executor(files, settings, *this);
|
||||
std::vector<ScopedFile> scopedfiles;
|
||||
std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
|
||||
scopedfiles.reserve(files.size());
|
||||
for (std::map<std::string, std::size_t>::const_iterator i = files.cbegin(); i != files.cend(); ++i)
|
||||
scopedfiles.emplace_back(i->first, code);
|
||||
scopedfiles.emplace_back(new ScopedFile(i->first, code));
|
||||
|
||||
const unsigned int exitCode = executor.check();
|
||||
|
||||
|
@ -254,10 +254,10 @@ private:
|
|||
EXPECT_EQ("", settings.nomsg.addSuppressionLine(suppression));
|
||||
}
|
||||
ProcessExecutor executor(files, settings, *this);
|
||||
std::vector<ScopedFile> scopedfiles;
|
||||
std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
|
||||
scopedfiles.reserve(files.size());
|
||||
for (std::map<std::string, std::size_t>::const_iterator i = files.cbegin(); i != files.cend(); ++i)
|
||||
scopedfiles.emplace_back(i->first, code);
|
||||
scopedfiles.emplace_back(new ScopedFile(i->first, code));
|
||||
|
||||
const unsigned int exitCode = executor.check();
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -56,10 +57,10 @@ private:
|
|||
settings.jobs = jobs;
|
||||
settings.showtime = showtime;
|
||||
ThreadExecutor executor(filemap, settings, *this);
|
||||
std::vector<ScopedFile> scopedfiles;
|
||||
std::vector<std::unique_ptr<ScopedFile>> scopedfiles;
|
||||
scopedfiles.reserve(filemap.size());
|
||||
for (std::map<std::string, std::size_t>::const_iterator i = filemap.cbegin(); i != filemap.cend(); ++i)
|
||||
scopedfiles.emplace_back(i->first, data);
|
||||
scopedfiles.emplace_back(new ScopedFile(i->first, data));
|
||||
|
||||
ASSERT_EQUALS(result, executor.check());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue