Bug 1649071 - Replace the DISALLOW_COPY_AND_ASSIGN & DISALLOW_EVIL_CONSTRUCTORS macros with = delete; r=froydnj

Generated with:
./mach static-analysis check --checks="-*, modernize-replace-disallow-copy-and-assign-macro" --fix -j 10 <file>
and
./mach clang-format -p <file>
(as clang-apply-replacement doesn't reformat the change)

(with ~/.mozbuild/clang-tools/clang-tidy/bin/clang-tidy pointing to clang-tidy 11)

Differential Revision: https://phabricator.services.mozilla.com/D81489
This commit is contained in:
Sylvestre Ledru 2020-06-29 14:37:56 +00:00
parent 76e1706ca7
commit 68e6f06c65
10 changed files with 66 additions and 21 deletions

View File

@ -879,7 +879,9 @@ class ContentChild final : public PContentChild,
uint64_t mBrowsingContextFieldEpoch = 0;
nsRefPtrHashtable<nsCStringHashKey, JSProcessActorChild> mProcessActors;
DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
ContentChild(const ContentChild&) = delete;
const ContentChild& operator=(const ContentChild&) = delete;
};
inline nsISupports* ToSupports(mozilla::dom::ContentChild* aContentChild) {

View File

@ -42,7 +42,9 @@ class ContentProcess : public mozilla::ipc::ProcessChild {
mozilla::mscom::ProcessRuntime mCOMRuntime;
#endif
DISALLOW_EVIL_CONSTRUCTORS(ContentProcess);
ContentProcess(const ContentProcess&) = delete;
const ContentProcess& operator=(const ContentProcess&) = delete;
};
} // namespace dom

View File

@ -48,7 +48,11 @@ class PreallocatedProcessManagerImpl final : public nsIObserver {
PreallocatedProcessManagerImpl();
~PreallocatedProcessManagerImpl();
DISALLOW_EVIL_CONSTRUCTORS(PreallocatedProcessManagerImpl);
PreallocatedProcessManagerImpl(const PreallocatedProcessManagerImpl&) =
delete;
const PreallocatedProcessManagerImpl& operator=(
const PreallocatedProcessManagerImpl&) = delete;
void Init();
@ -196,8 +200,7 @@ already_AddRefed<ContentParent> PreallocatedProcessManagerImpl::Take(
process = mPreallocatedE10SProcess.forget();
if (process) {
MOZ_LOG(ContentParent::GetLog(), LogLevel::Debug,
("Reuse " DEFAULT_REMOTE_TYPE " process %p",
process.get()));
("Reuse " DEFAULT_REMOTE_TYPE " process %p", process.get()));
}
}
if (!process && !mPreallocatedProcesses.empty()) {

View File

@ -152,7 +152,10 @@ class ProcessPriorityManagerImpl final : public nsIObserver,
ProcessPriorityManagerImpl();
~ProcessPriorityManagerImpl();
DISALLOW_EVIL_CONSTRUCTORS(ProcessPriorityManagerImpl);
ProcessPriorityManagerImpl(const ProcessPriorityManagerImpl&) = delete;
const ProcessPriorityManagerImpl& operator=(
const ProcessPriorityManagerImpl&) = delete;
void Init();
@ -188,7 +191,10 @@ class ProcessPriorityManagerChild final : public nsIObserver {
ProcessPriorityManagerChild();
~ProcessPriorityManagerChild() = default;
DISALLOW_EVIL_CONSTRUCTORS(ProcessPriorityManagerChild);
ProcessPriorityManagerChild(const ProcessPriorityManagerChild&) = delete;
const ProcessPriorityManagerChild& operator=(
const ProcessPriorityManagerChild&) = delete;
void Init();

View File

@ -73,7 +73,10 @@ class ProcessPriorityManager final {
private:
ProcessPriorityManager();
DISALLOW_EVIL_CONSTRUCTORS(ProcessPriorityManager);
ProcessPriorityManager(const ProcessPriorityManager&) = delete;
const ProcessPriorityManager& operator=(const ProcessPriorityManager&) =
delete;
};
} // namespace mozilla

View File

@ -61,7 +61,11 @@ class OpenVRControllerManifestManager {
nsCString mAction;
nsDataHashtable<nsUint32HashKey, nsCString> mManifest;
DISALLOW_COPY_AND_ASSIGN(OpenVRControllerManifestManager);
OpenVRControllerManifestManager(const OpenVRControllerManifestManager&) =
delete;
const OpenVRControllerManifestManager& operator=(
const OpenVRControllerManifestManager&) = delete;
};
StaticRefPtr<OpenVRControllerManifestManager> sOpenVRControllerManifestManager;

View File

@ -60,7 +60,9 @@ class ChildReaper : public base::MessagePumpLibevent::SignalEvent,
pid_t process_;
private:
DISALLOW_EVIL_CONSTRUCTORS(ChildReaper);
ChildReaper(const ChildReaper&) = delete;
const ChildReaper& operator=(const ChildReaper&) = delete;
};
// Fear the reaper
@ -101,7 +103,9 @@ class ChildGrimReaper : public ChildReaper, public mozilla::Runnable {
process_ = 0;
}
DISALLOW_EVIL_CONSTRUCTORS(ChildGrimReaper);
ChildGrimReaper(const ChildGrimReaper&) = delete;
const ChildGrimReaper& operator=(const ChildGrimReaper&) = delete;
};
class ChildLaxReaper : public ChildReaper,
@ -136,7 +140,9 @@ class ChildLaxReaper : public ChildReaper,
}
private:
DISALLOW_EVIL_CONSTRUCTORS(ChildLaxReaper);
ChildLaxReaper(const ChildLaxReaper&) = delete;
const ChildLaxReaper& operator=(const ChildLaxReaper&) = delete;
};
} // namespace

