| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MISSING_CTOR_H_ | 5 #ifndef MISSING_CTOR_H_ |
| 6 #define MISSING_CTOR_H_ | 6 #define MISSING_CTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 struct MyString { |
| 9 #include <vector> | 9 MyString(); |
| 10 ~MyString(); |
| 11 MyString(const MyString&); |
| 12 MyString(MyString&&); |
| 13 }; |
| 14 |
| 15 template <class T> |
| 16 struct MyVector { |
| 17 MyVector(); |
| 18 ~MyVector(); |
| 19 MyVector(const MyVector&); |
| 20 MyVector(MyVector&&); |
| 21 }; |
| 10 | 22 |
| 11 // Note: this should warn for an implicit copy constructor too, but currently | 23 // Note: this should warn for an implicit copy constructor too, but currently |
| 12 // doesn't, due to a plugin bug. | 24 // doesn't, due to a plugin bug. |
| 13 class MissingCtorsArentOKInHeader { | 25 class MissingCtorsArentOKInHeader { |
| 14 public: | 26 public: |
| 15 | 27 |
| 16 private: | 28 private: |
| 17 std::vector<int> one_; | 29 MyVector<int> one_; |
| 18 std::vector<std::string> two_; | 30 MyVector<MyString> two_; |
| 19 }; | 31 }; |
| 20 | 32 |
| 21 // Inline move ctors shouldn't be warned about. Similar to the previous test | 33 // Inline move ctors shouldn't be warned about. Similar to the previous test |
| 22 // case, this also incorrectly fails to warn for the implicit copy ctor. | 34 // case, this also incorrectly fails to warn for the implicit copy ctor. |
| 23 class InlineImplicitMoveCtorOK { | 35 class InlineImplicitMoveCtorOK { |
| 24 public: | 36 public: |
| 25 InlineImplicitMoveCtorOK(); | 37 InlineImplicitMoveCtorOK(); |
| 26 | 38 |
| 27 private: | 39 private: |
| 28 // ctor weight = 12, dtor weight = 9. | 40 // ctor weight = 12, dtor weight = 9. |
| 29 std::string one_; | 41 MyString one_; |
| 30 std::string two_; | 42 MyString two_; |
| 31 std::string three_; | 43 MyString three_; |
| 32 int four_; | 44 int four_; |
| 33 int five_; | 45 int five_; |
| 34 int six_; | 46 int six_; |
| 35 }; | 47 }; |
| 36 | 48 |
| 37 class ExplicitlyDefaultedInlineAlsoWarns { | 49 class ExplicitlyDefaultedInlineAlsoWarns { |
| 38 public: | 50 public: |
| 39 ExplicitlyDefaultedInlineAlsoWarns() = default; | 51 ExplicitlyDefaultedInlineAlsoWarns() = default; |
| 40 ~ExplicitlyDefaultedInlineAlsoWarns() = default; | 52 ~ExplicitlyDefaultedInlineAlsoWarns() = default; |
| 41 ExplicitlyDefaultedInlineAlsoWarns( | 53 ExplicitlyDefaultedInlineAlsoWarns( |
| 42 const ExplicitlyDefaultedInlineAlsoWarns&) = default; | 54 const ExplicitlyDefaultedInlineAlsoWarns&) = default; |
| 43 | 55 |
| 44 private: | 56 private: |
| 45 std::vector<int> one_; | 57 MyVector<int> one_; |
| 46 std::vector<std::string> two_; | 58 MyVector<MyString> two_; |
| 47 | 59 |
| 48 }; | 60 }; |
| 49 | 61 |
| 50 #endif // MISSING_CTOR_H_ | 62 #endif // MISSING_CTOR_H_ |
| OLD | NEW |