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 OVERRIDDEN_METHODS_H_ | 5 #ifndef OVERRIDDEN_METHODS_H_ |
6 #define OVERRIDDEN_METHODS_H_ | 6 #define OVERRIDDEN_METHODS_H_ |
7 | 7 |
8 // Should warn about overriding of methods. | 8 // Should warn about overriding of methods. |
9 class BaseClass { | 9 class BaseClass { |
10 public: | 10 public: |
11 virtual ~BaseClass() {} | 11 virtual ~BaseClass() {} |
12 virtual void SomeMethod() = 0; | 12 virtual void SomeMethod() = 0; |
13 virtual void SomeOtherMethod() = 0; | 13 virtual void SomeOtherMethod() = 0; |
14 virtual void SomeInlineMethod() = 0; | 14 virtual void SomeInlineMethod() = 0; |
| 15 virtual void SomeNonPureBaseMethod() {} |
15 }; | 16 }; |
16 | 17 |
17 class InterimClass : public BaseClass { | 18 class InterimClass : public BaseClass { |
18 // Should not warn about pure virtual methods. | 19 // Should not warn about pure virtual methods. |
19 virtual void SomeMethod() = 0; | 20 virtual void SomeMethod() = 0; |
20 }; | 21 }; |
21 | 22 |
22 namespace WebKit { | 23 namespace WebKit { |
23 class WebKitObserver { | 24 class WebKitObserver { |
24 public: | 25 public: |
(...skipping 14 matching lines...) Expand all Loading... |
39 // Should not warn about destructors. | 40 // Should not warn about destructors. |
40 virtual ~DerivedClass() {} | 41 virtual ~DerivedClass() {} |
41 // Should warn. | 42 // Should warn. |
42 virtual void SomeMethod(); | 43 virtual void SomeMethod(); |
43 // Should not warn if marked as override. | 44 // Should not warn if marked as override. |
44 virtual void SomeOtherMethod() override; | 45 virtual void SomeOtherMethod() override; |
45 // Should warn for inline implementations. | 46 // Should warn for inline implementations. |
46 virtual void SomeInlineMethod() {} | 47 virtual void SomeInlineMethod() {} |
47 // Should not warn if overriding a method whose origin is WebKit. | 48 // Should not warn if overriding a method whose origin is WebKit. |
48 virtual void WebKitModifiedSomething(); | 49 virtual void WebKitModifiedSomething(); |
| 50 // Should warn if overridden method isn't pure. |
| 51 virtual void SomeNonPureBaseMethod() {} |
49 }; | 52 }; |
50 | 53 |
51 #endif // OVERRIDDEN_METHODS_H_ | 54 #endif // OVERRIDDEN_METHODS_H_ |
OLD | NEW |