View File

@ -378,7 +378,9 @@ class MutexBase {
class MutexBase {
pthread_mutex_t mMutex;
DISALLOW_COPY_AND_ASSIGN(MutexBase);
MutexBase(const MutexBase&) = delete;
const MutexBase& operator=(const MutexBase&) = delete;
public:
MutexBase() { pthread_mutex_init(&mMutex, nullptr); }
@ -392,7 +394,9 @@ class MutexBase {
class Mutex : private MutexBase {
bool mIsLocked;
DISALLOW_COPY_AND_ASSIGN(Mutex);
Mutex(const Mutex&) = delete;
const Mutex& operator=(const Mutex&) = delete;
public:
Mutex() : mIsLocked(false) {}
@ -420,7 +424,9 @@ class Mutex : private MutexBase {
static Mutex* gStateLock = nullptr;
class AutoLockState {
DISALLOW_COPY_AND_ASSIGN(AutoLockState);
AutoLockState(const AutoLockState&) = delete;
const AutoLockState& operator=(const AutoLockState&) = delete;
public:
AutoLockState() { gStateLock->Lock(); }
@ -428,7 +434,9 @@ class AutoLockState {
};
class AutoUnlockState {
DISALLOW_COPY_AND_ASSIGN(AutoUnlockState);
AutoUnlockState(const AutoUnlockState&) = delete;
const AutoUnlockState& operator=(const AutoUnlockState&) = delete;
public:
AutoUnlockState() { gStateLock->Unlock(); }
@ -461,7 +469,9 @@ class Thread {
Thread() : mBlockIntercepts(false) {}
DISALLOW_COPY_AND_ASSIGN(Thread);
Thread(const Thread&) = delete;
const Thread& operator=(const Thread&) = delete;
static DMD_THREAD_LOCAL(Thread*) tlsThread;
@ -504,7 +514,9 @@ DMD_THREAD_LOCAL(Thread*) Thread::tlsThread;
class AutoBlockIntercepts {
Thread* const mT;
DISALLOW_COPY_AND_ASSIGN(AutoBlockIntercepts);
AutoBlockIntercepts(const AutoBlockIntercepts&) = delete;
const AutoBlockIntercepts& operator=(const AutoBlockIntercepts&) = delete;
public:
explicit AutoBlockIntercepts(Thread* aT) : mT(aT) { mT->BlockIntercepts(); }

View File

@ -495,7 +495,9 @@ static GConst* gConst;
// Thread-local state.
class GTls {
DISALLOW_COPY_AND_ASSIGN(GTls);
GTls(const GTls&) = delete;
const GTls& operator=(const GTls&) = delete;
// When true, PHC does as little as possible.
//
@ -570,7 +572,10 @@ class GTls {
PHC_THREAD_LOCAL(bool) GTls::tlsIsDisabled;
class AutoDisableOnCurrentThread {
DISALLOW_COPY_AND_ASSIGN(AutoDisableOnCurrentThread);
AutoDisableOnCurrentThread(const AutoDisableOnCurrentThread&) = delete;
const AutoDisableOnCurrentThread& operator=(
const AutoDisableOnCurrentThread&) = delete;
public:
explicit AutoDisableOnCurrentThread() { GTls::DisableOnCurrentThread(); }

View File

@ -598,7 +598,9 @@ class PlatformWriter {
NativeFileDesc FileDesc() { return mFD; }
private:
DISALLOW_COPY_AND_ASSIGN(PlatformWriter);
PlatformWriter(const PlatformWriter&) = delete;
const PlatformWriter& operator=(const PlatformWriter&) = delete;
void WriteChar(char aChar) {
if (mPos == kBufferSize) {