Commit b75a778c authored by Florian Sattler's avatar Florian Sattler Committed by Commit Bot

[cleanup] Fix torque classes, removing unnecessary copies.

Fixing clang-tidy warning.

Bug: v8:8015
Change-Id: I0ba7bd3bf3665d4fb43f89b4cc9ab403d974930f
Reviewed-on: https://chromium-review.googlesource.com/1228067Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Florian Sattler <sattlerf@google.com>
Cr-Commit-Position: refs/heads/master@{#56060}
parent ec216398
......@@ -171,7 +171,7 @@ struct DefaultModuleDeclaration : ModuleDeclaration {
DEFINE_AST_NODE_LEAF_BOILERPLATE(DefaultModuleDeclaration)
DefaultModuleDeclaration(SourcePosition pos,
std::vector<Declaration*> declarations)
: ModuleDeclaration(kKind, pos, declarations) {}
: ModuleDeclaration(kKind, pos, std::move(declarations)) {}
bool IsDefault() const override { return true; }
};
......@@ -179,7 +179,8 @@ struct ExplicitModuleDeclaration : ModuleDeclaration {
DEFINE_AST_NODE_LEAF_BOILERPLATE(ExplicitModuleDeclaration)
ExplicitModuleDeclaration(SourcePosition pos, std::string name,
std::vector<Declaration*> declarations)
: ModuleDeclaration(kKind, pos, declarations), name(std::move(name)) {}
: ModuleDeclaration(kKind, pos, std::move(declarations)),
name(std::move(name)) {}
bool IsDefault() const override { return false; }
std::string name;
};
......@@ -228,7 +229,7 @@ struct CallExpression : Expression {
callee(pos, std::move(callee), std::move(generic_arguments)),
is_operator(is_operator),
arguments(std::move(arguments)),
labels(labels) {}
labels(std::move(labels)) {}
IdentifierExpression callee;
bool is_operator;
std::vector<Expression*> arguments;
......@@ -240,7 +241,7 @@ struct StructExpression : Expression {
StructExpression(SourcePosition pos, std::string name,
std::vector<Expression*> expressions)
: Expression(kKind, pos),
name(name),
name(std::move(name)),
expressions(std::move(expressions)) {}
std::string name;
std::vector<Expression*> expressions;
......@@ -362,7 +363,9 @@ struct ParameterList {
struct BasicTypeExpression : TypeExpression {
DEFINE_AST_NODE_LEAF_BOILERPLATE(BasicTypeExpression)
BasicTypeExpression(SourcePosition pos, bool is_constexpr, std::string name)
: TypeExpression(kKind, pos), is_constexpr(is_constexpr), name(name) {}
: TypeExpression(kKind, pos),
is_constexpr(is_constexpr),
name(std::move(name)) {}
bool is_constexpr;
std::string name;
};
......@@ -373,7 +376,7 @@ struct FunctionTypeExpression : TypeExpression {
std::vector<TypeExpression*> parameters,
TypeExpression* return_type)
: TypeExpression(kKind, pos),
parameters(parameters),
parameters(std::move(parameters)),
return_type(return_type) {}
std::vector<TypeExpression*> parameters;
TypeExpression* return_type;
......@@ -634,7 +637,8 @@ struct MacroDeclaration : CallableNode {
base::Optional<std::string> op, ParameterList parameters,
TypeExpression* return_type,
const LabelAndTypesVector& labels)
: CallableNode(kind, pos, name, parameters, return_type, labels),
: CallableNode(kind, pos, std::move(name), std::move(parameters),
return_type, labels),
op(std::move(op)) {}
base::Optional<std::string> op;
};
......@@ -646,8 +650,8 @@ struct ExternalMacroDeclaration : MacroDeclaration {
ParameterList parameters,
TypeExpression* return_type,
const LabelAndTypesVector& labels)
: MacroDeclaration(kKind, pos, name, op, parameters, return_type,
labels) {}
: MacroDeclaration(kKind, pos, std::move(name), std::move(op),
std::move(parameters), return_type, labels) {}
};
struct TorqueMacroDeclaration : MacroDeclaration {
......@@ -656,15 +660,16 @@ struct TorqueMacroDeclaration : MacroDeclaration {
base::Optional<std::string> op,
ParameterList parameters, TypeExpression* return_type,
const LabelAndTypesVector& labels)
: MacroDeclaration(kKind, pos, name, op, parameters, return_type,
labels) {}
: MacroDeclaration(kKind, pos, std::move(name), std::move(op),
std::move(parameters), return_type, labels) {}
};
struct BuiltinDeclaration : CallableNode {
BuiltinDeclaration(AstNode::Kind kind, SourcePosition pos,
bool javascript_linkage, std::string name,
ParameterList parameters, TypeExpression* return_type)
: CallableNode(kind, pos, name, parameters, return_type, {}),
: CallableNode(kind, pos, std::move(name), std::move(parameters),
return_type, {}),
javascript_linkage(javascript_linkage) {}
bool javascript_linkage;
};
......@@ -674,8 +679,8 @@ struct ExternalBuiltinDeclaration : BuiltinDeclaration {
ExternalBuiltinDeclaration(SourcePosition pos, bool javascript_linkage,
std::string name, ParameterList parameters,
TypeExpression* return_type)
: BuiltinDeclaration(kKind, pos, javascript_linkage, name, parameters,
return_type) {}
: BuiltinDeclaration(kKind, pos, javascript_linkage, std::move(name),
std::move(parameters), return_type) {}
};
struct TorqueBuiltinDeclaration : BuiltinDeclaration {
......@@ -683,8 +688,8 @@ struct TorqueBuiltinDeclaration : BuiltinDeclaration {
TorqueBuiltinDeclaration(SourcePosition pos, bool javascript_linkage,
std::string name, ParameterList parameters,
TypeExpression* return_type)
: BuiltinDeclaration(kKind, pos, javascript_linkage, name, parameters,
return_type) {}
: BuiltinDeclaration(kKind, pos, javascript_linkage, std::move(name),
std::move(parameters), return_type) {}
};
struct ExternalRuntimeDeclaration : CallableNode {
......@@ -741,8 +746,9 @@ struct SpecializationDeclaration : Declaration {
: Declaration(kKind, pos),
name(std::move(name)),
external(false),
generic_parameters(generic_parameters),
signature(new CallableNodeSignature{parameters, return_type, labels}),
generic_parameters(std::move(generic_parameters)),
signature(new CallableNodeSignature{std::move(parameters), return_type,
std::move(labels)}),
body(b) {}
std::string name;
bool external;
......
......@@ -20,7 +20,7 @@ namespace torque {
struct LocationReference {
LocationReference(Value* value, VisitResult base, VisitResult index)
: value(value), base(base), index(index) {}
: value(value), base(std::move(base)), index(std::move(index)) {}
Value* value;
VisitResult base;
VisitResult index;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment