Commit 89314801 authored by Zhi An Ng's avatar Zhi An Ng Committed by Commit Bot

[cleanup][parsing] Remove uses of DISALLOW_COPY_AND_ASSIGN

Bug: v8:11074
Change-Id: I01ffd94290aa5deafa0953a86ff555147b813bf4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2557069Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71389}
parent fc61c38a
...@@ -43,6 +43,9 @@ class VariableProxy; ...@@ -43,6 +43,9 @@ class VariableProxy;
template <typename Types> template <typename Types>
class ExpressionScope { class ExpressionScope {
public: public:
ExpressionScope(const ExpressionScope&) = delete;
ExpressionScope& operator=(const ExpressionScope&) = delete;
using ParserT = typename Types::Impl; using ParserT = typename Types::Impl;
using ExpressionT = typename Types::Expression; using ExpressionT = typename Types::Expression;
...@@ -342,8 +345,6 @@ class ExpressionScope { ...@@ -342,8 +345,6 @@ class ExpressionScope {
ScopeType type_; ScopeType type_;
bool has_possible_parameter_in_scope_chain_; bool has_possible_parameter_in_scope_chain_;
bool has_possible_arrow_parameter_in_scope_chain_; bool has_possible_arrow_parameter_in_scope_chain_;
DISALLOW_COPY_AND_ASSIGN(ExpressionScope);
}; };
// Used to unambiguously parse var, let, const declarations. // Used to unambiguously parse var, let, const declarations.
...@@ -362,6 +363,11 @@ class VariableDeclarationParsingScope : public ExpressionScope<Types> { ...@@ -362,6 +363,11 @@ class VariableDeclarationParsingScope : public ExpressionScope<Types> {
mode_(mode), mode_(mode),
names_(names) {} names_(names) {}
VariableDeclarationParsingScope(const VariableDeclarationParsingScope&) =
delete;
VariableDeclarationParsingScope& operator=(
const VariableDeclarationParsingScope&) = delete;
Variable* Declare(const AstRawString* name, int pos) { Variable* Declare(const AstRawString* name, int pos) {
VariableKind kind = NORMAL_VARIABLE; VariableKind kind = NORMAL_VARIABLE;
bool was_added; bool was_added;
...@@ -413,8 +419,6 @@ class VariableDeclarationParsingScope : public ExpressionScope<Types> { ...@@ -413,8 +419,6 @@ class VariableDeclarationParsingScope : public ExpressionScope<Types> {
VariableMode mode_; VariableMode mode_;
ZonePtrList<const AstRawString>* names_; ZonePtrList<const AstRawString>* names_;
DISALLOW_COPY_AND_ASSIGN(VariableDeclarationParsingScope);
}; };
template <typename Types> template <typename Types>
...@@ -427,6 +431,11 @@ class ParameterDeclarationParsingScope : public ExpressionScope<Types> { ...@@ -427,6 +431,11 @@ class ParameterDeclarationParsingScope : public ExpressionScope<Types> {
explicit ParameterDeclarationParsingScope(ParserT* parser) explicit ParameterDeclarationParsingScope(ParserT* parser)
: ExpressionScopeT(parser, ExpressionScopeT::kParameterDeclaration) {} : ExpressionScopeT(parser, ExpressionScopeT::kParameterDeclaration) {}
ParameterDeclarationParsingScope(const ParameterDeclarationParsingScope&) =
delete;
ParameterDeclarationParsingScope& operator=(
const ParameterDeclarationParsingScope&) = delete;
Variable* Declare(const AstRawString* name, int pos) { Variable* Declare(const AstRawString* name, int pos) {
VariableKind kind = PARAMETER_VARIABLE; VariableKind kind = PARAMETER_VARIABLE;
VariableMode mode = VariableMode::kVar; VariableMode mode = VariableMode::kVar;
...@@ -446,7 +455,6 @@ class ParameterDeclarationParsingScope : public ExpressionScope<Types> { ...@@ -446,7 +455,6 @@ class ParameterDeclarationParsingScope : public ExpressionScope<Types> {
private: private:
Scanner::Location duplicate_loc_ = Scanner::Location::invalid(); Scanner::Location duplicate_loc_ = Scanner::Location::invalid();
DISALLOW_COPY_AND_ASSIGN(ParameterDeclarationParsingScope);
}; };
// Parsing expressions is always ambiguous between at least left-hand-side and // Parsing expressions is always ambiguous between at least left-hand-side and
...@@ -480,6 +488,9 @@ class ExpressionParsingScope : public ExpressionScope<Types> { ...@@ -480,6 +488,9 @@ class ExpressionParsingScope : public ExpressionScope<Types> {
clear(kPatternIndex); clear(kPatternIndex);
} }
ExpressionParsingScope(const ExpressionParsingScope&) = delete;
ExpressionParsingScope& operator=(const ExpressionParsingScope&) = delete;
void RecordAsyncArrowParametersError(const Scanner::Location& loc, void RecordAsyncArrowParametersError(const Scanner::Location& loc,
MessageTemplate message) { MessageTemplate message) {
for (ExpressionScopeT* scope = this; scope != nullptr; for (ExpressionScopeT* scope = this; scope != nullptr;
...@@ -643,8 +654,6 @@ class ExpressionParsingScope : public ExpressionScope<Types> { ...@@ -643,8 +654,6 @@ class ExpressionParsingScope : public ExpressionScope<Types> {
MessageTemplate messages_[kNumberOfErrors]; MessageTemplate messages_[kNumberOfErrors];
Scanner::Location locations_[kNumberOfErrors]; Scanner::Location locations_[kNumberOfErrors];
bool has_async_arrow_in_scope_chain_; bool has_async_arrow_in_scope_chain_;
DISALLOW_COPY_AND_ASSIGN(ExpressionParsingScope);
}; };
// This class is used to parse multiple ambiguous expressions and declarations // This class is used to parse multiple ambiguous expressions and declarations
...@@ -672,6 +681,9 @@ class AccumulationScope { ...@@ -672,6 +681,9 @@ class AccumulationScope {
} }
} }
AccumulationScope(const AccumulationScope&) = delete;
AccumulationScope& operator=(const AccumulationScope&) = delete;
// Merge errors from the underlying ExpressionParsingScope into this scope. // Merge errors from the underlying ExpressionParsingScope into this scope.
// Only keeps the first error across all accumulate calls, and removes the // Only keeps the first error across all accumulate calls, and removes the
// error from the underlying scope. // error from the underlying scope.
...@@ -723,8 +735,6 @@ class AccumulationScope { ...@@ -723,8 +735,6 @@ class AccumulationScope {
ExpressionParsingScope<Types>* scope_; ExpressionParsingScope<Types>* scope_;
MessageTemplate messages_[2]; MessageTemplate messages_[2];
Scanner::Location locations_[2]; Scanner::Location locations_[2];
DISALLOW_COPY_AND_ASSIGN(AccumulationScope);
}; };
// The head of an arrow function is ambiguous between expression, assignment // The head of an arrow function is ambiguous between expression, assignment
...@@ -750,6 +760,9 @@ class ArrowHeadParsingScope : public ExpressionParsingScope<Types> { ...@@ -750,6 +760,9 @@ class ArrowHeadParsingScope : public ExpressionParsingScope<Types> {
DCHECK(!this->IsCertainlyDeclaration()); DCHECK(!this->IsCertainlyDeclaration());
} }
ArrowHeadParsingScope(const ArrowHeadParsingScope&) = delete;
ArrowHeadParsingScope& operator=(const ArrowHeadParsingScope&) = delete;
void ValidateExpression() { void ValidateExpression() {
// Turns out this is not an arrow head. Clear any possible tracked strict // Turns out this is not an arrow head. Clear any possible tracked strict
// parameter errors, and reinterpret tracked variables as unresolved // parameter errors, and reinterpret tracked variables as unresolved
...@@ -822,8 +835,6 @@ class ArrowHeadParsingScope : public ExpressionParsingScope<Types> { ...@@ -822,8 +835,6 @@ class ArrowHeadParsingScope : public ExpressionParsingScope<Types> {
MessageTemplate declaration_error_message = MessageTemplate::kNone; MessageTemplate declaration_error_message = MessageTemplate::kNone;
bool has_simple_parameter_list_ = true; bool has_simple_parameter_list_ = true;
bool uses_this_ = false; bool uses_this_ = false;
DISALLOW_COPY_AND_ASSIGN(ArrowHeadParsingScope);
}; };
} // namespace internal } // namespace internal
......
...@@ -39,6 +39,9 @@ class FuncNameInferrer { ...@@ -39,6 +39,9 @@ class FuncNameInferrer {
public: public:
explicit FuncNameInferrer(AstValueFactory* ast_value_factory); explicit FuncNameInferrer(AstValueFactory* ast_value_factory);
FuncNameInferrer(const FuncNameInferrer&) = delete;
FuncNameInferrer& operator=(const FuncNameInferrer&) = delete;
// To enter function name inference state, put a FuncNameInferrer::State // To enter function name inference state, put a FuncNameInferrer::State
// on the stack. // on the stack.
class State { class State {
...@@ -52,12 +55,12 @@ class FuncNameInferrer { ...@@ -52,12 +55,12 @@ class FuncNameInferrer {
fni_->names_stack_.resize(top_); fni_->names_stack_.resize(top_);
--fni_->scope_depth_; --fni_->scope_depth_;
} }
State(const State&) = delete;
State& operator=(const State&) = delete;
private: private:
FuncNameInferrer* fni_; FuncNameInferrer* fni_;
size_t top_; size_t top_;
DISALLOW_COPY_AND_ASSIGN(State);
}; };
// Returns whether we have entered name collection state. // Returns whether we have entered name collection state.
...@@ -119,8 +122,6 @@ class FuncNameInferrer { ...@@ -119,8 +122,6 @@ class FuncNameInferrer {
std::vector<Name> names_stack_; std::vector<Name> names_stack_;
std::vector<FunctionLiteral*> funcs_to_infer_; std::vector<FunctionLiteral*> funcs_to_infer_;
size_t scope_depth_ = 0; size_t scope_depth_ = 0;
DISALLOW_COPY_AND_ASSIGN(FuncNameInferrer);
}; };
......
...@@ -18,6 +18,9 @@ class LiteralBuffer final { ...@@ -18,6 +18,9 @@ class LiteralBuffer final {
~LiteralBuffer() { backing_store_.Dispose(); } ~LiteralBuffer() { backing_store_.Dispose(); }
LiteralBuffer(const LiteralBuffer&) = delete;
LiteralBuffer& operator=(const LiteralBuffer&) = delete;
V8_INLINE void AddChar(char code_unit) { V8_INLINE void AddChar(char code_unit) {
DCHECK(IsValidAscii(code_unit)); DCHECK(IsValidAscii(code_unit));
AddOneByteChar(static_cast<byte>(code_unit)); AddOneByteChar(static_cast<byte>(code_unit));
...@@ -95,8 +98,6 @@ class LiteralBuffer final { ...@@ -95,8 +98,6 @@ class LiteralBuffer final {
int position_; int position_;
bool is_one_byte_; bool is_one_byte_;
DISALLOW_COPY_AND_ASSIGN(LiteralBuffer);
}; };
} // namespace internal } // namespace internal
......
...@@ -28,6 +28,11 @@ class PendingCompilationErrorHandler { ...@@ -28,6 +28,11 @@ class PendingCompilationErrorHandler {
PendingCompilationErrorHandler() PendingCompilationErrorHandler()
: has_pending_error_(false), stack_overflow_(false) {} : has_pending_error_(false), stack_overflow_(false) {}
PendingCompilationErrorHandler(const PendingCompilationErrorHandler&) =
delete;
PendingCompilationErrorHandler& operator=(
const PendingCompilationErrorHandler&) = delete;
void ReportMessageAt(int start_position, int end_position, void ReportMessageAt(int start_position, int end_position,
MessageTemplate message, const char* arg = nullptr); MessageTemplate message, const char* arg = nullptr);
...@@ -130,8 +135,6 @@ class PendingCompilationErrorHandler { ...@@ -130,8 +135,6 @@ class PendingCompilationErrorHandler {
MessageDetails error_details_; MessageDetails error_details_;
std::forward_list<MessageDetails> warning_messages_; std::forward_list<MessageDetails> warning_messages_;
DISALLOW_COPY_AND_ASSIGN(PendingCompilationErrorHandler);
}; };
extern template void PendingCompilationErrorHandler::PrepareErrors( extern template void PendingCompilationErrorHandler::PrepareErrors(
......
...@@ -144,6 +144,8 @@ class BaseConsumedPreparseData : public ConsumedPreparseData { ...@@ -144,6 +144,8 @@ class BaseConsumedPreparseData : public ConsumedPreparseData {
}; };
BaseConsumedPreparseData() : scope_data_(new ByteData()), child_index_(0) {} BaseConsumedPreparseData() : scope_data_(new ByteData()), child_index_(0) {}
BaseConsumedPreparseData(const BaseConsumedPreparseData&) = delete;
BaseConsumedPreparseData& operator=(const BaseConsumedPreparseData&) = delete;
virtual Data GetScopeData() = 0; virtual Data GetScopeData() = 0;
...@@ -174,8 +176,6 @@ class BaseConsumedPreparseData : public ConsumedPreparseData { ...@@ -174,8 +176,6 @@ class BaseConsumedPreparseData : public ConsumedPreparseData {
// When consuming the data, these indexes point to the data we're going to // When consuming the data, these indexes point to the data we're going to
// consume next. // consume next.
int child_index_; int child_index_;
DISALLOW_COPY_AND_ASSIGN(BaseConsumedPreparseData);
}; };
// Implementation of ConsumedPreparseData for on-heap data. // Implementation of ConsumedPreparseData for on-heap data.
...@@ -198,6 +198,9 @@ class ZonePreparseData : public ZoneObject { ...@@ -198,6 +198,9 @@ class ZonePreparseData : public ZoneObject {
V8_EXPORT_PRIVATE ZonePreparseData(Zone* zone, Vector<uint8_t>* byte_data, V8_EXPORT_PRIVATE ZonePreparseData(Zone* zone, Vector<uint8_t>* byte_data,
int child_length); int child_length);
ZonePreparseData(const ZonePreparseData&) = delete;
ZonePreparseData& operator=(const ZonePreparseData&) = delete;
Handle<PreparseData> Serialize(Isolate* isolate); Handle<PreparseData> Serialize(Isolate* isolate);
Handle<PreparseData> Serialize(LocalIsolate* isolate); Handle<PreparseData> Serialize(LocalIsolate* isolate);
...@@ -215,8 +218,6 @@ class ZonePreparseData : public ZoneObject { ...@@ -215,8 +218,6 @@ class ZonePreparseData : public ZoneObject {
private: private:
ZoneVector<uint8_t> byte_data_; ZoneVector<uint8_t> byte_data_;
ZoneVector<ZonePreparseData*> children_; ZoneVector<ZonePreparseData*> children_;
DISALLOW_COPY_AND_ASSIGN(ZonePreparseData);
}; };
ZonePreparseData* PreparseDataBuilder::ByteData::CopyToZone( ZonePreparseData* PreparseDataBuilder::ByteData::CopyToZone(
......
...@@ -101,6 +101,8 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject, ...@@ -101,6 +101,8 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject,
explicit PreparseDataBuilder(Zone* zone, PreparseDataBuilder* parent_builder, explicit PreparseDataBuilder(Zone* zone, PreparseDataBuilder* parent_builder,
std::vector<void*>* children_buffer); std::vector<void*>* children_buffer);
~PreparseDataBuilder() {} ~PreparseDataBuilder() {}
PreparseDataBuilder(const PreparseDataBuilder&) = delete;
PreparseDataBuilder& operator=(const PreparseDataBuilder&) = delete;
PreparseDataBuilder* parent() const { return parent_; } PreparseDataBuilder* parent() const { return parent_; }
...@@ -111,6 +113,8 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject, ...@@ -111,6 +113,8 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject,
public: public:
explicit DataGatheringScope(PreParser* preparser) explicit DataGatheringScope(PreParser* preparser)
: preparser_(preparser), builder_(nullptr) {} : preparser_(preparser), builder_(nullptr) {}
DataGatheringScope(const DataGatheringScope&) = delete;
DataGatheringScope& operator=(const DataGatheringScope&) = delete;
void Start(DeclarationScope* function_scope); void Start(DeclarationScope* function_scope);
void SetSkippableFunction(DeclarationScope* function_scope, void SetSkippableFunction(DeclarationScope* function_scope,
...@@ -125,8 +129,6 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject, ...@@ -125,8 +129,6 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject,
PreParser* preparser_; PreParser* preparser_;
PreparseDataBuilder* builder_; PreparseDataBuilder* builder_;
DISALLOW_COPY_AND_ASSIGN(DataGatheringScope);
}; };
class V8_EXPORT_PRIVATE ByteData : public ZoneObject, class V8_EXPORT_PRIVATE ByteData : public ZoneObject,
...@@ -241,8 +243,6 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject, ...@@ -241,8 +243,6 @@ class V8_EXPORT_PRIVATE PreparseDataBuilder : public ZoneObject,
#ifdef DEBUG #ifdef DEBUG
bool finalized_children_ = false; bool finalized_children_ = false;
#endif #endif
DISALLOW_COPY_AND_ASSIGN(PreparseDataBuilder);
}; };
class ProducedPreparseData : public ZoneObject { class ProducedPreparseData : public ZoneObject {
...@@ -289,6 +289,9 @@ class ConsumedPreparseData { ...@@ -289,6 +289,9 @@ class ConsumedPreparseData {
virtual ~ConsumedPreparseData() = default; virtual ~ConsumedPreparseData() = default;
ConsumedPreparseData(const ConsumedPreparseData&) = delete;
ConsumedPreparseData& operator=(const ConsumedPreparseData&) = delete;
virtual ProducedPreparseData* GetDataForSkippableFunction( virtual ProducedPreparseData* GetDataForSkippableFunction(
Zone* zone, int start_position, int* end_position, int* num_parameters, Zone* zone, int start_position, int* end_position, int* num_parameters,
int* function_length, int* num_inner_functions, bool* uses_super_property, int* function_length, int* num_inner_functions, bool* uses_super_property,
...@@ -302,9 +305,6 @@ class ConsumedPreparseData { ...@@ -302,9 +305,6 @@ class ConsumedPreparseData {
protected: protected:
ConsumedPreparseData() = default; ConsumedPreparseData() = default;
private:
DISALLOW_COPY_AND_ASSIGN(ConsumedPreparseData);
}; };
} // namespace internal } // namespace internal
......
...@@ -823,6 +823,9 @@ class PreParserFormalParameters : public FormalParametersBase { ...@@ -823,6 +823,9 @@ class PreParserFormalParameters : public FormalParametersBase {
class PreParserFuncNameInferrer { class PreParserFuncNameInferrer {
public: public:
explicit PreParserFuncNameInferrer(AstValueFactory* avf) {} explicit PreParserFuncNameInferrer(AstValueFactory* avf) {}
PreParserFuncNameInferrer(const PreParserFuncNameInferrer&) = delete;
PreParserFuncNameInferrer& operator=(const PreParserFuncNameInferrer&) =
delete;
void RemoveAsyncKeywordFromEnd() const {} void RemoveAsyncKeywordFromEnd() const {}
void Infer() const {} void Infer() const {}
void RemoveLastFunction() const {} void RemoveLastFunction() const {}
...@@ -830,13 +833,9 @@ class PreParserFuncNameInferrer { ...@@ -830,13 +833,9 @@ class PreParserFuncNameInferrer {
class State { class State {
public: public:
explicit State(PreParserFuncNameInferrer* fni) {} explicit State(PreParserFuncNameInferrer* fni) {}
State(const State&) = delete;
private: State& operator=(const State&) = delete;
DISALLOW_COPY_AND_ASSIGN(State);
}; };
private:
DISALLOW_COPY_AND_ASSIGN(PreParserFuncNameInferrer);
}; };
class PreParserSourceRange { class PreParserSourceRange {
......
...@@ -219,6 +219,8 @@ class V8_EXPORT_PRIVATE Scanner { ...@@ -219,6 +219,8 @@ class V8_EXPORT_PRIVATE Scanner {
DCHECK_NOT_NULL(scanner_); DCHECK_NOT_NULL(scanner_);
} }
~BookmarkScope() = default; ~BookmarkScope() = default;
BookmarkScope(const BookmarkScope&) = delete;
BookmarkScope& operator=(const BookmarkScope&) = delete;
void Set(size_t bookmark); void Set(size_t bookmark);
void Apply(); void Apply();
...@@ -232,8 +234,6 @@ class V8_EXPORT_PRIVATE Scanner { ...@@ -232,8 +234,6 @@ class V8_EXPORT_PRIVATE Scanner {
Scanner* scanner_; Scanner* scanner_;
size_t bookmark_; size_t bookmark_;
bool had_parser_error_; bool had_parser_error_;
DISALLOW_COPY_AND_ASSIGN(BookmarkScope);
}; };
// Sets the Scanner into an error state to stop further scanning and terminate // Sets the Scanner into an error state to stop further scanning and terminate
......
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