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

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

Issue 597863002: Update plugin to handle new style rules for virtual annotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add copyright blurb Created 6 years, 2 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // Tests for chromium style checks for virtual/override/final specifiers on
6 // virtual methods.
7
8 // Purposely use macros to test that the FixIt hints don't try to remove the
9 // macro body.
10 #define OVERRIDE override
11 #define FINAL final
12
13 // Base class can only use virtual.
14 class Base {
15 public:
16 virtual ~Base() {}
17 virtual void F() = 0;
18 };
19
20 // Derived classes correctly use only override or final specifier.
21 class CorrectOverride : public Base {
22 public:
23 ~CorrectOverride() OVERRIDE {}
24 void F() OVERRIDE {}
25 };
26
27 class CorrectFinal : public CorrectOverride {
28 public:
29 ~CorrectFinal() FINAL {}
30 void F() FINAL {}
31 };
32
33 // No override on an overridden method should trigger a diagnostic.
34 class MissingOverride : public Base {
35 public:
36 ~MissingOverride() {}
37 void F() {}
38 };
39
40 // Redundant specifiers should trigger a diagnostic.
41 class VirtualAndOverride : public Base {
42 public:
43 virtual ~VirtualAndOverride() OVERRIDE {}
44 virtual void F() OVERRIDE {}
45 };
46
47 class VirtualAndFinal : public Base {
48 public:
49 virtual ~VirtualAndFinal() FINAL {}
50 virtual void F() FINAL {}
51 };
52
53 class VirtualAndOverrideFinal : public Base {
54 public:
55 virtual ~VirtualAndOverrideFinal() OVERRIDE FINAL {}
56 virtual void F() OVERRIDE FINAL {}
57 };
58
59 class OverrideAndFinal : public Base {
60 public:
61 ~OverrideAndFinal() OVERRIDE FINAL {}
62 void F() OVERRIDE FINAL {}
63 };
OLDNEW
« no previous file with comments | « tools/clang/plugins/tests/virtual_methods.txt ('k') | tools/clang/plugins/tests/virtual_specifiers.flags » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698