media/webrtc/trunk/tools/clang/plugins/tests/virtual_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 "virtual_methods.h"
michael@0 6
michael@0 7 // Shouldn't warn about method usage in the implementation file.
michael@0 8 class VirtualMethodsInImplementation {
michael@0 9 public:
michael@0 10 virtual void MethodIsAbstract() = 0;
michael@0 11 virtual void MethodHasNoArguments();
michael@0 12 virtual void MethodHasEmptyDefaultImpl() {}
michael@0 13 virtual bool ComplainAboutThis() { return true; }
michael@0 14 };
michael@0 15
michael@0 16 // Stubs to fill in the abstract method
michael@0 17 class ConcreteVirtualMethodsInHeaders : public VirtualMethodsInHeaders {
michael@0 18 public:
michael@0 19 virtual void MethodIsAbstract() override {}
michael@0 20 };
michael@0 21
michael@0 22 class ConcreteVirtualMethodsInImplementation
michael@0 23 : public VirtualMethodsInImplementation {
michael@0 24 public:
michael@0 25 virtual void MethodIsAbstract() override {}
michael@0 26 };
michael@0 27
michael@0 28 // Fill in the implementations
michael@0 29 void VirtualMethodsInHeaders::MethodHasNoArguments() {}
michael@0 30 void WarnOnMissingVirtual::MethodHasNoArguments() {}
michael@0 31 void VirtualMethodsInImplementation::MethodHasNoArguments() {}
michael@0 32
michael@0 33 int main() {
michael@0 34 ConcreteVirtualMethodsInHeaders one;
michael@0 35 ConcreteVirtualMethodsInImplementation two;
michael@0 36 }

mercurial