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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/trunk/tools/clang/plugins/tests/overridden_methods.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,38 @@
     1.4 +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
     1.5 +// Use of this source code is governed by a BSD-style license that can be
     1.6 +// found in the LICENSE file.
     1.7 +
     1.8 +#include "overridden_methods.h"
     1.9 +
    1.10 +// Fill in the implementations
    1.11 +void DerivedClass::SomeMethod() {}
    1.12 +void DerivedClass::SomeOtherMethod() {}
    1.13 +void DerivedClass::WebKitModifiedSomething() {}
    1.14 +
    1.15 +class ImplementationInterimClass : public BaseClass {
    1.16 + public:
    1.17 +  // Should not warn about pure virtual methods.
    1.18 +  virtual void SomeMethod() = 0;
    1.19 +};
    1.20 +
    1.21 +class ImplementationDerivedClass : public ImplementationInterimClass,
    1.22 +                                   public webkit_glue::WebKitObserverImpl {
    1.23 + public:
    1.24 +  // Should not warn about destructors.
    1.25 +  virtual ~ImplementationDerivedClass() {}
    1.26 +  // Should warn.
    1.27 +  virtual void SomeMethod();
    1.28 +  // Should not warn if marked as override.
    1.29 +  virtual void SomeOtherMethod() override;
    1.30 +  // Should not warn for inline implementations in implementation files.
    1.31 +  virtual void SomeInlineMethod() {}
    1.32 +  // Should not warn if overriding a method whose origin is WebKit.
    1.33 +  virtual void WebKitModifiedSomething();
    1.34 +  // Should warn if overridden method isn't pure.
    1.35 +  virtual void SomeNonPureBaseMethod() {}
    1.36 +};
    1.37 +
    1.38 +int main() {
    1.39 +  DerivedClass something;
    1.40 +  ImplementationDerivedClass something_else;
    1.41 +}

mercurial