1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:07:36 +00:00

LibJS: Fix all clang-tidy warnings in Bytecode/Op.h

- Add missing explicit to constructors
- Use move() where appropriate
This commit is contained in:
Andreas Kling 2021-06-12 11:22:46 +02:00
parent 68a307be4e
commit 06fdc26656

View file

@ -21,7 +21,7 @@ namespace JS::Bytecode::Op {
class Load final : public Instruction { class Load final : public Instruction {
public: public:
Load(Register src) explicit Load(Register src)
: Instruction(Type::Load) : Instruction(Type::Load)
, m_src(src) , m_src(src)
{ {
@ -36,7 +36,7 @@ private:
class LoadImmediate final : public Instruction { class LoadImmediate final : public Instruction {
public: public:
LoadImmediate(Value value) explicit LoadImmediate(Value value)
: Instruction(Type::LoadImmediate) : Instruction(Type::LoadImmediate)
, m_value(value) , m_value(value)
{ {
@ -51,7 +51,7 @@ private:
class Store final : public Instruction { class Store final : public Instruction {
public: public:
Store(Register dst) explicit Store(Register dst)
: Instruction(Type::Store) : Instruction(Type::Store)
, m_dst(dst) , m_dst(dst)
{ {
@ -91,7 +91,7 @@ private:
#define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \ #define JS_DECLARE_COMMON_BINARY_OP(OpTitleCase, op_snake_case) \
class OpTitleCase final : public Instruction { \ class OpTitleCase final : public Instruction { \
public: \ public: \
OpTitleCase(Register lhs_reg) \ explicit OpTitleCase(Register lhs_reg) \
: Instruction(Type::OpTitleCase) \ : Instruction(Type::OpTitleCase) \
, m_lhs_reg(lhs_reg) \ , m_lhs_reg(lhs_reg) \
{ \ { \
@ -131,9 +131,9 @@ JS_ENUMERATE_COMMON_UNARY_OPS(JS_DECLARE_COMMON_UNARY_OP)
class NewString final : public Instruction { class NewString final : public Instruction {
public: public:
NewString(StringTableIndex string) explicit NewString(StringTableIndex string)
: Instruction(Type::NewString) : Instruction(Type::NewString)
, m_string(move(string)) , m_string(string)
{ {
} }
@ -173,7 +173,7 @@ private:
// NOTE: This instruction is variable-width depending on the number of elements! // NOTE: This instruction is variable-width depending on the number of elements!
class NewArray final : public Instruction { class NewArray final : public Instruction {
public: public:
NewArray(Vector<Register> const& elements) explicit NewArray(Vector<Register> const& elements)
: Instruction(Type::NewArray) : Instruction(Type::NewArray)
, m_element_count(elements.size()) , m_element_count(elements.size())
{ {
@ -193,7 +193,7 @@ private:
class ConcatString final : public Instruction { class ConcatString final : public Instruction {
public: public:
ConcatString(Register lhs) explicit ConcatString(Register lhs)
: Instruction(Type::ConcatString) : Instruction(Type::ConcatString)
, m_lhs(lhs) , m_lhs(lhs)
{ {
@ -208,9 +208,9 @@ private:
class SetVariable final : public Instruction { class SetVariable final : public Instruction {
public: public:
SetVariable(StringTableIndex identifier) explicit SetVariable(StringTableIndex identifier)
: Instruction(Type::SetVariable) : Instruction(Type::SetVariable)
, m_identifier(move(identifier)) , m_identifier(identifier)
{ {
} }
@ -223,9 +223,9 @@ private:
class GetVariable final : public Instruction { class GetVariable final : public Instruction {
public: public:
GetVariable(StringTableIndex identifier) explicit GetVariable(StringTableIndex identifier)
: Instruction(Type::GetVariable) : Instruction(Type::GetVariable)
, m_identifier(move(identifier)) , m_identifier(identifier)
{ {
} }
@ -238,9 +238,9 @@ private:
class GetById final : public Instruction { class GetById final : public Instruction {
public: public:
GetById(StringTableIndex property) explicit GetById(StringTableIndex property)
: Instruction(Type::GetById) : Instruction(Type::GetById)
, m_property(move(property)) , m_property(property)
{ {
} }
@ -253,10 +253,10 @@ private:
class PutById final : public Instruction { class PutById final : public Instruction {
public: public:
PutById(Register base, StringTableIndex property) explicit PutById(Register base, StringTableIndex property)
: Instruction(Type::PutById) : Instruction(Type::PutById)
, m_base(base) , m_base(base)
, m_property(move(property)) , m_property(property)
{ {
} }
@ -453,8 +453,8 @@ class EnterUnwindContext final : public Instruction {
public: public:
EnterUnwindContext(Optional<Label> handler_target, Optional<Label> finalizer_target) EnterUnwindContext(Optional<Label> handler_target, Optional<Label> finalizer_target)
: Instruction(Type::EnterUnwindContext) : Instruction(Type::EnterUnwindContext)
, m_handler_target(handler_target) , m_handler_target(move(handler_target))
, m_finalizer_target(finalizer_target) , m_finalizer_target(move(finalizer_target))
{ {
} }
@ -481,7 +481,7 @@ class ContinuePendingUnwind final : public Instruction {
public: public:
constexpr static bool IsTerminator = true; constexpr static bool IsTerminator = true;
ContinuePendingUnwind(Label const& resume_target) explicit ContinuePendingUnwind(Label resume_target)
: Instruction(Type::ContinuePendingUnwind) : Instruction(Type::ContinuePendingUnwind)
, m_resume_target(resume_target) , m_resume_target(resume_target)
{ {
@ -518,7 +518,7 @@ private:
class PushLexicalEnvironment final : public Instruction { class PushLexicalEnvironment final : public Instruction {
public: public:
PushLexicalEnvironment(HashMap<u32, Variable> variables) explicit PushLexicalEnvironment(HashMap<u32, Variable> variables)
: Instruction(Type::PushLexicalEnvironment) : Instruction(Type::PushLexicalEnvironment)
, m_variables(move(variables)) , m_variables(move(variables))
{ {