Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: tools/clang/plugins/tests/virtual_bodies.h

Issue 1141793003: Update from https://crrev.com/329939 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/clang/plugins/tests/test.sh ('k') | tools/clang/plugins/tests/virtual_bodies.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef VIRTUAL_METHODS_H_ 5 #ifndef VIRTUAL_METHODS_H_
6 #define VIRTUAL_METHODS_H_ 6 #define VIRTUAL_METHODS_H_
7 7
8 // Note: This is not actual windows.h but the stub file in system/windows.h
9 #include <windows.h>
10
11 #define CR_BEGIN_MSG_MAP_EX(theClass) virtual int f() { return 4; }
12 #define BEGIN_SAFE_MSG_MAP_EX(theClass) virtual int g() { return 4; }
13
8 // Should warn about virtual method usage. 14 // Should warn about virtual method usage.
9 class VirtualMethodsInHeaders { 15 class VirtualMethodsInHeaders {
10 public: 16 public:
11 // Don't complain about these. 17 // Don't complain about these.
12 virtual void MethodIsAbstract() = 0; 18 virtual void MethodIsAbstract() = 0;
13 virtual void MethodHasNoArguments(); 19 virtual void MethodHasNoArguments();
14 virtual void MethodHasEmptyDefaultImpl() {} 20 virtual void MethodHasEmptyDefaultImpl() {}
15 21
16 // But complain about this: 22 // But complain about this:
17 virtual bool ComplainAboutThis() { return true; } 23 virtual bool ComplainAboutThis() { return true; }
24
25 SYSTEM_INLINE_VIRTUAL
26 CR_BEGIN_MSG_MAP_EX(Sub)
27 BEGIN_SAFE_MSG_MAP_EX(Sub)
18 }; 28 };
19 29
20 // Complain on missing 'virtual' keyword in overrides. 30 // Complain on missing 'virtual' keyword in overrides.
21 class WarnOnMissingVirtual : public VirtualMethodsInHeaders { 31 class WarnOnMissingVirtual : public VirtualMethodsInHeaders {
22 public: 32 public:
23 void MethodHasNoArguments() override; 33 void MethodHasNoArguments() override;
24 }; 34 };
25 35
26 // Don't complain about things in a 'testing' namespace. 36 // Don't complain about things in a 'testing' namespace.
27 namespace testing { 37 namespace testing {
28 struct TestStruct {}; 38 struct TestStruct {};
29 } // namespace testing 39 } // namespace testing
30 40
31 class VirtualMethodsInHeadersTesting : public VirtualMethodsInHeaders { 41 class VirtualMethodsInHeadersTesting : public VirtualMethodsInHeaders {
32 public: 42 public:
33 // Don't complain about no virtual testing methods. 43 // Don't complain about no virtual testing methods.
34 void MethodHasNoArguments(); 44 void MethodHasNoArguments();
35 45
36 private: 46 private:
37 testing::TestStruct tester_; 47 testing::TestStruct tester_;
38 }; 48 };
39 49
40 #endif // VIRTUAL_METHODS_H_ 50 #endif // VIRTUAL_METHODS_H_
OLDNEW
« no previous file with comments | « tools/clang/plugins/tests/test.sh ('k') | tools/clang/plugins/tests/virtual_bodies.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698