diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-05-09 22:02:28 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-05-09 22:02:28 +0000 |
commit | 04e2e665cb1cd7664b9b10427f8b29bd97523caf (patch) | |
tree | 6edc20a9b7904effc86c9b13ea499a87a9bdc26b /clang/lib/Sema/SemaDeclCXX.cpp | |
parent | d0eda92845ffb48ba71ff449c8917337f7c68476 (diff) | |
download | bcm5719-llvm-04e2e665cb1cd7664b9b10427f8b29bd97523caf.tar.gz bcm5719-llvm-04e2e665cb1cd7664b9b10427f8b29bd97523caf.zip |
Don't emit -Wnon-virtual-dtor on final classes, since it's not a problem there.
The base class is the culprit/risk here - a sealed/final derived class
with virtual functions and a non-virtual dtor can't accidentally be
polymorphically destroyed (if the base class's dtor is protected - which
also suppresses this warning).
llvm-svn: 208449
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 54a332aa99e..217588a9c09 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -4413,7 +4413,8 @@ void Sema::CheckCompletedCXXClass(CXXRecordDecl *Record) { // Warn if the class has virtual methods but non-virtual public destructor. if (Record->isPolymorphic() && !Record->isDependentType()) { CXXDestructorDecl *dtor = Record->getDestructor(); - if (!dtor || (!dtor->isVirtual() && dtor->getAccess() == AS_public)) + if ((!dtor || (!dtor->isVirtual() && dtor->getAccess() == AS_public)) && + !Record->hasAttr<FinalAttr>()) Diag(dtor ? dtor->getLocation() : Record->getLocation(), diag::warn_non_virtual_dtor) << Context.getRecordType(Record); } |