Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tools/clang/plugins/tests/overridden_methods.h

Issue 1493813003: Convert the no-inline-virtuals rule into a constructors rule. Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Rebase onto https://codereview.chromium.org/1504033010 Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698