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

Side by Side Diff: tools/clang/plugins/tests/virtual_specifiers.cpp

Issue 1108173002: Roll //build, //native_client, and a few more targets of opportunity. Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Test fix 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_specifiers.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // Tests for chromium style checks for virtual/override/final specifiers on 5 // Tests for chromium style checks for virtual/override/final specifiers on
6 // virtual methods. 6 // virtual methods.
7 7
8 #include <windows.h>
9
8 // Purposely use macros to test that the FixIt hints don't try to remove the 10 // Purposely use macros to test that the FixIt hints don't try to remove the
9 // macro body. 11 // macro body.
10 #define OVERRIDE override 12 #define OVERRIDE override
11 #define FINAL final 13 #define FINAL final
12 14
13 // Base class can only use virtual. 15 // Base class can only use virtual.
14 class Base { 16 class Base {
15 public: 17 public:
16 virtual ~Base() {} 18 virtual ~Base() {}
17 virtual void F() = 0; 19 virtual void F() = 0;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 }; 74 };
73 75
74 class PureOverride : public Base { 76 class PureOverride : public Base {
75 void F() override = 0; 77 void F() override = 0;
76 }; 78 };
77 79
78 class PureVirtualOverride : public Base { 80 class PureVirtualOverride : public Base {
79 virtual void F() override = 0; 81 virtual void F() override = 0;
80 }; 82 };
81 83
82 // Finally, some simple sanity tests that overrides in the testing namespace 84 // Test that the redundant virtual warning is suppressed when the virtual
85 // keyword comes from a macro in a system header.
86 class COMIsAwesome : public Base {
87 STDMETHOD(F)() override = 0;
88 };
89
90 // Some tests that overrides in the testing namespace
83 // don't trigger warnings, except for testing::Test. 91 // don't trigger warnings, except for testing::Test.
84 namespace testing { 92 namespace testing {
85 93
86 class Test { 94 class Test {
87 public: 95 public:
88 virtual ~Test(); 96 virtual ~Test();
89 virtual void SetUp(); 97 virtual void SetUp();
90 }; 98 };
91 99
92 class NotTest { 100 class NotTest {
93 public: 101 public:
94 virtual ~NotTest(); 102 virtual ~NotTest();
95 virtual void SetUp(); 103 virtual void SetUp();
96 }; 104 };
97 105
98 } // namespace 106 } // namespace
99 107
100 class MyTest : public testing::Test { 108 class MyTest : public testing::Test {
101 public: 109 public:
102 virtual ~MyTest(); 110 virtual ~MyTest();
103 virtual void SetUp() override; 111 virtual void SetUp() override;
104 }; 112 };
105 113
106 class MyNotTest : public testing::NotTest { 114 class MyNotTest : public testing::NotTest {
107 public: 115 public:
108 virtual ~MyNotTest(); 116 virtual ~MyNotTest();
109 virtual void SetUp() override; 117 virtual void SetUp() override;
110 }; 118 };
OLDNEW
« no previous file with comments | « tools/clang/plugins/tests/test.sh ('k') | tools/clang/plugins/tests/virtual_specifiers.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698