Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | // Copyright (c) 2011 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 | #ifndef VIRTUAL_METHODS_H_ |
michael@0 | 6 | #define VIRTUAL_METHODS_H_ |
michael@0 | 7 | |
michael@0 | 8 | // Should warn about virtual method usage. |
michael@0 | 9 | class VirtualMethodsInHeaders { |
michael@0 | 10 | public: |
michael@0 | 11 | // Don't complain about these. |
michael@0 | 12 | virtual void MethodIsAbstract() = 0; |
michael@0 | 13 | virtual void MethodHasNoArguments(); |
michael@0 | 14 | virtual void MethodHasEmptyDefaultImpl() {} |
michael@0 | 15 | |
michael@0 | 16 | // But complain about this: |
michael@0 | 17 | virtual bool ComplainAboutThis() { return true; } |
michael@0 | 18 | }; |
michael@0 | 19 | |
michael@0 | 20 | // Complain on missing 'virtual' keyword in overrides. |
michael@0 | 21 | class WarnOnMissingVirtual : public VirtualMethodsInHeaders { |
michael@0 | 22 | public: |
michael@0 | 23 | void MethodHasNoArguments() override; |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | // Don't complain about things in a 'testing' namespace. |
michael@0 | 27 | namespace testing { |
michael@0 | 28 | struct TestStruct {}; |
michael@0 | 29 | } // namespace testing |
michael@0 | 30 | |
michael@0 | 31 | class VirtualMethodsInHeadersTesting : public VirtualMethodsInHeaders { |
michael@0 | 32 | public: |
michael@0 | 33 | // Don't complain about no virtual testing methods. |
michael@0 | 34 | void MethodHasNoArguments(); |
michael@0 | 35 | private: |
michael@0 | 36 | testing::TestStruct tester_; |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | #endif // VIRTUAL_METHODS_H_ |