Don't emit exit-time destructor warnings for trivial explicitly defaulted dtors
This commit also adds an additional test case for the global destructor warning.
Reviewed in http://llvm-reviews.chandlerc.com/D3205
llvm-svn: 204954
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 919c743..36a1541 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -10463,6 +10463,7 @@
<< VD->getType());
DiagnoseUseOfDecl(Destructor, VD->getLocation());
+ if (Destructor->isTrivial()) return;
if (!VD->hasGlobalStorage()) return;
// Emit warning for non-trivial dtor in global scope (a real global,
@@ -10470,7 +10471,7 @@
Diag(VD->getLocation(), diag::warn_exit_time_destructor);
// TODO: this should be re-enabled for static locals by !CXAAtExit
- if (!Destructor->isTrivial() && !VD->isStaticLocal())
+ if (!VD->isStaticLocal())
Diag(VD->getLocation(), diag::warn_global_destructor);
}