tools/gn: Add out-of-line copy ctors for complex classes. This patch adds out of line copy constructors for classes that our clang-plugin considers heavy. This is an effort to enable copy constructor checks by default. BUG=436357 R=brettw@chromium.org, dcheng@chromium.org, thakis@chromium.org Review URL: https://codereview.chromium.org/1728303003 Cr-Original-Commit-Position: refs/heads/master@{#377375} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 7d50ff54f4c5fd2a1a4cf52a919f9eb15d5d5469
diff --git a/tools/gn/err.cc b/tools/gn/err.cc index 378fb7e..56e93bd 100644 --- a/tools/gn/err.cc +++ b/tools/gn/err.cc
@@ -144,6 +144,8 @@ } } +Err::Err(const Err& other) = default; + Err::~Err() { }
diff --git a/tools/gn/err.h b/tools/gn/err.h index 3e077e9..eeec31a 100644 --- a/tools/gn/err.h +++ b/tools/gn/err.h
@@ -54,6 +54,8 @@ const std::string msg, const std::string& help_text = std::string()); + Err(const Err& other); + ~Err(); bool has_error() const { return has_error_; }
diff --git a/tools/gn/label.cc b/tools/gn/label.cc index 7c13ed2..94c0e71 100644 --- a/tools/gn/label.cc +++ b/tools/gn/label.cc
@@ -214,6 +214,8 @@ name_.assign(name.data(), name.size()); } +Label::Label(const Label& other) = default; + Label::~Label() { }
diff --git a/tools/gn/label.h b/tools/gn/label.h index 469e8b6..cbeb177 100644 --- a/tools/gn/label.h +++ b/tools/gn/label.h
@@ -29,6 +29,7 @@ // Makes a label with an empty toolchain. Label(const SourceDir& dir, const base::StringPiece& name); + Label(const Label& other); ~Label(); // Resolives a string from a build file that may be relative to the
diff --git a/tools/gn/label_pattern.cc b/tools/gn/label_pattern.cc index 98a4138..e107ba4 100644 --- a/tools/gn/label_pattern.cc +++ b/tools/gn/label_pattern.cc
@@ -61,6 +61,8 @@ name.CopyToString(&name_); } +LabelPattern::LabelPattern(const LabelPattern& other) = default; + LabelPattern::~LabelPattern() { }
diff --git a/tools/gn/label_pattern.h b/tools/gn/label_pattern.h index 5c03260..7d0768c 100644 --- a/tools/gn/label_pattern.h +++ b/tools/gn/label_pattern.h
@@ -31,6 +31,7 @@ const SourceDir& dir, const base::StringPiece& name, const Label& toolchain_label); + LabelPattern(const LabelPattern& other); ~LabelPattern(); // Converts the given input string to a pattern. This does special stuff
diff --git a/tools/gn/pattern.cc b/tools/gn/pattern.cc index 4b14d2a..3de96a3 100644 --- a/tools/gn/pattern.cc +++ b/tools/gn/pattern.cc
@@ -60,6 +60,8 @@ subranges_[1].type == Subrange::LITERAL); } +Pattern::Pattern(const Pattern& other) = default; + Pattern::~Pattern() { } @@ -151,6 +153,8 @@ PatternList::PatternList() { } +PatternList::PatternList(const PatternList& other) = default; + PatternList::~PatternList() { }
diff --git a/tools/gn/pattern.h b/tools/gn/pattern.h index 1aa7097..f141f3e 100644 --- a/tools/gn/pattern.h +++ b/tools/gn/pattern.h
@@ -47,6 +47,7 @@ }; explicit Pattern(const std::string& s); + Pattern(const Pattern& other); ~Pattern(); // Returns true if the current pattern matches the given string. @@ -70,6 +71,7 @@ class PatternList { public: PatternList(); + PatternList(const PatternList& other); ~PatternList(); bool is_empty() const { return patterns_.empty(); }
diff --git a/tools/gn/substitution_list.cc b/tools/gn/substitution_list.cc index 4004286..517f327 100644 --- a/tools/gn/substitution_list.cc +++ b/tools/gn/substitution_list.cc
@@ -12,6 +12,8 @@ SubstitutionList::SubstitutionList() { } +SubstitutionList::SubstitutionList(const SubstitutionList& other) = default; + SubstitutionList::~SubstitutionList() { }
diff --git a/tools/gn/substitution_list.h b/tools/gn/substitution_list.h index f3e3c01..7273ece 100644 --- a/tools/gn/substitution_list.h +++ b/tools/gn/substitution_list.h
@@ -14,6 +14,7 @@ class SubstitutionList { public: SubstitutionList(); + SubstitutionList(const SubstitutionList& other); ~SubstitutionList(); bool Parse(const Value& value, Err* err);
diff --git a/tools/gn/substitution_pattern.cc b/tools/gn/substitution_pattern.cc index dd703d7..c8e5489 100644 --- a/tools/gn/substitution_pattern.cc +++ b/tools/gn/substitution_pattern.cc
@@ -28,6 +28,9 @@ SubstitutionPattern::SubstitutionPattern() : origin_(nullptr) { } +SubstitutionPattern::SubstitutionPattern(const SubstitutionPattern& other) = + default; + SubstitutionPattern::~SubstitutionPattern() { }
diff --git a/tools/gn/substitution_pattern.h b/tools/gn/substitution_pattern.h index 76edf8c..5389806 100644 --- a/tools/gn/substitution_pattern.h +++ b/tools/gn/substitution_pattern.h
@@ -34,6 +34,7 @@ }; SubstitutionPattern(); + SubstitutionPattern(const SubstitutionPattern& other); ~SubstitutionPattern(); // Parses the given string and fills in the pattern. The pattern must only
diff --git a/tools/gn/token.cc b/tools/gn/token.cc index 70ce2a1..6721619 100644 --- a/tools/gn/token.cc +++ b/tools/gn/token.cc
@@ -17,6 +17,8 @@ location_(location) { } +Token::Token(const Token& other) = default; + bool Token::IsIdentifierEqualTo(const char* v) const { return type_ == IDENTIFIER && value_ == v; }
diff --git a/tools/gn/token.h b/tools/gn/token.h index bf87283..24c4e9c 100644 --- a/tools/gn/token.h +++ b/tools/gn/token.h
@@ -58,6 +58,7 @@ Token(); Token(const Location& location, Type t, const base::StringPiece& v); + Token(const Token& other); Type type() const { return type_; } const base::StringPiece& value() const { return value_; }