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

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

Issue 683113005: Update from chromium https://crrev.com/302282 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
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 // Purposely use macros to test that the FixIt hints don't try to remove the 8 // Purposely use macros to test that the FixIt hints don't try to remove the
9 // macro body. 9 // macro body.
10 #define OVERRIDE override 10 #define OVERRIDE override
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 virtual ~VirtualAndOverrideFinal() OVERRIDE FINAL {} 55 virtual ~VirtualAndOverrideFinal() OVERRIDE FINAL {}
56 virtual void F() OVERRIDE FINAL {} 56 virtual void F() OVERRIDE FINAL {}
57 }; 57 };
58 58
59 class OverrideAndFinal : public Base { 59 class OverrideAndFinal : public Base {
60 public: 60 public:
61 ~OverrideAndFinal() OVERRIDE FINAL {} 61 ~OverrideAndFinal() OVERRIDE FINAL {}
62 void F() OVERRIDE FINAL {} 62 void F() OVERRIDE FINAL {}
63 }; 63 };
64 64
65 // Also warn on pure functions.
66 class CorrectPureVirtual : public Base {
67 virtual void F() = 0;
68 };
69
70 class Pure : public Base {
71 void F() = 0;
72 };
73
74 class PureOverride : public Base {
75 void F() override = 0;
76 };
77
78 class PureVirtualOverride : public Base {
79 virtual void F() override = 0;
80 };
81
65 // Finally, some simple sanity tests that overrides in the testing namespace 82 // Finally, some simple sanity tests that overrides in the testing namespace
66 // don't trigger warnings, except for testing::Test. 83 // don't trigger warnings, except for testing::Test.
67 namespace testing { 84 namespace testing {
68 85
69 class Test { 86 class Test {
70 public: 87 public:
71 virtual ~Test(); 88 virtual ~Test();
72 virtual void SetUp(); 89 virtual void SetUp();
73 }; 90 };
74 91
75 class NotTest { 92 class NotTest {
76 public: 93 public:
77 virtual ~NotTest(); 94 virtual ~NotTest();
78 virtual void SetUp(); 95 virtual void SetUp();
79 }; 96 };
80 97
81 } // namespace 98 } // namespace
82 99
83 class MyTest : public testing::Test { 100 class MyTest : public testing::Test {
84 public: 101 public:
85 virtual ~MyTest(); 102 virtual ~MyTest();
86 virtual void SetUp() override; 103 virtual void SetUp() override;
87 }; 104 };
88 105
89 class MyNotTest : public testing::NotTest { 106 class MyNotTest : public testing::NotTest {
90 public: 107 public:
91 virtual ~MyNotTest(); 108 virtual ~MyNotTest();
92 virtual void SetUp() override; 109 virtual void SetUp() override;
93 }; 110 };
OLDNEW
« no previous file with comments | « tools/clang/plugins/FindBadConstructsConsumer.cpp ('k') | tools/clang/plugins/tests/virtual_specifiers.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698