media/webrtc/trunk/tools/clang/plugins/tests/overridden_methods.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #include "overridden_methods.h"
michael@0 6
michael@0 7 // Fill in the implementations
michael@0 8 void DerivedClass::SomeMethod() {}
michael@0 9 void DerivedClass::SomeOtherMethod() {}
michael@0 10 void DerivedClass::WebKitModifiedSomething() {}
michael@0 11
michael@0 12 class ImplementationInterimClass : public BaseClass {
michael@0 13 public:
michael@0 14 // Should not warn about pure virtual methods.
michael@0 15 virtual void SomeMethod() = 0;
michael@0 16 };
michael@0 17
michael@0 18 class ImplementationDerivedClass : public ImplementationInterimClass,
michael@0 19 public webkit_glue::WebKitObserverImpl {
michael@0 20 public:
michael@0 21 // Should not warn about destructors.
michael@0 22 virtual ~ImplementationDerivedClass() {}
michael@0 23 // Should warn.
michael@0 24 virtual void SomeMethod();
michael@0 25 // Should not warn if marked as override.
michael@0 26 virtual void SomeOtherMethod() override;
michael@0 27 // Should not warn for inline implementations in implementation files.
michael@0 28 virtual void SomeInlineMethod() {}
michael@0 29 // Should not warn if overriding a method whose origin is WebKit.
michael@0 30 virtual void WebKitModifiedSomething();
michael@0 31 // Should warn if overridden method isn't pure.
michael@0 32 virtual void SomeNonPureBaseMethod() {}
michael@0 33 };
michael@0 34
michael@0 35 int main() {
michael@0 36 DerivedClass something;
michael@0 37 ImplementationDerivedClass something_else;
michael@0 38 }

mercurial