forked from OSchip/llvm-project
CXXMethodDecl::isVirtual needs to check the canonical declaration. Fixes PR4878.
llvm-svn: 81715
This commit is contained in:
parent
eb2cc68254
commit
002f2b3eec
|
@ -776,8 +776,13 @@ public:
|
|||
bool isInstance() const { return !isStatic(); }
|
||||
|
||||
bool isVirtual() const {
|
||||
return isVirtualAsWritten() ||
|
||||
(begin_overridden_methods() != end_overridden_methods());
|
||||
CXXMethodDecl *CD =
|
||||
cast<CXXMethodDecl>(const_cast<CXXMethodDecl*>(this)->getCanonicalDecl());
|
||||
|
||||
if (CD->isVirtualAsWritten())
|
||||
return true;
|
||||
|
||||
return (CD->begin_overridden_methods() != CD->end_overridden_methods());
|
||||
}
|
||||
|
||||
///
|
||||
|
|
|
@ -54,3 +54,13 @@ void f(B* b, C *c) {
|
|||
c->C::f();
|
||||
c->B::f(); // expected-warning{{'f' is deprecated}}
|
||||
}
|
||||
|
||||
struct D {
|
||||
virtual void f() __attribute__((deprecated));
|
||||
};
|
||||
|
||||
void D::f() { }
|
||||
|
||||
void f(D* d) {
|
||||
d->f();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue