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

Unified Diff: tools/clang/plugins/tests/virtual_dtor_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: s/annotation/specifier/g Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: tools/clang/plugins/tests/virtual_dtor_specifiers.cpp
diff --git a/tools/clang/plugins/tests/virtual_dtor_specifiers.cpp b/tools/clang/plugins/tests/virtual_dtor_specifiers.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5af94de7579854d2c76546febad34f20eb483196
--- /dev/null
+++ b/tools/clang/plugins/tests/virtual_dtor_specifiers.cpp
@@ -0,0 +1,50 @@
+// Simple sanity test that virtual dtors are also being checked.
hans 2014/09/26 01:29:29 I would probably have put this in the same file as
dcheng 2014/09/26 07:07:14 Done.
+
+// Purposely use macros to test that the FixIt hints don't try to remove the
+// macro body.
+#define OVERRIDE override
+#define FINAL final
+
+// Base class can only use virtual.
+class Base {
+ public:
+ virtual ~Base() {}
+};
+
+// Derived classes correctly use only override or final specifier.
+class CorrectOverride : public Base {
+ public:
+ ~CorrectOverride() OVERRIDE {}
+};
+
+class CorrectFinal : public CorrectOverride {
+ public:
+ ~CorrectFinal() FINAL {}
+};
+
+// No override on an overridden dtor should trigger a diagnostic.
+class MissingOverride : public Base {
+ public:
+ virtual ~MissingOverride() {}
+};
+
+// Redundant specifiers should trigger a diagnostic.
+class VirtualAndOverride : public Base {
+ public:
+ virtual ~VirtualAndOverride() OVERRIDE {}
+};
+
+class VirtualAndFinal : public Base {
+ public:
+ virtual ~VirtualAndFinal() FINAL {}
+};
+
+class VirtualAndOverrideFinal : public Base {
+ public:
+ virtual ~VirtualAndOverrideFinal() OVERRIDE FINAL {}
+};
+
+class OverrideAndFinal : public Base {
+ public:
+ ~OverrideAndFinal() OVERRIDE FINAL {}
+};

Powered by Google App Engine
This is Rietveld 408576698