From fbb16073d15d49d82698d0947877e46256e03676 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 2 Apr 2020 14:55:29 +0200 Subject: [PATCH] LibJS: Make JS::Cell non-copyable and non-movable Also make the JS::Cell default constructor protected to provove a compilation error if you tried to allocate a plain cell. --- Libraries/LibJS/Runtime/Cell.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Libraries/LibJS/Runtime/Cell.h b/Libraries/LibJS/Runtime/Cell.h index f58ab904f1..f9ae449ab3 100644 --- a/Libraries/LibJS/Runtime/Cell.h +++ b/Libraries/LibJS/Runtime/Cell.h @@ -27,11 +27,15 @@ #pragma once #include +#include #include namespace JS { class Cell { + AK_MAKE_NONCOPYABLE(Cell); + AK_MAKE_NONMOVABLE(Cell); + public: virtual ~Cell() {} @@ -54,6 +58,9 @@ public: Heap& heap() const; Interpreter& interpreter(); +protected: + Cell() {} + private: bool m_mark { false }; bool m_live { true };