michael@0: // Copyright (c) 2011 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #ifndef OVERRIDDEN_METHODS_H_ michael@0: #define OVERRIDDEN_METHODS_H_ michael@0: michael@0: // Should warn about overriding of methods. michael@0: class BaseClass { michael@0: public: michael@0: virtual ~BaseClass() {} michael@0: virtual void SomeMethod() = 0; michael@0: virtual void SomeOtherMethod() = 0; michael@0: virtual void SomeInlineMethod() = 0; michael@0: virtual void SomeNonPureBaseMethod() {} michael@0: }; michael@0: michael@0: class InterimClass : public BaseClass { michael@0: // Should not warn about pure virtual methods. michael@0: virtual void SomeMethod() = 0; michael@0: }; michael@0: michael@0: namespace WebKit { michael@0: class WebKitObserver { michael@0: public: michael@0: virtual void WebKitModifiedSomething() {}; michael@0: }; michael@0: } // namespace WebKit michael@0: michael@0: namespace webkit_glue { michael@0: class WebKitObserverImpl : WebKit::WebKitObserver { michael@0: public: michael@0: virtual void WebKitModifiedSomething() {}; michael@0: }; michael@0: } // namespace webkit_glue michael@0: michael@0: class DerivedClass : public InterimClass, michael@0: public webkit_glue::WebKitObserverImpl { michael@0: public: michael@0: // Should not warn about destructors. michael@0: virtual ~DerivedClass() {} michael@0: // Should warn. michael@0: virtual void SomeMethod(); michael@0: // Should not warn if marked as override. michael@0: virtual void SomeOtherMethod() override; michael@0: // Should warn for inline implementations. michael@0: virtual void SomeInlineMethod() {} michael@0: // Should not warn if overriding a method whose origin is WebKit. michael@0: virtual void WebKitModifiedSomething(); michael@0: // Should warn if overridden method isn't pure. michael@0: virtual void SomeNonPureBaseMethod() {} michael@0: }; michael@0: michael@0: #endif // OVERRIDDEN_METHODS_H_