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: |
(...skipping 24 matching lines...) Expand all Loading... |
35 namespace webkit_glue { | 35 namespace webkit_glue { |
36 class WebKitObserverImpl : blink::WebKitObserver { | 36 class WebKitObserverImpl : blink::WebKitObserver { |
37 public: | 37 public: |
38 virtual void WebKitModifiedSomething() {}; | 38 virtual void WebKitModifiedSomething() {}; |
39 }; | 39 }; |
40 } // namespace webkit_glue | 40 } // namespace webkit_glue |
41 | 41 |
42 class DerivedClass : public InterimClass, | 42 class DerivedClass : public InterimClass, |
43 public webkit_glue::WebKitObserverImpl { | 43 public webkit_glue::WebKitObserverImpl { |
44 public: | 44 public: |
| 45 DerivedClass(); |
45 // Should warn about destructors. | 46 // Should warn about destructors. |
46 virtual ~DerivedClass() {} | 47 virtual ~DerivedClass() {} |
47 // Should warn. | 48 // Should warn. |
48 virtual void SomeMethod(); | 49 virtual void SomeMethod(); |
49 // Should not warn if marked as override. | 50 // Should not warn if marked as override. |
50 void SomeOtherMethod() override; | 51 void SomeOtherMethod() override; |
51 // Should warn for inline implementations. | 52 // Should warn for inline implementations. |
52 virtual void SomeInlineMethod() {} | 53 virtual void SomeInlineMethod() {} |
53 // Should warn if overriding a method whose origin is blink. | 54 // Should warn if overriding a method whose origin is blink. |
54 virtual void WebKitModifiedSomething(); | 55 virtual void WebKitModifiedSomething(); |
55 // Should warn with the insertion point after the const. | 56 // Should warn with the insertion point after the const. |
56 virtual void SomeConstMethod() const {} | 57 virtual void SomeConstMethod() const {} |
57 // Should warn with the insertion point after the throw spec. | 58 // Should warn with the insertion point after the throw spec. |
58 virtual void SomeMethodWithExceptionSpec() throw() {} | 59 virtual void SomeMethodWithExceptionSpec() throw() {} |
59 // Should warn with the insertion point after both the const and the throw | 60 // Should warn with the insertion point after both the const and the throw |
60 // specifiers. | 61 // specifiers. |
61 virtual void SomeConstMethodWithExceptionSpec() const throw(int) {} | 62 virtual void SomeConstMethodWithExceptionSpec() const throw(int) {} |
62 // Should warn even if overridden method isn't pure. | 63 // Should warn even if overridden method isn't pure. |
63 virtual void SomeNonPureBaseMethod() {} | 64 virtual void SomeNonPureBaseMethod() {} |
64 // Should warn and place correctly even when there is a comment. | 65 // Should warn and place correctly even when there is a comment. |
65 virtual void SomeMethodWithComment(); // This is a comment. | 66 virtual void SomeMethodWithComment(); // This is a comment. |
66 // Should warn and place correctly even if there is a comment and body. | 67 // Should warn and place correctly even if there is a comment and body. |
67 virtual void SomeMethodWithCommentAndBody() {} // This is a comment. | 68 virtual void SomeMethodWithCommentAndBody() {} // This is a comment. |
68 }; | 69 }; |
69 | 70 |
70 #endif // OVERRIDDEN_METHODS_H_ | 71 #endif // OVERRIDDEN_METHODS_H_ |
OLD | NEW |