blob: 08ef0a5e4862afcda36cb2f9bbcd446109032f9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef OVERRIDDEN_METHODS_H_
#define OVERRIDDEN_METHODS_H_
// Should warn about overriding of methods.
class BaseClass {
public:
virtual ~BaseClass() {}
virtual void SomeMethod() = 0;
virtual void SomeOtherMethod() = 0;
virtual void SomeInlineMethod() = 0;
};
class InterimClass : public BaseClass {
// Should not warn about pure virtual methods.
virtual void SomeMethod() = 0;
};
namespace WebKit {
class WebKitObserver {
public:
virtual void WebKitModifiedSomething() {};
};
} // namespace WebKit
namespace webkit_glue {
class WebKitObserverImpl : WebKit::WebKitObserver {
public:
virtual void WebKitModifiedSomething() {};
};
} // namespace webkit_glue
class DerivedClass : public InterimClass,
public webkit_glue::WebKitObserverImpl {
public:
// Should not warn about destructors.
virtual ~DerivedClass() {}
// Should warn.
virtual void SomeMethod();
// Should not warn if marked as override.
virtual void SomeOtherMethod() override;
// Should warn for inline implementations.
virtual void SomeInlineMethod() {}
// Should not warn if overriding a method whose origin is WebKit.
virtual void WebKitModifiedSomething();
};
#endif // OVERRIDDEN_METHODS_H_
|