Commit 995333da authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[base] Remove redundant DISALLOW_COPY_AND_MOVE_AND_ASSIGN

The DISALLOW_COPY_AND_ASSIGN has the same semantics, as long as you do
not explicitly add a move constructor or move assignment operator.
This CL documents this better and removes the
DISALLOW_COPY_AND_MOVE_AND_ASSIGN macro.

R=tebbi@chromium.org

Bug: v8:8562
Change-Id: I1b742ee1a106d85d59a67c90341fafec2473e925
Reviewed-on: https://chromium-review.googlesource.com/c/1382465Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58342}
parent 19bc78db
...@@ -112,16 +112,12 @@ V8_INLINE Dest bit_cast(Source const& source) { ...@@ -112,16 +112,12 @@ V8_INLINE Dest bit_cast(Source const& source) {
#define DISALLOW_ASSIGN(TypeName) TypeName& operator=(const TypeName&) = delete #define DISALLOW_ASSIGN(TypeName) TypeName& operator=(const TypeName&) = delete
// Explicitly declare the copy constructor and assignment operator as deleted. // Explicitly declare the copy constructor and assignment operator as deleted.
// This also deletes the implicit move constructor and implicit move assignment
// operator, but still allows to manually define them.
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \ #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&) = delete; \ TypeName(const TypeName&) = delete; \
DISALLOW_ASSIGN(TypeName) DISALLOW_ASSIGN(TypeName)
// Explicitly declare all copy/move constructors and assignments as deleted.
#define DISALLOW_COPY_AND_MOVE_AND_ASSIGN(TypeName) \
TypeName(TypeName&&) = delete; \
TypeName& operator=(TypeName&&) = delete; \
DISALLOW_COPY_AND_ASSIGN(TypeName)
// Explicitly declare all implicit constructors as deleted, namely the // Explicitly declare all implicit constructors as deleted, namely the
// default constructor, copy constructor and operator= functions. // default constructor, copy constructor and operator= functions.
// This is especially useful for classes containing only static methods. // This is especially useful for classes containing only static methods.
......
...@@ -121,7 +121,7 @@ class ParseResultIterator { ...@@ -121,7 +121,7 @@ class ParseResultIterator {
size_t i_ = 0; size_t i_ = 0;
MatchedInput matched_input_; MatchedInput matched_input_;
DISALLOW_COPY_AND_MOVE_AND_ASSIGN(ParseResultIterator); DISALLOW_COPY_AND_ASSIGN(ParseResultIterator);
}; };
struct LexerResult { struct LexerResult {
...@@ -196,7 +196,7 @@ class Symbol { ...@@ -196,7 +196,7 @@ class Symbol {
std::vector<std::unique_ptr<Rule>> rules_; std::vector<std::unique_ptr<Rule>> rules_;
// Disallow copying and moving to ensure Symbol has a stable address. // Disallow copying and moving to ensure Symbol has a stable address.
DISALLOW_COPY_AND_MOVE_AND_ASSIGN(Symbol); DISALLOW_COPY_AND_ASSIGN(Symbol);
}; };
// Items are the core datastructure of Earley's algorithm. // Items are the core datastructure of Earley's algorithm.
......
...@@ -141,7 +141,7 @@ class Binding : public T { ...@@ -141,7 +141,7 @@ class Binding : public T {
const std::string name_; const std::string name_;
base::Optional<Binding*> previous_binding_; base::Optional<Binding*> previous_binding_;
SourcePosition declaration_position_ = CurrentSourcePosition::Get(); SourcePosition declaration_position_ = CurrentSourcePosition::Get();
DISALLOW_COPY_AND_MOVE_AND_ASSIGN(Binding); DISALLOW_COPY_AND_ASSIGN(Binding);
}; };
template <class T> template <class T>
......
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