Patch to warn if 'override' is missing
for an overriding method if class has at least one
'override' specified on one of its methods.
Reviewed by Doug Gregor. rdar://18295240
(I have already checked in all llvm files with missing 'override'
methods and Bob Wilson has fixed a TableGen of FastISel so
no warnings are expected from build of llvm after this patch.
I have already verified this).
llvm-svn: 218925
diff --git a/clang/test/SemaCXX/attr-gnu.cpp b/clang/test/SemaCXX/attr-gnu.cpp
index b4e9f46..fcc3e46 100644
--- a/clang/test/SemaCXX/attr-gnu.cpp
+++ b/clang/test/SemaCXX/attr-gnu.cpp
@@ -15,14 +15,15 @@
namespace {
class B {
public:
- virtual void test() {}
+ virtual void test() {} // expected-note {{overridden virtual function is here}}
virtual void test2() {}
virtual void test3() {}
};
class D : public B {
public:
- void test() __attribute__((deprecated)) final {} // expected-warning {{GCC does not allow an attribute in this position on a function declaration}}
+ void test() __attribute__((deprecated)) final {} // expected-warning {{GCC does not allow an attribute in this position on a function declaration}} \
+ // expected-warning {{'test' overrides a member function but is not marked 'override'}}
void test2() [[]] override {} // Ok
void test3() __attribute__((cf_unknown_transfer)) override {} // Ok, not known to GCC.
};