[Codegen] Don't crash if destructor is not accessible.
Testcase provided, in the PR, by Christian Shelton and
reduced by David Majnemer.
PR: 23584
Differential Revision: http://reviews.llvm.org/D10508
Reviewed by: rnk
llvm-svn: 240242
diff --git a/clang/lib/CodeGen/CGClass.cpp b/clang/lib/CodeGen/CGClass.cpp
index 1d2b787..4d6a4e2 100644
--- a/clang/lib/CodeGen/CGClass.cpp
+++ b/clang/lib/CodeGen/CGClass.cpp
@@ -1297,6 +1297,10 @@
if (BaseClassDecl->hasTrivialDestructor())
return true;
+ // Give up if the destructor is not accessible.
+ if (!BaseClassDecl->getDestructor())
+ return false;
+
if (!BaseClassDecl->getDestructor()->hasTrivialBody())
return false;