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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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